Home > Mobile > Consult about QComboBox problems in use
Consult about QComboBox problems in use
Time:04-09
, ladies and gentlemen, here is my use QComboBox, code is as follows:
M_comboPro=new QComboBox (this); M_comboPro - & gt; SetStyleSheet (" QComboBox {border - image: url (:/res/PWD/comboBoxBkg PNG); The font-family: "SimHei"; font-size:13px; Color: # 003 da6; Border: 1 px solid gray; } ""QComboBox QAbstractItemView {background: rgba (255255255, 1); Border: 1 px solid rgba (228228228, 1); Border - the radius: 0 px 0 px 5 px 5 px; font-size:13px; Outline: 0 px; } ""QComboBox QAbstractItemView: : item {min - height: 13 px; } ""QComboBox: : the drop - down {border - left - width: 1 px; Border - left - color: lightgray; Border - left - style: solid; Border - top - right - the radius: 3 px; Border - bottom - right - the radius: 3 px; Subcontrol - origin: padding; Subcontrol - position: top right; Width: 18 px; } ""QComboBox: : down - arrow {image: url (:/res/PWD/arrowDown0 PNG)}" "QComboBox: : down - arrow: hover {image: url (/res/PWD/arrowDown0. PNG)}" "QComboBox: : down - arrow: pressed {image: url (:/res/PWD/arrowDown0 PNG)}"); M_comboPro - & gt; AddItem (" when is your birthday?" ); M_comboPro - & gt; AddItem (" how much is your student id?" ); Delegate QStyledItemDelegate *=new QStyledItemDelegate (this); M_comboPro - & gt; SetItemDelegate (delegate); QImage comboBoxImg (" :/res/PWD/comboBoxBkg PNG "); M_comboPro - & gt; The resize (comboBoxImg. The size ()); M_comboPro - & gt; Move (this - & gt; Width () * 8/100 + m_labelFst - & gt; Width (), and this - & gt; Height () * 17/100); The connect (m_comboPro, SIGNAL (currentIndexChanged (int)), and this, SLOT (slotClickedComboBox (int))); What method can let QComboBox text on the left, and then the far left, isn't it? . Also, is the res/PWD/arrowDown0 PNG down arrow, can move to the right a certain position (because the down arrow is right, not fully display)? In the end, if not the position of the moving window QDialog, click the down arrow, it is not a dislocation phenomenon, but once the moving window, click the down arrow, dislocation will appear options? Is there a way to solve these problems? Please give a bosses to give directions, I here really appreciate!
CodePudding user response:
No picture can't accurate grasp your requirements, What method can let QComboBox text on the left, and then the far left, isn't it? The default styles this won't be on the left, there will be a certain margin, Fine-tuning padding - left: 2 px; Can adjust the distance to the border, numerical according to need to modify,
Down arrow, can move to the right position (because the down arrow is right, not fully display) : be left -- -- The down - arrow is drawn on the drop - down, Down - arrow image with geometric scaling down - arrow's size. The drop - down to set the width to 18. Want a down - arrow all displayed, you need to specify the down - the size of the arrow, no more than 18, QComboBox: : down - arrow { Widtd: 18 px; Height: 18 px; Image: url (:/res/PWD/arrowDown0 PNG) }