Results 1 to 6 of 6

Thread: Trying to use customwidget in the ui file that is loaded using QtUiLoader class

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Trying to use customwidget in the ui file that is loaded using QtUiLoader class

    Hi,

    I have a situation.
    I am using Qt 4.6.2. I am loading ui using QtUiLoader.load() function. It works fine for Qt provided widgets, but when I create a custom dial derived from QDial and use it in the ui file, that part of ui is blank.
    Does anyone know the reason.
    Is there any other way I can load a custom widget at runtime?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader

    Your custom widget should be in the plugin path.

  3. #3
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader

    What is plugin path?
    Do you mean I should put the .cpp and .h file in that path.
    When I load the ui regular way (without QtUILoader) I can see the customwidget. I have included the .cpp and .h files of customwidget in the project.

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader

    http://doc.qt.nokia.com/4.6/quiloader.html#pluginPaths

    Check what the output is of that function, then add your widget to that path. And I guess, it needs to be the object (compiled widget)

  5. The following user says thank you to tbscope for this useful post:

    dpatel (7th May 2010)

  6. #5
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader

    Sorry for the basic questions but, how do I compile the widget? it would be great if you can give me a command to do that.
    thanks

  7. #6
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader

    Actually I got a solution to the problem. Its in examples/script/qstetrix example. We have to create a custom QUiLoader class and implement createWidget() function. In that we will have to create our custom widgets differently then the Qt native widgets.

Similar Threads

  1. Read File -> Use class
    By T0bi4s in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2010, 13:40
  2. customwidget and event help
    By eva2002 in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2010, 06:37
  3. Replies: 3
    Last Post: 27th December 2008, 19:34
  4. Avi File Class
    By ascii in forum Qt Programming
    Replies: 4
    Last Post: 12th November 2008, 11:34
  5. config file class
    By feizhou in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2006, 07:49

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.