Results 1 to 3 of 3

Thread: How set widget as current

  1. #1
    Join Date
    Nov 2012
    Location
    Poland/UK
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default How set widget as current

    Hi, when I trying to open QDialog or QWidget from other QWidget, opened widget is 'frozen' - not current, but when I close first widget, second widget is active.
    How set new widget as current when is open from first widget ?

    My code (first QWidget)
    Qt Code:
    1. connect(mailbox, SIGNAL(tokenRequired(MailSystem*)), Token::getInstance(), SLOT(onTokenRequired(MailSystem*)));
    To copy to clipboard, switch view to plain text mode 

    End Token.h constructor

    Qt Code:
    1. namespace Ui {
    2. class Token;
    3. }
    4.  
    5. class Token : public QWidget
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. explicit Token(QWidget *parent = 0);
    11. static Token *getInstance()
    12. {
    13. static Token *instance = new Token;
    14. return instance;
    15. }
    16. ...
    17. }
    To copy to clipboard, switch view to plain text mode 

    Regards

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How set widget as current

    If first widget is modal this is normal behavior - it must be closed to activate another window.

    If first widget is not modal then try this (line 14) :
    Qt Code:
    1. namespace Ui {
    2. class Token;
    3. }
    4.  
    5. class Token : public QWidget
    6. {
    7. Q_OBJECT
    8.  
    9. public:
    10. explicit Token(QWidget *parent = 0);
    11. static Token *getInstance()
    12. {
    13. static Token *instance = new Token;
    14. QApplication::setActiveWindow(instance);
    15. return instance;
    16. }
    17. ...
    18. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Nov 2012
    Location
    Poland/UK
    Posts
    28
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How set widget as current

    Thank You for Your reply.
    I found the solution
    Set window modality in Token

Similar Threads

  1. Replies: 6
    Last Post: 21st August 2013, 12:53
  2. Replies: 4
    Last Post: 19th June 2013, 11:08
  3. Replies: 3
    Last Post: 25th August 2012, 11:18
  4. QlineEdit is not showing the Current Focused Widget,
    By savaliya_ambani in forum Qt for Embedded and Mobile
    Replies: 12
    Last Post: 18th December 2010, 12:45
  5. Replies: 4
    Last Post: 29th September 2010, 19:21

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.