Results 1 to 4 of 4

Thread: Best way to set focus to the application?

  1. #1
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question Best way to set focus to the application?

    Hello, when one instance of my program detects another instance it sends a message to the already running instance and it tries to strongly focus itself.
    The code that does the focus is:
    Qt Code:
    1. this->showNormal();
    2. this->setFocusPolicy(Qt::StrongFocus);
    3. this->setFocus();
    4. this->raise();
    5. this->setVisible(true);
    6. this->activateWindow();
    To copy to clipboard, switch view to plain text mode 
    And all these in a row result to only a blinking minimize-bar, just like the program wants user's attention, but I need stronger focus, like go top of all the other windows.
    How is this possible? Thanks!
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Best way to set focus to the application?

    You may want to check this thread : How to raise application from background

  3. #3
    Join Date
    Jul 2010
    Location
    /home/hakermania/
    Posts
    233
    Thanks
    129
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Best way to set focus to the application?

    Thanks for this, this post is old, but I (really) haven't solved this yet... The thread you specified was about Windows and I am working for ubuntu linux...

    This is quite confusing, the system kind of recognized that a windows wants to come to the front but the window never shows itself. The only indication that something is happening is that current focused application loses focus... Nothing else actually...
    When you 're trying to help somebody in the newbie section, don't forget that he is a newbie. Be specific and give examples.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best way to set focus to the application?

    Are you trying to focus an unfocused window or show a hidden/minimized one?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Check If Application now has focus again
    By ShapeShiftme in forum Qt Programming
    Replies: 7
    Last Post: 21st July 2011, 06:20
  2. Application Lost Focus / Inactive / In Background
    By javed_alam786 in forum Qt Programming
    Replies: 3
    Last Post: 10th May 2011, 10:12
  3. Making my Application sole focus !
    By fassage in forum Qt Programming
    Replies: 3
    Last Post: 11th November 2009, 10:13
  4. How detective lost focus application ?
    By Torsten in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 14:19
  5. removing focus of application?
    By triperzonak in forum Qt Programming
    Replies: 0
    Last Post: 16th July 2008, 15:17

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.