Results 1 to 2 of 2

Thread: how to show an app if it manually hide

  1. #1
    Join Date
    Mar 2010
    Location
    Ahmedabad, Gujarat
    Posts
    35
    Thanks
    5
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default how to show an app if it manually hide

    hi guys,

    i have an app.

    i have made a function in my main file of the app.

    in which i want show and hide app automatically after every 5 sec.

    Qt Code:
    1. while(1){
    2. app.show();
    3. sleep(5);
    4. app.hide();
    5. sleep(5);
    6. };
    To copy to clipboard, switch view to plain text mode 

    but once it is minimized it is not showing anything

    what to do?

  2. #2
    Join Date
    Mar 2007
    Posts
    57
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to show an app if it manually hide

    First of all, you should call hide() or show() on your mainwindow, not on the application.

    Supposing you do that, note that while doing this in main (i.e. outside of the event loop), means that you did not even enter the event loop, thus calling show() will probably not work correctly.

    Thus, you should implement this functionality in your mainwindow class. I suggest defining two slots, for instance myHide and myShow.

    myShow would then:
    Qt Code:
    1. show();
    2. QTimer::singleShot (5000, this, SLOT(myHide()));
    To copy to clipboard, switch view to plain text mode 

    myHide would do something similar but reversed obviously. Furthermore, you should call either myHide or myShow once by yourself.

Similar Threads

  1. QToolButton show()&hide() not correct
    By daiheitan in forum Qt Programming
    Replies: 1
    Last Post: 13th March 2010, 12:44
  2. how to show and hide frames?
    By rambo83 in forum Qt Programming
    Replies: 2
    Last Post: 6th January 2010, 09:53
  3. Hide and Show QMenu
    By febil in forum Qt Programming
    Replies: 3
    Last Post: 25th March 2009, 09:31
  4. hide from taskbar but show to ALT-TAB
    By musikit in forum Qt Programming
    Replies: 0
    Last Post: 15th August 2008, 16:14
  5. Show or hide a form
    By Gayathri in forum Newbie
    Replies: 11
    Last Post: 17th November 2006, 12:39

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.