×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    16

    Adding an icon in status pane using QT4.6.3

    Hi,

    Can anyone let me know how we can add an icon in the status pane. I am using Qt 4.6.3 with symbian^3.
    Also, I would like to know how to implement our own "Back " softkey. I followed this link
    http://wiki.forum.nokia.com/index.ph...Qt_for_Symbian

    I was able to create Back softkey. In the back() slot function I tried close()/ hide() but nothing happened when I clicked the Back button.

    Thanks.

  2. #2
    Registered User
    Join Date
    Feb 2010
    Posts
    45

    Re: Adding an icon in status pane using QT4.6.3

    Hi,

    you can add an icon to the status pane with this command: setWindowIcon(const QIcon& icon);

    the back softkey's code like this:

    QAction back = new QAction(tr("&Back"), this);
    back->setSoftKeyRole(QAction::NegativeSoftKey);
    connect(back,SIGNAL(triggered()),this,SLOT(backPressed()));

    void MainWindow::backPressed()
    {
    //everything you do here will run, if you press the back softkey
    }

    p.s. : in the Qt simulator, the softkeys aren't working...

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    16

    Re: Adding an icon in status pane using QT4.6.3

    chriske86, thanks for the reply.
    Doesn't the setWindowIcon(const QIcon& icon) ----- sets the window icon that shows along with the title.

    I was thinking the status pane is below the title. I am not exactly sure. I want an icon that shows along with the battery icon and signal icon.

    I was able to create the softkey. Creating wasn't a problem. Instead of the back_pressed() method you used I tried close()/showFullScreen as a testcase. It doen't work.
    Also here what exactly the "this" pointer refers to? Can you please explain a little bit about it.

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

    Re: Adding an icon in status pane using QT4.6.3

    Quote Originally Posted by Shredda View Post
    Also here what exactly the "this" pointer refers to? Can you please explain a little bit about it.
    You need to study up a bit on basic C++ programming.

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    16

    Re: Adding an icon in status pane using QT4.6.3

    I understand that in C++ "this" pointer corresponds to the object that invokes/calls.
    In case of Qt, when a widget is created without any parent each can become an independent
    window. But if you create a new widget with "this" as parent to which widget it becomes the child.
    I was thinking it becomes the child of mainWindow. I asked to know if I was mistaken.
    If that wasn't appropriate to ask that in this forum I am sorry for that.
    Last edited by Shredda; 2010-07-16 at 05:02.

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Adding an icon in status pane using QT4.6.3

    Quote Originally Posted by Shredda View Post
    I understand that in C++ "this" pointer corresponds to the object that invokes/calls.
    In case of Qt, when a widget is created without any parent each can become an independent
    window. But if you create a new widget with "this" as parent to which widget it becomes the child.
    I was thinking it becomes the child of mainWindow. I asked to know if I was mistaken.
    If that wasn't appropriate to ask that in this forum I am sorry for that.
    QAction should be a child of toplevel widget whatever widget it is.

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

    Re: Adding an icon in status pane using QT4.6.3

    Yes, if you create a new widget and specify "this" as the parent, the new widget becomes a "child" of that parent. Which parent of course depends on which object you're in when you say "this" -- it could be the main window, could be some child of the main window, or just about anything else.

    A number of operations on the parent carry over to the child. show() and hide(), for example, are propagated to the child if performed on the parent (though there are some nuances here). And, of course, parentage (as with all QObjects) controls widget lifetime as well -- when the parent is destroyed the children are destroyed.

    You need to consider carefully the parent-child relationship of your widgets.

Similar Threads

  1. Icon in status pane
    By er.nisha in forum Symbian
    Replies: 3
    Last Post: 2009-08-20, 13:16
  2. status pane icon
    By deepakk in forum Symbian
    Replies: 9
    Last Post: 2008-05-28, 14:33
  3. Displaying icon in Status Pane
    By vniles in forum Symbian
    Replies: 2
    Last Post: 2006-12-29, 11:15
  4. status pane icon
    By _coto_ in forum Personal Profile
    Replies: 0
    Last Post: 2006-03-17, 11:57
  5. Adding a small indicator to the status pane for my app
    By palatoss in forum Symbian User Interface
    Replies: 2
    Last Post: 2005-08-10, 12:18

Posting Permissions

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