Results 1 to 2 of 2

Thread: Using QuiLoader in QtScript file after bindings built

  1. #1
    Join Date
    Aug 2010
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Using QuiLoader in QtScript file after bindings built

    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.

    Qt Code:
    1. function testThis(parent){
    2. QMainWindow.call(this,parent);
    3. this.loadUi();
    4. }
    5.  
    6. testThis.prototype = new QMainWindow();
    7.  
    8.  
    9. testThis.prototype.loadUi = function(){
    10.  
    11. var loader = new QUiLoader();
    12. var file = new QFile('./test.ui');
    13. var fileExists = file.exists();
    14. if(fileExists)
    15. {
    16. var fileOpen = file.open(QIODevice.ReadOnly);
    17. if(fileOpen){
    18. var huh = loader.createWidget("QLabel",0, "test");
    19.  
    20. huh.show();
    21.  
    22. var ui = this.loader.load(this.file,this);
    23.  
    24. file.close();
    25. }
    26. }
    27. }
    28. var newWindow = new testThis();
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Aug 2010
    Posts
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using QuiLoader in QtScript file after bindings built

    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.

Similar Threads

  1. Replies: 6
    Last Post: 20th June 2012, 16:15
  2. undefined reference to `QUiLoader::QUiLoader(QObject*)'
    By ashukla in forum Qt Programming
    Replies: 7
    Last Post: 7th October 2011, 18:05
  3. Using QtScript Generator to generate my bindings
    By inpoculis789 in forum Qt Programming
    Replies: 2
    Last Post: 21st October 2010, 21:59
  4. Replies: 1
    Last Post: 25th June 2010, 13:17
  5. QtScript Bindings Generator ScriptShell Event Binding
    By JohannesMunk in forum Qt Programming
    Replies: 2
    Last Post: 10th April 2010, 13:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.