0

在这里我面临一个问题,我需要将下拉选项更改为右对齐。

现在我正在推动价值......

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 级联中做到这一点......

请帮忙,谢谢...

4

1 回答 1

0

对齐的逻辑在这里:orientation: propertyMap.textSize.length == 6 ? LayoutOrientation.RightToLeft : LayoutOrientation.LeftToRight

你需要根据key改变这个值

于 2013-10-15T16:10:11.547 回答