Skip to content

Instantly share code, notes, and snippets.

@lasconic
Created March 10, 2012 17:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lasconic/2012268 to your computer and use it in GitHub Desktop.
Save lasconic/2012268 to your computer and use it in GitHub Desktop.
Creating a GUI in QtScript using .ui file
//read the UI file and create a form out of it
var loader = new QUiLoader(null);
var file = new QFile(pluginPath + "/my.ui");
file.open(QIODevice.OpenMode(QIODevice.ReadOnly, QIODevice.Text));
form = loader.load(file, null);
//initialize some widget value if necessary
form.verticalLayoutWidget.myLabel.text = curScore.title;
form.verticalLayoutWidget.myLabel2.text = curScore.composer;
//connect signal
form.searchBtn.clicked.connect(doSomething);
form.closeBtn.clicked.connect(close);
//show the form
form.show();
@dbanet
Copy link

dbanet commented Aug 1, 2014

COOL I love you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment