properly adjust status bar position when the main window resizes

This commit is contained in:
Tvangeste 2011-07-09 19:05:14 +02:00
parent 354066c292
commit 74e7a41548
2 changed files with 17 additions and 0 deletions

View file

@ -24,6 +24,7 @@ MainStatusBar::MainStatusBar(QWidget *parent) : QWidget(parent)
picWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
timer = new QTimer(this);
timer->setSingleShot(true);
// layout
QHBoxLayout * layout = new QHBoxLayout;
@ -35,6 +36,8 @@ MainStatusBar::MainStatusBar(QWidget *parent) : QWidget(parent)
layout->addWidget(textWidget);
setLayout(layout);
parentWidget()->installEventFilter( this );
connect( timer, SIGNAL( timeout() ), SLOT( clearMessage() ) );
}
@ -94,3 +97,16 @@ void MainStatusBar::mousePressEvent ( QMouseEvent * )
{
clearMessage();
}
bool MainStatusBar::eventFilter(QObject *, QEvent * e)
{
switch ( e->type() ) {
case QEvent::Resize:
refresh();
break;
default:
break;
};
return false;
}

View file

@ -34,6 +34,7 @@ private:
QLabel * textWidget;
QTimer * timer;
bool eventFilter(QObject *obj, QEvent * event);
void refresh();
};