PDA

View Full Version : Using QuiLoader in QtScript file after bindings built



dlang123
20th October 2010, 22:23
I used QtScript Generator to generate the QT bindings.

Then I imported all the bindings into C++ and tried to make a quick sample program. What I am trying to do, is use QTDesigner to create a .ui file, and then use QtScript and QUiLoader to load the ui file in the script. I continuously get segfaults on the load portion.

Here is a simple version of the code.



function testThis(parent){
QMainWindow.call(this,parent);
this.loadUi();
}

testThis.prototype = new QMainWindow();


testThis.prototype.loadUi = function(){

var loader = new QUiLoader();
var file = new QFile('./test.ui');
var fileExists = file.exists();
if(fileExists)
{
var fileOpen = file.open(QIODevice.ReadOnly);
if(fileOpen){
var huh = loader.createWidget("QLabel",0, "test");

huh.show();

var ui = this.loader.load(this.file,this);

file.close();
}
}
}
var newWindow = new testThis();
QCoreApplication.exec();


the C++ side works fine, I am basically using the qs_eval that ships with the scripts to even try and test this. All of the opens and exists are true, so the QFile is there.

Just the ui=loader.load is where the problems are.. any help would be appreciated.

Oh the huh label shows up just fine, so I know that the QUiLoader is at least working and creating widgets by name.

dlang123
27th October 2010, 16:34
Turns out it seems to be because of QT 4.7. I tried the previous 4.6.x build and it seemed to mostly work fine.