这里我遇到一个问题,我需要更改下拉选项以对齐。
现在我推动的价值就像......
foreach (int key, map.keys()){
if(position ==1 && key >1000) {
Option* option = Option::create();
option->setText(map[key]);
option->setValue(key);
dropDown1->add(option);
//dropDown1->setHorizontalAlignment(HorizontalAlignment::Right);
}else
if(position ==2 && key < 1000) {
Option* option = Option::create();
option->setText(map[key]);
option->setValue(key);
dropDown1->add(option);
}
}
和我的qml就像
Container {
objectName: "DdContainer"
layout: StackLayout {
orientation: propertyMap.textSize.length == 6 ? LayoutOrientation.RightToLeft : LayoutOrientation.LeftToRight
}
topPadding: 20.0
horizontalAlignment: HorizontalAlignment.Fill
DropDown {
// title: "Select Symbol"
objectName: "myDropDown"
enabled: true
layoutProperties: StackLayoutProperties {
spaceQuota: 3.0
}
}
Button {
imageSource: "asset:///images/add_button.png"
maxHeight: 100
maxWidth: 100
layoutProperties: StackLayoutProperties {
spaceQuota: 1.0
}
onClicked: {
_addOrDelRef.showSymbolsListView();
// _addOrDelRef.dropSymbols(1);
}
}
}
如果键低于1000,则左对齐,否则右对齐。如何在bb 10级联中执行此操作...
请帮忙, 感谢...
答案 0 :(得分:0)
对齐的逻辑在这里: orientation:propertyMap.textSize.length == 6? LayoutOrientation.RightToLeft:LayoutOrientation.LeftToRight
您需要根据键
更改此值