AlphaWolfXV
28th January 2010, 11:14
Hello all,
I have a simple application where I am trying to use a QMainWindow with a QStatusBar. There are QLabels set and they update perfectly. Now I added a status->showMessage("test", 5000); which should display the message "test" for 5 seconds over the whole status bar, i.e. hiding currently set text in the QLabels. For some reason my machine shows the message for 5 seconds but I can see the QLabel information at the same time.
Firstly has anyone experienced this before? and Second, is there a way to force a White background of the showMessage() instead of invisible? After reading the docs some more, it is acting line I have used the addPermanentWidget() instead of addWidget(), where the temporary message will not hide the existing data on the status bar.
Here is a sample code program that compiles and shows the issue, I will also try to compile on another machine to see if it is machine based. When the program is compiled and run, I see the status bar leftmost position says "position 0 status" and on top of that I can kind of read the showMessage() of "test" for the 10 seconds, then it disappears and looks normal. Any thoughts?
testStatusBar.pro:
HEADERS += mytest.h
SOURCES += mytest.cpp \
main.cpp
main.cpp
#include <QtGui/QApplication>
#include "mytest.h"
int main(int argc, char * argv[])
{
QApplication a(argc, argv);
mytest w;
w.show();
return a.exec();
}
mytest.cpp
#include "mytest.h"
mytest::mytest(QWidget *parent)
:QMainWindow(parent)
{
le1 = new QLineEdit(this);
le1->setText("Just a temp line edit for now...");
//set up status bar
stat0 = new QLabel("position 0 status");
stat1 = new QLabel(" (1) ");
stat2 = new QLabel(" (2) ");
status = new QStatusBar(this);
status->addWidget(stat0,1);
status->addWidget(stat1,0);
status->addWidget(stat2,0);
setCentralWidget(le1);
setStatusBar(status);
setMinimumSize(600,480);
status->showMessage("test",10000);
}
mytest.h
#ifndef MYTEST_H
#define MYTEST_H
#include <QMainWindow>
#include <QtGui>
#include <QDebug>
class mytest : public QMainWindow
{
Q_OBJECT
public:
mytest(QWidget *parent = 0);
private:
QLabel *stat0, *stat1, *stat2;
QLineEdit *le1;
QStatusBar *status;
};
#endif // MYTEST_H
Thanks,
AlphaWolfXV
PS: Using QTCreator 1.2.1 (QT 4.5.2) / Windows Vista
- Just tried on QTCreator 1.3.0 (QT 4.6.0) / Windows Vista
I have a simple application where I am trying to use a QMainWindow with a QStatusBar. There are QLabels set and they update perfectly. Now I added a status->showMessage("test", 5000); which should display the message "test" for 5 seconds over the whole status bar, i.e. hiding currently set text in the QLabels. For some reason my machine shows the message for 5 seconds but I can see the QLabel information at the same time.
Firstly has anyone experienced this before? and Second, is there a way to force a White background of the showMessage() instead of invisible? After reading the docs some more, it is acting line I have used the addPermanentWidget() instead of addWidget(), where the temporary message will not hide the existing data on the status bar.
Here is a sample code program that compiles and shows the issue, I will also try to compile on another machine to see if it is machine based. When the program is compiled and run, I see the status bar leftmost position says "position 0 status" and on top of that I can kind of read the showMessage() of "test" for the 10 seconds, then it disappears and looks normal. Any thoughts?
testStatusBar.pro:
HEADERS += mytest.h
SOURCES += mytest.cpp \
main.cpp
main.cpp
#include <QtGui/QApplication>
#include "mytest.h"
int main(int argc, char * argv[])
{
QApplication a(argc, argv);
mytest w;
w.show();
return a.exec();
}
mytest.cpp
#include "mytest.h"
mytest::mytest(QWidget *parent)
:QMainWindow(parent)
{
le1 = new QLineEdit(this);
le1->setText("Just a temp line edit for now...");
//set up status bar
stat0 = new QLabel("position 0 status");
stat1 = new QLabel(" (1) ");
stat2 = new QLabel(" (2) ");
status = new QStatusBar(this);
status->addWidget(stat0,1);
status->addWidget(stat1,0);
status->addWidget(stat2,0);
setCentralWidget(le1);
setStatusBar(status);
setMinimumSize(600,480);
status->showMessage("test",10000);
}
mytest.h
#ifndef MYTEST_H
#define MYTEST_H
#include <QMainWindow>
#include <QtGui>
#include <QDebug>
class mytest : public QMainWindow
{
Q_OBJECT
public:
mytest(QWidget *parent = 0);
private:
QLabel *stat0, *stat1, *stat2;
QLineEdit *le1;
QStatusBar *status;
};
#endif // MYTEST_H
Thanks,
AlphaWolfXV
PS: Using QTCreator 1.2.1 (QT 4.5.2) / Windows Vista
- Just tried on QTCreator 1.3.0 (QT 4.6.0) / Windows Vista