Commit 5aa1d740 authored by Jan Möbius's avatar Jan Möbius

Dennis:

Hide Log window if not visible to prevent excessive redraws.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5203 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b524e0a6
......@@ -73,7 +73,8 @@ QtSlideWindow::QtSlideWindow(QString _name, QGraphicsItem *_parent) :
autohideButton_(0),
detachButton_(0),
hideAnimation_(0),
dialog_(0)
dialog_(0),
tempWidget_(new QWidget)
{
setCacheMode (QGraphicsItem::DeviceCoordinateCache);
setWindowFrameMargins (2, 15, 2, 2);
......@@ -106,6 +107,7 @@ QtSlideWindow::QtSlideWindow(QString _name, QGraphicsItem *_parent) :
hideAnimation_->setTranslationAt (1.0, 0, 0);
hide ();
connect (hideTimeLine_, SIGNAL(finished()), this, SLOT(timelineFinished()));
}
//-----------------------------------------------------------------------------
......@@ -117,17 +119,23 @@ void QtSlideWindow::attachWidget (QWidget *_m)
mainWidget_ = _m;
mainWidget_->setParent(0);
setWidget (mainWidget_);
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
show ();
if (autohideButton_->isChecked ())
{
tempWidget_->setGeometry (mainWidget_->geometry ());
setWidget (tempWidget_);
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
show ();
hideTimeLine_->setCurrentTime (0);
hideAnimation_->setStep (0.0);
}
else
{
setWidget (mainWidget_);
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
show ();
hideTimeLine_->setCurrentTime (SLIDE_DURATION);
hideAnimation_->setStep (1.0);
}
......@@ -214,6 +222,12 @@ void QtSlideWindow::hoverEnterEvent (QGraphicsSceneHoverEvent *)
if (hideTimeLine_->state () == QTimeLine::NotRunning)
hideTimeLine_->start ();
}
if (!mainWidget_->isVisible ())
{
setWidget (mainWidget_);
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
show ();
}
}
//-----------------------------------------------------------------------------
......@@ -377,5 +391,20 @@ void QtSlideWindow::restoreState (QSettings &_settings)
dialog_->restoreGeometry (_settings.value ("DialogGeometry").toByteArray ());
}
//-----------------------------------------------------------------------------
void QtSlideWindow::timelineFinished ()
{
if (hideTimeLine_->currentValue () == 0.0)
{
tempWidget_->setGeometry (mainWidget_->geometry ());
setWidget (tempWidget_);
setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowTitleHint);
mainWidget_->setParent (0);
mainWidget_->hide ();
show ();
}
}
//=============================================================================
//=============================================================================
......@@ -116,6 +116,10 @@ class DLLEXPORT QtSlideWindow : public QGraphicsProxyWidget
/// autohide button presed
void autohidePressed ();
/// Executed if the timeline reches the end of its animation
void timelineFinished ();
private:
// name
......@@ -134,6 +138,9 @@ class DLLEXPORT QtSlideWindow : public QGraphicsProxyWidget
// detached dialog
QDialog *dialog_;
// temporary widget
QWidget *tempWidget_;
};
//=============================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment