Results 1 to 5 of 5

Thread: QWidget: Cannot create a QWidget when no GUI is being used

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Smile Re: QWidget: Cannot create a QWidget when no GUI is being used

    Quote Originally Posted by wysota View Post
    Make those plugin not inherit QWidget but return an instance of a QWidget. Then you'll be able to create an instance of a plugin without creating a QWidget. Unfortunately you'd have to redesign your plugin system for that to work.
    I think I could see that working. Basically, the plugin would be a factory class that would pass a QWidget-based object via a function call on request. The main class would then load the plugin, qobject_cast it, then request the QWidget (if appropriate).

    Ok, I think I can do this relatively easily at this stage - my current plugins don't yet do anything, so there's not a whole lot to re-write. Thanks!

    EDIT: Actually, I think this will greatly simplify things now, as I can now create signals and slots in my plugin interface (as long as the interface header itself does not include the signals and slots).

    Basically, it's like this:

    Interface - contains some basic code to hand back a QWidget (or QObject, depending on the plugin type)
    Shared abstract base class - contains signals and slots that the QWidget (or QObject) should contain that is passed back. As the interface itself only knows that it's something called a QWidget (or QObject), and doesn't know what either of those are (not including the headers), it should work. I think you just helped me find a way to cleanly implement my plugin structure. Thanks!
    Last edited by KShots; 24th April 2007 at 13:32.
    Life without passion is death in disguise

Similar Threads

  1. Replies: 3
    Last Post: 8th March 2007, 14:54
  2. Showing QMainWindow without showing a child QWidget
    By discostu in forum Qt Programming
    Replies: 3
    Last Post: 4th March 2007, 09:03
  3. QFormbuilder : can not create widget of Q3ListView
    By user_mail07 in forum Qt Programming
    Replies: 5
    Last Post: 26th January 2007, 23:12
  4. How to create an Insert/Submit button for a form.
    By fnmblot in forum Qt Programming
    Replies: 5
    Last Post: 4th August 2006, 16:18
  5. Replies: 1
    Last Post: 2nd May 2006, 21:11

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.