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

Qt 5.3 Combobox component problem

Scheduled Pinned Locked Moved QML and Qt Quick
qmlcomboboxqt quick
5 Posts 2 Posters 1.8k Views
  • 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 1 Jun 2015, 11:53 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

    P 1 Reply Last reply 1 Jun 2015, 12:02
    0
    • X xumuk
      1 Jun 2015, 11:53

      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

      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 1 Jun 2015, 12:02 last edited by
      #2

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

      157

      X 1 Reply Last reply 1 Jun 2015, 12:03
      0
      • P p3c0
        1 Jun 2015, 12:02

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

        X Offline
        X Offline
        xumuk
        wrote on 1 Jun 2015, 12:03 last edited by
        #3

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

        P 1 Reply Last reply 1 Jun 2015, 12:11
        0
        • X xumuk
          1 Jun 2015, 12:03

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

          P Offline
          P Offline
          p3c0
          Moderators
          wrote on 1 Jun 2015, 12:11 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 1 Jun 2015, 12:13
          0
          • P p3c0
            1 Jun 2015, 12:11

            @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 1 Jun 2015, 12:13 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

            2/5

            1 Jun 2015, 12:02

            • Login

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