qml - Center the label in a ComboBox element with a custom ComboBoxStyle -
i using qtquick.controls 1.0 , qtquick.controls.styles 1.0 , can't find way align label of combobox vertically , on right.
this current code
import qtquick 2.0 import qtquick.controls 1.0 import qtquick.controls.styles 1.0 combobox { id: combocategories width: 230 height: 30 style: comboboxstyle { background: rectangle { id: rectcategory width: combocategories.width height: combocategories.height color: "white" } label: text { anchors.verticalcenter: parent.verticalcenter anchors.right: background.right font.pointsize: 12 color: "#808080" text: control.currenttext } } } but label stays in top left of element , not seem affected anchors. tried replace parent control or background no effect
i don't know reasoning behind if wrap text element in item can
import qtquick 2.0 import qtquick.controls 1.0 import qtquick.controls.styles 1.0 combobox { id: combocategories width: 230 height: 30 style: comboboxstyle { background: rectangle { id: rectcategory width: combocategories.width height: combocategories.height color: "white" } label: item { anchors.fill: parent text { anchors.verticalcenter: parent.verticalcenter anchors.right: parent.right anchors.rightmargin: 5 font.pointsize: 12 color: "#808080" text: control.currenttext } } }
Comments
Post a Comment