[Kde-imaging] kdeextragear-libs-1/kipi-plugins/acquireimages
Luboš Luňák
l.lunak at kde.org
Mon Oct 4 17:46:36 CEST 2004
CVS commit by lunakl:
Fix crash with Gwenview, which apparently doesn't have kapp->mainWidget()
set for some reason. Just hiding and showing only the main window is
not technically right anyway in case the app has more toplevel windows.
CCMAIL: kde-imaging at kde.org
CCMAIL: gwenview-general at lists.sourceforge.net
M +21 -3 screenshotdialog.cpp 1.15
M +2 -0 screenshotdialog.h 1.6
--- kdeextragear-libs-1/kipi-plugins/acquireimages/screenshotdialog.cpp #1.14:1.15
@@ -42,4 +42,5 @@ extern "C"
#include <qpushbutton.h>
#include <qframe.h>
+#include <qwidgetlist.h>
// Include files for KDE
@@ -239,7 +240,21 @@ void ScreenGrabDialog::slotGrab()
// Hiding the Host windows
-
+ m_hiddenWindows.clear();
if (m_hideCB->isChecked())
- kapp->mainWidget()->hide();
+ {
+ QWidgetList *list = QApplication::topLevelWidgets();
+ QWidgetListIt it( *list );
+ QWidget * w;
+ while ( (w=it.current()) != 0 )
+ {
+ ++it;
+ if ( w->isVisible())
+ {
+ m_hiddenWindows.append( w );
+ w->hide();
+ }
+ }
+ delete list;
+ }
kapp->processEvents();
@@ -315,5 +330,8 @@ void ScreenGrabDialog::endGrab(void)
if (m_hideCB->isChecked())
{
- kapp->mainWidget()->show();
+ for( QValueList< QWidget* >::ConstIterator it = m_hiddenWindows.begin();
+ it != m_hiddenWindows.end();
+ ++it )
+ (*it)->show();
QApplication::syncX();
}
--- kdeextragear-libs-1/kipi-plugins/acquireimages/screenshotdialog.h #1.5:1.6
@@ -104,4 +104,6 @@ protected:
QPushButton *m_helpButton;
+ QValueList< QWidget* > m_hiddenWindows;
+
bool eventFilter( QObject* o, QEvent* e);
void endGrab(void);
More information about the Kde-imaging
mailing list