Results 1 to 4 of 4

Thread: Question about window focus.

  1. #1
    Join Date
    Mar 2015
    Posts
    105
    Thanks
    50

    Default Question about window focus.

    Good day!

    I have a QMainWindow with 3 buttons inside, lets call it window1. When i click on button1, for example, it opens a QDialog window. The problem is when i click any one of these buttons and this QDialog opens, i cannot access window1 again to open the others QDialog through those others buttons!

    How can i change that?

  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: Question about window focus.

    How You open this QDialog ? You must do it with show not with exec.

  3. The following user says thank you to Lesiok for this useful post:

    robgeek (9th February 2016)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Question about window focus.

    Sounds like you are opening the dialog as a "modal" dialog, meaning it prevents user interaction with its parent (Window modality) or any other window of the application (application modality).

    Usually QDialog is non-modal, so you either set the modality or you are calling QDialog::exec().

    Cheers,
    _

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

    robgeek (9th February 2016)

  6. #4
    Join Date
    Mar 2015
    Posts
    105
    Thanks
    50

    Default Re: Question about window focus.

    Yes, i was using exec(). I'll change to show().

    Thanks!

Similar Threads

  1. Getting Focus to Window
    By uahmed in forum Qt Programming
    Replies: 1
    Last Post: 19th March 2012, 22:44
  2. Question about focus
    By franco.amato in forum Qt Programming
    Replies: 5
    Last Post: 15th July 2011, 07:42
  3. Question about focus
    By franco.amato in forum Qt Programming
    Replies: 2
    Last Post: 22nd January 2010, 17:46
  4. Window focus question
    By waynew in forum Newbie
    Replies: 3
    Last Post: 31st October 2009, 23:11
  5. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00

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.