Development/Tutorials/Graphics/Migrate Qt Quick Controls 1

From KDE TechBase
Revision as of 19:47, 13 September 2019 by Guoyunhe (talk | contribs)

Import

import QtQuick.Controls 1.4

to

import QtQuick.Controls 2.8

Icon

Button {
    iconName: "file-new"
    iconSource: "my-file-new.svg"
}

to

Button {
    icon.name: "file-new"
    icon.source: "my-file-new.svg"
}

ToolTip

Button {
    tooltip: "Create new file"
}

to

Button {
    ToolTip.visible: hovered
    ToolTip.text: "Create new file"
}

ExclusiveGroup

ExclusiveGroup { id: filterGroup}

Button {
    exclusiveGroup: filterGroup
}
Button {
    exclusiveGroup: filterGroup
}

to

ButtonGroup { id: filterGroup}

Button {
    ButtonGroup.group: filterGroup
}
Button {
    ButtonGroup.group: filterGroup
}

SplitView

You need at least Qt 5.13 and QtQuick.Controls 2.13. For older system, this might not be supported. You can use RowLayout/ColumnLayout instead if you want to lower system requirements.

Examples