From 38c0e26674592241b5eeceb3399354b2ceeac628 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Fri, 23 Mar 2007 15:02:22 +0000 Subject: [PATCH] keep the right position when we resize svn path=/trunk/playground/graphics/okular/; revision=645759 --- ui/presentationsearchbar.cpp | 10 +++++++--- ui/presentationsearchbar.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/presentationsearchbar.cpp b/ui/presentationsearchbar.cpp index 615fcc89c..74656971d 100644 --- a/ui/presentationsearchbar.cpp +++ b/ui/presentationsearchbar.cpp @@ -76,9 +76,6 @@ PresentationSearchBar::PresentationSearchBar( Okular::Document *document, QWidge m_anchor->installEventFilter( this ); connect( closeBtn, SIGNAL( clicked() ), this, SLOT( close() ) ); - - // force the initial snap - forceSnap(); } PresentationSearchBar::~PresentationSearchBar() @@ -92,6 +89,13 @@ void PresentationSearchBar::forceSnap() move( m_point.x() - width() / 2, m_point.y() - height() ); } +void PresentationSearchBar::resizeEvent( QResizeEvent * ) +{ + // if in snap mode, then force the snap and place ourselves correctly again + if ( m_snapped ) + forceSnap(); +} + bool PresentationSearchBar::eventFilter( QObject *obj, QEvent *e ) { if ( obj == m_handle && diff --git a/ui/presentationsearchbar.h b/ui/presentationsearchbar.h index 2aca56b7c..b4e66b375 100644 --- a/ui/presentationsearchbar.h +++ b/ui/presentationsearchbar.h @@ -30,6 +30,7 @@ class PresentationSearchBar void forceSnap(); protected: + void resizeEvent( QResizeEvent * ); bool eventFilter( QObject *, QEvent * ); private: