Qml 在具有自定义ComboBoxStyle的ComboBox元素中居中放置标签

Qml 在具有自定义ComboBoxStyle的ComboBox元素中居中放置标签,qml,qt5,qtquick2,Qml,Qt5,Qtquick2,我正在使用QtQuick.Controls 1.0和QtQuick.Controls.Styles 1.0,我找不到正确的方法来垂直和右侧对齐组合框的标签 这是我当前的代码 import QtQuick 2.0 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 ComboBox { id: comboCategories width: 230 height: 30 style: ComboBoxSt

我正在使用
QtQuick.Controls 1.0
QtQuick.Controls.Styles 1.0
,我找不到正确的方法来垂直和右侧对齐
组合框的标签

这是我当前的代码

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
    }
  }
}

但是标签保持在我的元素的左上角,并且似乎不受锚的影响。我还试图用
控件
背景
替换
父项
,但没有任何效果

我不清楚这背后的原因,但如果我将
文本
元素包装在
中,那么我可以正确地

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
      }
  }
}