//! [0] int main( int argc, char *argv[] ) { QApplication application( argc, argv ); TestWidget w; w.showFullScreen(); return application.exec(); }
TestWidget *TestWidget::newTestWidget(TabContainer *tc, QString title) { TestWidget *tw = new TestWidget(0, title); tw->setupWidgets(); tw->init(tc); return tw; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); TestWidget w; w.show(); return a.exec(); }
void tst_QWidget_window::tst_paintEventOnSecondShow() { TestWidget w; w.show(); w.hide(); w.reset(); w.show(); QTest::qWaitForWindowShown(&w); QApplication::processEvents(); QTRY_VERIFY(w.paintEventReceived); }
int main(int argc, char *argv[]) { KAboutData about("simple", "simple", ki18n("simple"), "0.0.1"); KCmdLineArgs::init(argc, argv, &about); KApplication app; TestWidget mainWidget; mainWidget.show(); return app.exec(); }
void tst_orientationchange::resizeEventOnOrientationChange() { // This will test that when orientation 'changes', then // at most one resize event is generated. TestWidget *normalWidget = new TestWidget(); TestWidget *fullScreenWidget = new TestWidget(); TestWidget *maximizedWidget = new TestWidget(); fullScreenWidget->showFullScreen(); maximizedWidget->showMaximized(); normalWidget->show(); QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents(); QCOMPARE(fullScreenWidget->resizeEventCount, 1); QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); QCOMPARE(maximizedWidget->resizeEventCount, 1); QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); QCOMPARE(normalWidget->resizeEventCount, 1); QCOMPARE(normalWidget->size(), normalWidget->resizeEventSize); fullScreenWidget->reset(); maximizedWidget->reset(); normalWidget->reset(); // Assumes that Qt application is AVKON application. CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi()); // Determine 'opposite' orientation to the current orientation. CAknAppUi::TAppUiOrientation orientation = CAknAppUi::EAppUiOrientationLandscape; if (fullScreenWidget->size().width() > fullScreenWidget->size().height()) { orientation = CAknAppUi::EAppUiOrientationPortrait; } TRAPD(err, appUi->SetOrientationL(orientation)); QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents(); // setOrientationL is not guaranteed to change orientation // (if emulator configured to support just portrait or landscape, then // setOrientationL call shouldn't do anything). // So let's ensure that we do not get resize event twice. QVERIFY(fullScreenWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); } QVERIFY(maximizedWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); } QCOMPARE(normalWidget->resizeEventCount, 0); QDesktopWidget desktop; QRect qtAvail = desktop.availableGeometry(normalWidget); TRect clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect(); QRect symbianAvail = qt_TRect2QRect(clientRect); QCOMPARE(qtAvail, symbianAvail); // Switch orientation back to original orientation = orientation == CAknAppUi::EAppUiOrientationPortrait ? CAknAppUi::EAppUiOrientationLandscape : CAknAppUi::EAppUiOrientationPortrait; fullScreenWidget->reset(); maximizedWidget->reset(); normalWidget->reset(); TRAP(err, appUi->SetOrientationL(orientation)); QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents(); // setOrientationL is not guaranteed to change orientation // (if emulator configured to support just portrait or landscape, then // setOrientationL call shouldn't do anything). // So let's ensure that we do not get resize event twice. QVERIFY(fullScreenWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); } QVERIFY(maximizedWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); } QCOMPARE(normalWidget->resizeEventCount, 0); qtAvail = desktop.availableGeometry(normalWidget); clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect(); symbianAvail = qt_TRect2QRect(clientRect); QCOMPARE(qtAvail, symbianAvail); TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified)); delete normalWidget; delete fullScreenWidget; delete maximizedWidget; }