代码拉取完成,页面将自动刷新
//xlang Source, Name:gotoline.xcsm
//Date: Sun Sep 19:06:03 2018
class InputDialog : QDialog {
public static class onInputListener{
public bool onInputOk(@NotNilptr String text);
public bool onInputCancel();
public bool onSelectOk(int id){
return false;
}
public String getTitle();
public String getTips();
public String getDefault();
};
public onInputListener listener;
public InputDialog(onInputListener intputlis){
listener = intputlis;
}
QPushButton btnOk, btnCancel;
QLineEdit edtLine;
String result = nilptr;
public void onAttach()override{
setWindowFlags(Constant.CustomizeWindowHint | Constant.WindowCloseButtonHint);
setFixedSize(width(), height());
btnOk = (QPushButton)attachByName(new QPushButton(), "btnOk");
btnCancel = (QPushButton)attachByName(new QPushButton(), "btnCancel");
edtLine = (QLineEdit)attachByName(new QLineEdit(), "edtLine");
QLabel label = (QLabel)attachByName(new QLabel(), "label");
if (label != nilptr){
edtLine.setText(listener.getDefault());
btnOk.setOnClickListener(
new onClickListener(){
void onClick(QObject obj, bool checked)override{
String text = edtLine.getText();
if (listener.onInputOk(text)){
result = text;
close();
}
}
});
btnCancel.setOnClickListener(
new onClickListener(){
void onClick(QObject obj, bool checked)override{
if (listener.onInputCancel()){
close();
}
}
});
label.setText(listener.getTips());
setWindowTitle(listener.getTitle());
setModal(true);
edtLine.setFocus();
}
}
public static void requestInput(onInputListener lis){
QDialog newDlg = new QDialog();
if (newDlg.load(UIManager.getUIData(__xPackageResource("ui/goto.ui"))) == false){
return ;
}
InputDialog wizard = new InputDialog(lis);
wizard.attach(newDlg);
wizard.show();
}
public static String requestInputDlg(onInputListener lis){
QDialog newDlg = new QDialog();
if (newDlg.load(UIManager.getUIData(__xPackageResource("ui/goto.ui"))) == false){
return nilptr;
}
InputDialog wizard = new InputDialog(lis);
wizard.attach(newDlg);
wizard.exec();
return wizard.result;
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。