Results 1 to 6 of 6

Thread: Status Bar Empty

  1. #1
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Status Bar Empty

    When the oper value changes, I call MainWindow updateStats(oper) to display the new value. Problem is, nothing displays. I can see the status bar window, but nothing in it. The debug statement in updateStatus shows a good value for oper.

    Qt Code:
    1. void MainWindow::updateStats(QString oper)
    2. {
    3. qDebug() << "IN updateStats with oper = " << oper;
    4. QString output = tr("Current op is %1") .arg(oper);
    5. mStatLabel->setText(output);
    6. }
    To copy to clipboard, switch view to plain text mode 

    What could be wrong here?

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

    Default Re: Status Bar Empty

    We cannot even see the status bar in your code. It's probably safe to assume that the label you use has been assigned to the status bar and given appropriate size. But then all would work, so there is a good chance this assumption is wrong.
    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.


  3. #3
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Status Bar Empty

    Sorry Wysota - I forget to include things in posts sometimes.
    The status bar definition is like this:

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent)
    2. : QMainWindow(parent), ui(new Ui::MainWindow)
    3. {
    4. ui->setupUi(this);
    5. setupActions();
    6.  
    7. mStatLabel = new QLabel;
    8. statusBar()->addPermanentWidget(mStatLabel);
    To copy to clipboard, switch view to plain text mode 

    I can't see what is wrong.

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

    Default Re: Status Bar Empty

    Can you see the label at all in your status bar?
    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.


  5. #5
    Join Date
    May 2009
    Location
    USA
    Posts
    300
    Thanks
    82
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Status Bar Empty

    Yes, I could definitely see the label. After some more testing, it appears that the status bar does display correctly when updateStats is called from within the main window, but not when it is called from another class. I can see with qDebug that it does get called with the correct parameter value from the other class, but the display does not change. Something to do with the way the main window event loop works?
    I'm thinking it's time to change direction and try to make this work with a signal/slot.
    Thanks for your patience.

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

    Default Re: Status Bar Empty

    Main window doesn't have its own event loop. If the function is called, regardless of the caller, it should have the same effect. Maybe something else calls the method again and reverts the changes you made.

    Try isolating the problem by trying to strip your code from everything unrelated until you reach a minimal compilable application reproducing the problem.
    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. How to put empty value in QDateEdit?
    By sawerset in forum Qt Programming
    Replies: 5
    Last Post: 14th October 2019, 21:06
  2. "Normal" Status Bar Message doesn't look right...
    By codeslicer in forum Qt Programming
    Replies: 4
    Last Post: 19th January 2009, 23:50
  3. QSqlTableModel inserts empty rows
    By Nesbitt in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 12:47
  4. Status Bar in a SUB WINDOW.
    By Cutey in forum Qt Programming
    Replies: 3
    Last Post: 23rd July 2008, 07:42
  5. remove directory empty or not empty
    By raphaelf in forum Newbie
    Replies: 12
    Last Post: 27th October 2006, 07:30

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.