kdelibs/kdeui/tests/kmainwindowrestoretest.cpp
Ivailo Monev 82fc15f54b generic: use CMake moc instead of automoc4 by default
for compatibilty reasons automoc4 support is not removed but it
shall be in the future. automoc4 has not been maintained for a
while (last commit is from 2011) and the stable release is from
2009.

CMake version >= 2.8.6 provides the functionality for mocking so
I see no reason to not make use of it.
2015-02-27 07:40:26 +00:00

43 lines
1.2 KiB
C++

#include "kmainwindowrestoretest.h"
#include <kapplication.h>
#include <kcmdlineargs.h>
#include <QtGui/QLabel>
#define MAKE_WINDOW( kind, title ) do { \
MainWin##kind * m = new MainWin##kind; \
m->setCaption( title ); \
m->setCentralWidget( new QLabel( title, m ) ); \
m->show(); \
} while ( false )
int main( int argc, char * argv[] ) {
KCmdLineArgs::init( argc, argv, "kmainwindowrestoretest", 0, ki18n("kmainwindowrestoretest"), "1.0", ki18n("kmainwindow test app"));
KApplication app;
if ( kapp->isSessionRestored() ) {
kRestoreMainWindows< MainWin1, MainWin2, MainWin3 >();
kRestoreMainWindows< MainWin4, MainWin5 >();
RESTORE(MainWin6);
//kRestoreMainWindows< MainWin6 >(); // should be equivalent to RESTORE()
} else {
MAKE_WINDOW( 1, "First 1" );
MAKE_WINDOW( 1, "Second 1" );
MAKE_WINDOW( 2, "Only 2" );
MAKE_WINDOW( 3, "First 3" );
MAKE_WINDOW( 4, "First 4" );
MAKE_WINDOW( 4, "Second 4" );
MAKE_WINDOW( 3, "Second 3" );
MAKE_WINDOW( 4, "Third 4" );
MAKE_WINDOW( 5, "First 5" );
MAKE_WINDOW( 5, "Second 5" );
MAKE_WINDOW( 1, "Only 6" );
}
return app.exec();
}
#include "moc_kmainwindowrestoretest.cpp"