[QT 5.8.0-1] How to make the QML Button is active (has focus) when application opens window
Solved
QML and Qt Quick
-
Hello!
I have simple example:
import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.0 ApplicationWindow { id: window visible: true width: 640 height: 480 title: qsTr("Hello World") FocusScope { id: focusScope anchors.fill: parent anchors.margins: 40 ColumnLayout { anchors.fill: parent Button { id: button focus: true text: "PRESS 1" Layout.fillWidth: true Layout.fillHeight: true } Button { text: "PRESS 2" Layout.fillWidth: true Layout.fillHeight: true } } } }
Running this code I guess that the first button get focus and this button shows active focus rectange. But actually the first button does not show active focus rectangle:
Only when I press TAB, it becomes active:
Any hints?