Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt 5.3 Combobox component problem
Forum Updated to NodeBB v4.3 + New Features

Qt 5.3 Combobox component problem

Scheduled Pinned Locked Moved QML and Qt Quick
qmlcomboboxqt quick
5 Posts 2 Posters 1.8k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xumuk
    wrote on last edited by
    #1

    Drop down menu of combobox component is shown on wrong position.

    main.cpp code:

    int main(int argc, char *argv[])
    {
        QWidget *container = new QWidget;
    
        QHBoxLayout *layout = new QHBoxLayout(container);
    
        QQuickWidget *qmlWidget = new QQuickWidget(QUrl(QStringLiteral("qrc:/main.qml")));
        qmlWidget->setFixedSize(640, 480);
        qmlWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
    
        layout->addWidget(qmlWidget);
    
        container->resize(640, 900);
        container->show();
    
        return app.exec();
    }
    

    main.qml code:

    import QtQuick 2.3
    import QtQuick.Controls 1.2
    
    Rectangle {
        id: mainRect
    
        width: 500
        height: 500
    
        ListModel {
            id: m
            ListElement { text: "1" }
            ListElement { text: "2" }
            ListElement { text: "3" }
        }
    
        ComboBox {
            model: m
            width: 200
            height: 30
            anchors.centerIn: parent
        }
    }
    

    Drop down menu will be shown above combobox...
    P.S. I need to use Qt 5.3

    p3c0P 1 Reply Last reply
    0
    • X xumuk

      Drop down menu of combobox component is shown on wrong position.

      main.cpp code:

      int main(int argc, char *argv[])
      {
          QWidget *container = new QWidget;
      
          QHBoxLayout *layout = new QHBoxLayout(container);
      
          QQuickWidget *qmlWidget = new QQuickWidget(QUrl(QStringLiteral("qrc:/main.qml")));
          qmlWidget->setFixedSize(640, 480);
          qmlWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
      
          layout->addWidget(qmlWidget);
      
          container->resize(640, 900);
          container->show();
      
          return app.exec();
      }
      

      main.qml code:

      import QtQuick 2.3
      import QtQuick.Controls 1.2
      
      Rectangle {
          id: mainRect
      
          width: 500
          height: 500
      
          ListModel {
              id: m
              ListElement { text: "1" }
              ListElement { text: "2" }
              ListElement { text: "3" }
          }
      
          ComboBox {
              model: m
              width: 200
              height: 30
              anchors.centerIn: parent
          }
      }
      

      Drop down menu will be shown above combobox...
      P.S. I need to use Qt 5.3

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @xumuk Works with Qt 5.4 :)
      Probably a bug in Qt 5.3

      157

      X 1 Reply Last reply
      0
      • p3c0P p3c0

        @xumuk Works with Qt 5.4 :)
        Probably a bug in Qt 5.3

        X Offline
        X Offline
        xumuk
        wrote on last edited by
        #3

        @p3c0 Yeah, in 5.4 it`s works...I know ))) But i need it to work in 5.3 (((

        p3c0P 1 Reply Last reply
        0
        • X xumuk

          @p3c0 Yeah, in 5.4 it`s works...I know ))) But i need it to work in 5.3 (((

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @xumuk Well, since it could be a bug in Qt 5.3 (as it works in Qt 5.4) I see no way to do so. AFAIK there are no methods to position a dropdown menu too.
          Still you may try using ComboBoxStyle and position the delegate inside it. But I doubt it may work.

          157

          X 1 Reply Last reply
          0
          • p3c0P p3c0

            @xumuk Well, since it could be a bug in Qt 5.3 (as it works in Qt 5.4) I see no way to do so. AFAIK there are no methods to position a dropdown menu too.
            Still you may try using ComboBoxStyle and position the delegate inside it. But I doubt it may work.

            X Offline
            X Offline
            xumuk
            wrote on last edited by
            #5

            @p3c0 I have already used ComboboxStyle to customize it, but still can`t solve this) Will try, ty for answer.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved