0 Star 2 Fork 1

Cadaqs/XStudio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
MultiSelectDialog.x 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
Cadaqs 提交于 2020-11-28 21:28 . 9233
//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();
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/ixlang/XStudio.git
[email protected]:ixlang/XStudio.git
ixlang
XStudio
XStudio
master

搜索帮助