Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

buddy function like with QLabel



  • In Qt Widgets wie can assign buddies to QLabel like this:

    QLineEdit *nameEdit  = new QLineEdit(this);
    QLabel    *nameLabel = new QLabel("&Name:", this);
    nameLabel->setBuddy(nameEdit);
    

    I could not find this in qml. Is there a way to achieve it?

    For Example in QML I used a Text for the QLabel and a TextField to replace QLineEdit like this:

    RowLayout {
        Text {
            text: qsTr("Question:")
        }
        TextField {
            id: questionTextField
            Layout.fillWidth: true
            selectByMouse: true
        }
    }
    

Log in to reply