小编Mah*_*ili的帖子

可聚焦的 Qml 组件(将我的控件聚焦在选项卡上)

我在 qml 中创建了一个自定义按钮,我想重点关注按“选项卡”,我的意思是“如果它位于队列顶部,则按选项卡跳转到它”默认情况下,qml 在按钮本身和其他一些控件上具有此功能也是,但是不存在的新组件呢,我看到了 qml 的“FocusScope”控件,但没有使用它的文档,我不确定如何实现它,这是我的控件:

import QtQuick 2.4

Item {
    id: button
    width: innerText.width + 10
    height: 30
    property alias text: innerText.text;
    property alias font: innerText.font;
    property color color: "#00171f"
    property color hoverColor: "#00395f"
    property color pressColor: "#3E65FF"
    property int fontSize: 12
    property int borderWidth: 0
    property int borderRadius: 2
    property bool highlighted : true
    onEnabledChanged: state = ""
    signal clicked
    property var background
    Rectangle {
        id: rectangleButton
        anchors.fill: button
        radius: borderRadius
        color: button.enabled ? button.color : "grey"
        border.width: …
Run Code Online (Sandbox Code Playgroud)

qt qml

1
推荐指数
1
解决办法
1503
查看次数

标签 统计

qml ×1

qt ×1