Results 1 to 10 of 10

Thread: How to not show widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2009
    Location
    Tennessee, US
    Posts
    41
    Thanks
    3
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Smile Re: How to not show widget

    Quote Originally Posted by gQt View Post
    Is it possible to subclass a noneGui class instead of QDialog?
    Both QObject and QTimer are contained in the QtCore module. You can simply inherit your class from QObject instead.
    Qt Code:
    1. class Client: public QObject
    2. {
    3. Q_OBJECT
    4. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    4

    Default Re: How to not show widget

    Thanks amoswood!
    I have already tried to subclass QObject. The problem is then that QObject has no exec(), so the program can not have return Client.exec() in main.cpp.

  3. #3
    Join Date
    Mar 2009
    Location
    Tennessee, US
    Posts
    41
    Thanks
    3
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to not show widget

    Quote Originally Posted by gQt View Post
    I have already tried to subclass QObject. The problem is then that QObject has no exec(), so the program can not have return Client.exec() in main.cpp.
    I don't know what you are doing in your Client class, but you can work around the exec() function with the code or the Qt class QEventLoop:
    Qt Code:
    1. while(true)
    2. {
    3. QApplication::instance()->processEvents();
    4. QApplication::instance()->sendPostedEvents();
    5. }
    To copy to clipboard, switch view to plain text mode 

  4. The following user says thank you to amoswood for this useful post:

    gQt (10th June 2010)

  5. #4
    Join Date
    Feb 2008
    Posts
    36
    Thanks
    4

    Default Re: How to not show widget

    The class QEventLoop solved the problem, thanks Client can subclass QEventLoop, and QEventLoop has also an exec() function, so it is still possible to have the Client.exec() in main.

Similar Threads

  1. Replies: 10
    Last Post: 29th May 2010, 18:42
  2. How to show thw widget in center?
    By sudhansu in forum Qt Programming
    Replies: 3
    Last Post: 4th February 2010, 05:51
  3. How to show the widget?
    By kommu in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2008, 08:43
  4. how to show richtext and icons in one widget in QT2
    By pencilren in forum Qt Programming
    Replies: 1
    Last Post: 16th May 2007, 10:30
  5. How to show a window widget...
    By agent007se in forum Newbie
    Replies: 3
    Last Post: 20th July 2006, 10:42

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.