[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars/tools
From: Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date: 2011-02-25 12:26:43
Message-ID: 20110225122643.C2F17AC8C0 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1222700 by khudyakov:
Use QPointer to show dialog window.
And avoid unnessesary ifs altogether
M +2 -8 skycalendar.cpp
--- trunk/KDE/kdeedu/kstars/kstars/tools/skycalendar.cpp #1222699:1222700
@@ -225,7 +225,6 @@
QPrinter printer; // Our printer object
QString str_legend; // Text legend
QString str_year; // Calendar's year
- bool ok( false ); // True if the user click "Print" button in print dialog
int text_height = 200; // Height of legend text zone in points
QSize calendar_size; // Initial calendar widget size
QFont calendar_font; // Initial calendar font
@@ -235,15 +234,9 @@
printer.setResolution( 300 );
// Open print dialog
- QPrintDialog *dialog = KdePrint::createPrintDialog( &printer, this );
+ QPointer<QPrintDialog> dialog( KdePrint::createPrintDialog( &printer, this ) );
dialog->setWindowTitle( i18n( "Print sky calendar" ) );
if ( dialog->exec() == QDialog::Accepted ) {
- ok = true;
- }
- delete dialog;
-
- // If the user click on "Print" button
- if ( ok ) {
// Change mouse cursor
QApplication::setOverrideCursor( Qt::WaitCursor );
@@ -293,6 +286,7 @@
// Restore mouse cursor
QApplication::restoreOverrideCursor();
}
+ delete dialog;
}
void SkyCalendar::slotLocation() {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic