×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Mar 2009
    Location
    Chennai, India
    Posts
    49

    Is there a Qt Way of hiding the QMainWindow?

    I need a hide functionality(sending an application to background) in my Qt application

    I was looking at this wiki link - http://wiki.forum.nokia.com/index.ph..._to_background
    But when I tried the above tutorial, I dont know how to include the RWindowGroup header in my application.

    So, I would like to do it using Qt itself.

    When I say "hide", I dont want my application icon to be listed in the list of open applications that we get when we long press the menu key (S60v5)

  2. #2
    Super Contributor
    Join Date
    Mar 2004
    Location
    Singapore
    Posts
    9,968

    Re: Is there a Qt Way of hiding the QMainWindow?

    you can use the same code in your Qt application make sure it is inside Symbian Platform Macro.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Location
    Chennai, India
    Posts
    49

    Re: Is there a Qt Way of hiding the QMainWindow?

    Thanks. But what headers need to be added at the top of this file. Because, I am getting 'RWindowGroup' was not declared in this scope error.
    The following is my hide button's code

    Code:
    void MainWindow::on_hideButton_clicked()
    {
        #if defined(Q_OS_SYMBIAN)
        RWindowGroup* wg = &CCoeEnv::Static()->RootWin();
        wg->SetOrdinalPosition(-1);
        #endif
    }
    I have added the LIBS in the pro file as per the wiki

    Code:
    symbian {
         LIBS += -lws32\
                 -lcone
    }

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Is there a Qt Way of hiding the QMainWindow?

    <W32STD.H>

  5. #5
    Registered User
    Join Date
    Mar 2009
    Location
    Chennai, India
    Posts
    49

    Re: Is there a Qt Way of hiding the QMainWindow?

    Quote Originally Posted by danhicksbyron View Post
    <W32STD.H>
    Thanks for the reply. Now I get the following error.

    'CCoeEnv' has not been declared

  6. #6
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Is there a Qt Way of hiding the QMainWindow?

    <COEMAIN.H> & cone.lib

  7. #7
    Registered User
    Join Date
    Mar 2009
    Location
    Chennai, India
    Posts
    49

    Re: Is there a Qt Way of hiding the QMainWindow?

    Quote Originally Posted by danhicksbyron View Post
    <COEMAIN.H> & cone.lib
    Thanks you so much.. The MainWindow hides now.. The final code looks like this below.. others who want to achieve the same refer below..

    In the PRO file, you need the following libraries.

    Code:
    symbian {
         LIBS += -lws32\
                 -lcone
    }
    You need the following headers in your cpp file

    Code:
    #include <w32std.h>
    #include <coemain.h>

    This is the CLICK action of your hide button..

    Code:
    void Dashboard::on_hideButton_clicked()
    {
        #if defined(Q_OS_SYMBIAN)
        RWindowGroup* wg = &CCoeEnv::Static()->RootWin();
        wg->SetOrdinalPosition(-1);
        #endif
    }
    I have one more question regarding this. I want to hide the application icon from the list of open applications.. (Like they are doing in "Google Maps")



    The first one is my application

    How do I do that? Thanks

  8. #8
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: Is there a Qt Way of hiding the QMainWindow?

    CAknAppUi::HideApplicationFromFSW() is the right API for you.

  9. #9
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Is there a Qt Way of hiding the QMainWindow?

    If you're going to do much of this download the Symbian SDK and install the documentation piece (don't know if you can install that separately or you have to install the whole thing). The interface to the docs is a bit clumsey, but it contains all this information.

  10. #10
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Is there a Qt Way of hiding the QMainWindow?

    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

  11. #11
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Is there a Qt Way of hiding the QMainWindow?

    Interesting -- they've actually fixed that! Used to be the online docs were worthless because all the links were broken.

  12. #12
    Registered User
    Join Date
    Mar 2009
    Location
    Chennai, India
    Posts
    49

    Re: Is there a Qt Way of hiding the QMainWindow?

    Quote Originally Posted by savaj View Post
    CAknAppUi::HideApplicationFromFSW() is the right API for you.
    Can you please tell me how to use this? When I tried the following, I got the following error.
    Code:
    void Dashboard::on_hideButton_clicked()
    {
        #if defined(Q_OS_SYMBIAN)
        CAknAppUi::HideApplicationFromFSW();
        #endif
    }
    error: cannot call member function 'void CAknAppUi::HideApplicationFromFSW(TBool)' without object

  13. #13
    Registered User
    Join Date
    Mar 2009
    Location
    Chennai, India
    Posts
    49

    Re: Is there a Qt Way of hiding the QMainWindow?

    After some search, I found the correct way.

    Code:
        #if defined(Q_OS_SYMBIAN)
        CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
            TRAPD(error,
            if (appUi) {
                  appUi->HideInBackground();
            });
        #endif

    Thanks to this link - http://stackoverflow.com/questions/3...ion-lock-in-qt

Similar Threads

  1. Replies: 3
    Last Post: 2009-06-12, 10:55
  2. Is there a way to know the origin of a RHTTPTransaction?
    By princesse_sahara in forum Symbian
    Replies: 8
    Last Post: 2008-12-10, 15:49
  3. Is there a way to change the audio track of a video????
    By princesse_sahara in forum Symbian
    Replies: 1
    Last Post: 2008-09-19, 12:45
  4. Is there a way to retrieve the theme parameters of the device
    By orenspor in forum Mobile Java General
    Replies: 2
    Last Post: 2008-01-22, 11:56
  5. Replies: 1
    Last Post: 2003-10-08, 13:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×