Results 1 to 2 of 2

Thread: Updating Status Bar Icon

  1. #1
    Join Date
    Mar 2007
    Posts
    59
    Thanks
    7

    Default Updating Status Bar Icon

    In the setup function of my application I have:
    Qt Code:
    1. //Connection Status Icon
    2. QLabel *test = new QLabel;
    3. test->setPixmap(QPixmap(":/images/not_connected_32x32.png"));
    4. test->setScaledContents(false);
    5. //test->setFrameShadow(QFrame::Plain);
    6. //test->setFrameShape(QFrame::NoFrame);
    7. test->setAlignment(Qt::AlignRight);
    8. ui.statusBar->insertPermanentWidget(0, test,0 );
    To copy to clipboard, switch view to plain text mode 

    This puts the correct Icon in the Status bar fine

    My problem is updating it later, by function...

    Here is what I have, but it is not working

    Qt Code:
    1. void TestApp::updateStatusBarIcon(QString &statusIcon)
    2. {
    3. qDebug() << "Icon change" << statusIcon;
    4. test1->setPixmap(QPixmap(statusIcon));
    5. }
    To copy to clipboard, switch view to plain text mode 

    Any ideas how i can update the PIXMAP Icon on the statusBar?

    TIA.

  2. #2
    Join Date
    Mar 2007
    Posts
    59
    Thanks
    7

    Default Re: Updating Status Bar Icon

    This seemed harder than it was. they key was to use QLabel in designer to create the LAbel with a Pixmap, then install it on the Status bar manually.

    Once its there I could easily update it..

    Example:

    Install the icon on the status bar.
    Qt Code:
    1. ui.statusBar->insertPermanentWidget(0, ui.statusIconLabel,0 );
    To copy to clipboard, switch view to plain text mode 

    Then Update it from the Connection Status function by:
    Qt Code:
    1. ui.statusIconLabel->setPixmap(QPixmap(":/images/connected_32x32.png"));
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QMessageBox missing icon
    By zanth in forum Qt Programming
    Replies: 3
    Last Post: 8th July 2010, 21:20
  2. Couple of questions: main window icon + toolbar icon
    By bpackard in forum Qt Programming
    Replies: 0
    Last Post: 20th March 2008, 19:03
  3. Mac application and the Dock Icon
    By sekelsenmat in forum Qt Programming
    Replies: 3
    Last Post: 26th September 2007, 10:23

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.