r14742 by jghali - #8821 : style editor/manger creeps offscreen Replace ScrPaletteBase::show() implementation by a showEvent() implementation. QWidget::show() is an inline method and consequently won't allow our implementation to be called when show() is called by Qt internally
scribus-commit
scribus-commit at lists.scribus.net
Tue Feb 16 23:00:19 CET 2010
Revision: 14742
Author: jghali
Date: 2010-02-16T21:57:05.679987Z
Commit message: #8821 : style editor/manger creeps offscreen
Replace ScrPaletteBase::show() implementation by a showEvent() implementation. QWidget::show() is an inline method and consequently won't allow our implementation to be called when show() is called by Qt internally
Changeset:
M /branches/Version135/Scribus/scribus/scrpalettebase.cpp
M /branches/Version135/Scribus/scribus/scrpalettebase.h
Diffs:
Index: scribus/scrpalettebase.cpp
===================================================================
--- scribus/scrpalettebase.cpp (revision 14741)
+++ scribus/scrpalettebase.cpp (revision 14742)
@@ -163,9 +163,12 @@
storeSize();
}
-void ScrPaletteBase::show()
+void ScrPaletteBase::showEvent(QShowEvent *showEvent)
{
- if (palettePrefs)
+ // According to Qt doc, non-spontaneous show events are sent to widgets
+ // immediately before they are shown. We want to restore geometry for those
+ // events as spontaneous events are delivered after dialog has been shown
+ if (palettePrefs && !showEvent->spontaneous())
{
QDesktopWidget *d = QApplication::desktop();
QSize gStrut = QApplication::globalStrut();
@@ -209,7 +212,7 @@
}
storeVisibility(true);
}
- QDialog::show();
+ QDialog::showEvent(showEvent);
}
void ScrPaletteBase::hide()
Index: scribus/scrpalettebase.h
===================================================================
--- scribus/scrpalettebase.h (revision 14741)
+++ scribus/scrpalettebase.h (revision 14742)
@@ -30,6 +30,7 @@
#include <QDialog>
#include <QHideEvent>
#include <QKeySequence>
+#include <QShowEvent>
#include "scribusapi.h"
class PrefsContext;
@@ -43,11 +44,6 @@
~ScrPaletteBase() {};
/** @brief Sample way to grab keystrokes, simply calls superclass at this point */
//virtual void keyPressEvent(QKeyEvent *keyEvent);
- /** @brief Captures the close event and changes it to hide */
- virtual void closeEvent(QCloseEvent *closeEvent);
- /** @brief Stores the geometry of the window when hiding. */
- void hideEvent(QHideEvent*);
- virtual void show();
virtual void hide();
void startup();
@@ -67,6 +63,13 @@
void storePosition(int newX, int newY);
void storeSize();
void storeVisibility(bool);
+
+ /** @brief Restore the geometry of the window when showing it. */
+ virtual void showEvent(QShowEvent *showEvent);
+ /** @brief Captures the close event and changes it to hide */
+ virtual void closeEvent(QCloseEvent *closeEvent);
+ /** @brief Stores the geometry of the window when hiding. */
+ virtual void hideEvent(QHideEvent*);
PrefsContext* palettePrefs;
QString prefsContextName;
More information about the scribus-commit
mailing list