Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QUiLoader in QtScript won't load a .ui file
Forum Updated to NodeBB v4.3 + New Features

QUiLoader in QtScript won't load a .ui file

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dlang123
    wrote on 21 Oct 2010, 13:07 last edited by
    #1

    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. It always throws a seg fault when it reaches this line of code.

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

    I am using Qt 4.7.

    Oh and on a side note, I've tried it with the this. and I have tried it without them, some won't work, but they all eventually give the same result.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dlang123
      wrote on 22 Oct 2010, 19:29 last edited by
      #2

      Funny thing.. I compiled 4.6.3 and redid the bindings from the lab using them.. this now works.

      I still can't get the bindings WebKit example to load, but this at least fixed my biggest issue.

      1 Reply Last reply
      0

      1/2

      21 Oct 2010, 13:07

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved