forked from qt-creator/qt-creator
QmlDesigner: Consider suffix for Qml ComboBox
Task-number: QDS-9489 Change-Id: I77b883167db24deea44fa465c297c990a0d56a71 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
This commit is contained in:
@@ -30,6 +30,7 @@ T.ComboBox {
|
||||
property real __actionIndicatorHeight: control.style.actionIndicatorSize.height
|
||||
|
||||
property alias textInput: comboBoxInput
|
||||
property alias suffix: comboBoxInput.suffix
|
||||
|
||||
property int maximumPopupHeight: control.style.maxComboBoxPopupHeight
|
||||
|
||||
|
@@ -15,10 +15,7 @@ TextInput {
|
||||
property bool edit: control.activeFocus
|
||||
property bool hover: mouseArea.containsMouse && control.enabled
|
||||
property bool elidable: false
|
||||
readonly property real textAdvanceWidth: control.elidable
|
||||
? (elidableText.leftPadding
|
||||
+ elidableTextMetrics.advanceWidth)
|
||||
: control.implicitWidth
|
||||
property string suffix: ""
|
||||
|
||||
z: 2
|
||||
font: control.__parentControl.font
|
||||
@@ -48,15 +45,22 @@ TextInput {
|
||||
verticalAlignment: control.verticalAlignment
|
||||
font: control.font
|
||||
color: control.color
|
||||
text: control.text
|
||||
text: control.text + control.suffix
|
||||
visible: control.elidable
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
TextMetrics {
|
||||
id: elidableTextMetrics
|
||||
font: elidableText.font
|
||||
text: elidableText.text
|
||||
Text {
|
||||
id: nonElidableSuffix
|
||||
anchors.fill: control
|
||||
leftPadding: control.implicitWidth - control.rightPadding
|
||||
rightPadding: control.rightPadding
|
||||
horizontalAlignment: control.horizontalAlignment
|
||||
verticalAlignment: control.verticalAlignment
|
||||
font: control.font
|
||||
color: control.color
|
||||
text: control.suffix
|
||||
visible: !control.elidable
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -162,6 +166,10 @@ TextInput {
|
||||
target: elidableText
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: nonElidableSuffix
|
||||
visible: false
|
||||
}
|
||||
PropertyChanges {
|
||||
target: mouseArea
|
||||
cursorShape: Qt.IBeamCursor
|
||||
|
@@ -16,6 +16,7 @@ T.ComboBox {
|
||||
property bool edit: false
|
||||
property bool open: window.visible
|
||||
property bool openUpwards: false
|
||||
property alias suffix: comboBoxInput.suffix
|
||||
|
||||
editable: false
|
||||
width: control.style.controlSize.width
|
||||
|
@@ -238,22 +238,13 @@ Rectangle {
|
||||
anchors.right: annotations.left
|
||||
anchors.rightMargin: 10
|
||||
model: backend.workspaces
|
||||
suffix: qsTr(" Workspace")
|
||||
property int currentWorkspaceIndex: workspaces.find(backend.currentWorkspace)
|
||||
onCurrentWorkspaceIndexChanged: workspaces.currentIndex = workspaces.currentWorkspaceIndex
|
||||
|
||||
visible: !root.flyoutEnabled
|
||||
|
||||
onActivated: backend.setCurrentWorkspace(workspaces.currentText)
|
||||
Text {
|
||||
z: 20
|
||||
x: workspaces.contentItem.implicitWidth
|
||||
|
||||
text: qsTr("Workspace")
|
||||
font: workspaces.font
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
color: workspaces.contentItem.color
|
||||
}
|
||||
}
|
||||
|
||||
ToolbarButton {
|
||||
|
Reference in New Issue
Block a user