diff --git a/part.cpp b/part.cpp index 3f3333dfe..85d3a5f0e 100644 --- a/part.cpp +++ b/part.cpp @@ -130,6 +130,7 @@ Part::Part(QWidget *parentWidget, m_leftPanel->setMaximumWidth( 300 ); QVBoxLayout * leftPanelLayout = new QVBoxLayout( m_leftPanel ); leftPanelLayout->setMargin( 0 ); + m_splitter->setCollapsible( 0, true ); // widgets: [left toolbox/..] | [] m_toolBox = new QToolBox( m_leftPanel ); @@ -315,9 +316,8 @@ Part::Part(QWidget *parentWidget, splitterSizes.push_back( 500 ); } m_splitter->setSizes( splitterSizes ); - // get notified about splitter size changes (HACK that will be removed - // by connecting to Qt4::QSplitter's sliderMoved()) - m_pageView->installEventFilter( this ); + // get notified about splitter size changes + connect( m_splitter, SIGNAL( splitterMoved( int, int ) ), this, SLOT( splitterMoved( int, int ) ) ); // document watcher and reloader m_watcher = new KDirWatch( this ); @@ -684,14 +684,11 @@ void Part::cannotQuit() KMessageBox::information(widget(), i18n("This link points to a quit application action that does not work when using the embedded viewer."), QString::null, "warnNoQuitIfNotInOkular::"); } -bool Part::eventFilter( QObject * watched, QEvent * e ) +void Part::splitterMoved( int /*pos*/, int index ) { // if pageView has been resized, save splitter sizes - if ( watched == m_pageView && e->type() == QEvent::Resize ) + if ( index == 1 ) saveSplitterSize(); - - // only intercept events, don't block them - return false; } void Part::slotShowLeftPanel() diff --git a/part.h b/part.h index 514d1c1f0..3b2cca1e4 100644 --- a/part.h +++ b/part.h @@ -104,8 +104,6 @@ protected: bool openFile(); bool openUrl(const KUrl &url); bool closeUrl(); - // filter that watches for splitter size changes - bool eventFilter( QObject * watched, QEvent * e ); void supportedMimetypes(); protected slots: @@ -130,6 +128,7 @@ protected slots: bool slotImportPSFile(); void close(); void cannotQuit(); + void splitterMoved( int pos, int index ); void setMimeTypes(KIO::Job *job); void saveSplitterSize(); // can be connected to widget elements