代码拉取完成,页面将自动刷新
//xlang Source, Name:MultiSelectDialog.x
//Date: Sat Apr 04:24:36 2020
class MultiSelectDialog : QDialog{
InputDialog.onInputListener listener;
public MultiSelectDialog(InputDialog.onInputListener intputlis, String [] items){
listener = intputlis;
displayItems = items;
}
String [] displayItems;
QPushButton btnOk, btnCancel;
QTreeWidget treeWidget;
public void onOk(){
long item = treeWidget.getSelItem();
int id = -1;
if (item != 0){
id = treeWidget.getItemTag(item,0);
}
if (listener.onSelectOk(id)){
done(1);
}
}
public void onAttach()override{
setWindowFlags(Constant.CustomizeWindowHint | Constant.WindowMinMaxButtonsHint | Constant.WindowCloseButtonHint);
btnOk = (QPushButton)attachByName(new QPushButton(), "btnOk");
btnCancel = (QPushButton)attachByName(new QPushButton(), "btnCancel");
treeWidget = (QTreeWidget)attachByName(new QTreeWidget(), "treeWidget");
treeWidget.setOnTreeViewItemEvent(new onTreeViewItemEvent(){
void onItemDoubleClicked(QTreeWidget,long item, int column) {
onOk();
}
});
btnOk.setOnClickListener(
new onClickListener(){
void onClick(QObject obj, bool checked)override{
onOk();
}
});
btnCancel.setOnClickListener(
new onClickListener(){
void onClick(QObject obj, bool checked)override{
if (listener.onInputCancel()){
done(0);
}
}
});
String defid = listener.getDefault();
int defnid = 0;
if (defid != nilptr){
defnid = defid.parseInt();
}
for (int i = 0; i < displayItems.length; i++){
long hi = treeWidget.addItem(nilptr,displayItems[i]);
treeWidget.setItemTag(hi,0,i);
if (defnid == i){
treeWidget.setItemSelected(hi,true);
}
}
setWindowTitle(listener.getTitle());
setModal(true);
}
public static int requestSelect(InputDialog.onInputListener lis, String [] items){
QDialog newDlg = new QDialog();
if (newDlg.load(UIManager.getUIData(__xPackageResource("ui/mulsel.ui"))) == false){
return 0;
}
MultiSelectDialog wizard = new MultiSelectDialog(lis, items);
wizard.attach(newDlg);
return wizard.exec();
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。