Changeset 95 in tspsg-svn for trunk/src/mainwindow.cpp
- Timestamp:
- Feb 27, 2010, 2:13:50 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/mainwindow.cpp
r94 r95 71 71 72 72 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 73 // Centering main window 74 QRect rect = geometry(); 75 rect.moveCenter(QApplication::desktop()->availableGeometry(this).center()); 76 setGeometry(rect); 73 77 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 74 78 // Loading of saved window state … … 77 81 restoreState(settings->value("State").toByteArray()); 78 82 settings->endGroup(); 79 } else {80 // Centering main window81 QRect rect = geometry();82 rect.moveCenter(QApplication::desktop()->availableGeometry(this).center());83 setGeometry(rect);84 83 } 85 84 #else … … 500 499 501 500 #ifdef Q_OS_WINCE 501 void MainWindow::changeEvent(QEvent *ev) 502 { 503 if ((ev->type() == QEvent::ActivationChange) && isActiveWindow()) 504 desktopResized(0); 505 506 QWidget::changeEvent(ev); 507 } 508 502 509 void MainWindow::desktopResized(int screen) 503 510 { 504 if ( screen != 0)511 if ((screen != 0) || !isActiveWindow()) 505 512 return; 506 513 507 514 QRect availableGeometry = QApplication::desktop()->availableGeometry(0); 508 515 if (currentGeometry != availableGeometry) { 516 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); 509 517 /*! 510 518 * \hack HACK: This hack checks whether \link QDesktopWidget::availableGeometry() availableGeometry()\endlink's \c top + \c hegiht = \link QDesktopWidget::screenGeometry() screenGeometry()\endlink's \c height. … … 519 527 setGeometry(availableGeometry); 520 528 } 521 } 522 currentGeometry = availableGeometry; 529 currentGeometry = availableGeometry; 530 QApplication::restoreOverrideCursor(); 531 } 523 532 } 524 533 #endif // Q_OS_WINCE … … 557 566 return; 558 567 } 559 settings->setValue("NumCities", spinCities->value()); 560 561 // Saving Main Window state 562 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 563 settings->beginGroup("MainWindow"); 568 if (!settings->value("SettingsReset", false).toBool()) { 569 settings->setValue("NumCities", spinCities->value()); 570 571 // Saving Main Window state 572 if (settings->value("SavePos", DEF_SAVEPOS).toBool()) { 573 settings->beginGroup("MainWindow"); 564 574 #if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN) 565 settings->setValue("Geometry", saveGeometry());575 settings->setValue("Geometry", saveGeometry()); 566 576 #endif // Q_OS_WINCE 567 settings->setValue("State", saveState()); 568 settings->endGroup(); 577 settings->setValue("State", saveState()); 578 settings->endGroup(); 579 } 580 } else { 581 settings->remove("SettingsReset"); 569 582 } 570 583
Note: See TracChangeset
for help on using the changeset viewer.