Qt 5.3 Combobox component problem



  • 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


  • Moderators

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



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


  • Moderators

    @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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.