mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 15:24:05 +00:00
Workarounds for X11 idiosyncrasies.
This commit is contained in:
parent
0726b90f30
commit
a37c4ba67c
|
@ -59,9 +59,15 @@ void MainStatusBar::showMessage(const QString & str, int timeout)
|
|||
refresh();
|
||||
}
|
||||
|
||||
void MainStatusBar::refresh()
|
||||
void MainStatusBar::refresh(bool forceHide)
|
||||
{
|
||||
|
||||
if ( forceHide )
|
||||
{
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !message.isEmpty() )
|
||||
{
|
||||
QRect pGeom = parentWidget()->geometry();
|
||||
|
@ -72,6 +78,19 @@ void MainStatusBar::refresh()
|
|||
adjustSize();
|
||||
|
||||
move(pGeom.left(), pGeom.bottom() - size().height() + 1 );
|
||||
|
||||
if ( parentWidget()->isHidden() )
|
||||
{
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( parentWidget()->isMinimized() )
|
||||
{
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
show();
|
||||
}
|
||||
else
|
||||
|
@ -86,15 +105,23 @@ void MainStatusBar::mousePressEvent ( QMouseEvent * )
|
|||
clearMessage();
|
||||
}
|
||||
|
||||
bool MainStatusBar::eventFilter(QObject *, QEvent * event)
|
||||
bool MainStatusBar::eventFilter(QObject *, QEvent * e)
|
||||
{
|
||||
switch ( event->type() ) {
|
||||
case QEvent::Move:
|
||||
switch ( e->type() ) {
|
||||
case QEvent::Hide:
|
||||
case QEvent::Resize:
|
||||
case QEvent::FocusOut:
|
||||
case QEvent::WindowDeactivate:
|
||||
case QEvent::Hide:
|
||||
#ifdef Q_WS_X11
|
||||
// workaround for X11 idiosyncrasies
|
||||
// qDebug() << e->type();
|
||||
refresh(true);
|
||||
break;
|
||||
#endif
|
||||
case QEvent::Move:
|
||||
case QEvent::WindowStateChange:
|
||||
case QEvent::WindowActivate:
|
||||
// qDebug() << e->type();
|
||||
refresh();
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -31,7 +31,7 @@ private:
|
|||
QTimer * timer;
|
||||
QString message;
|
||||
bool eventFilter(QObject *obj, QEvent * event);
|
||||
void refresh();
|
||||
void refresh(bool forceHide = false);
|
||||
};
|
||||
|
||||
#endif // MAINSTATUSBAR_HH
|
||||
|
|
Loading…
Reference in a new issue