kdelibs/kdeui/tests/khboxtest.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
970 B
C++

#include "khboxtest.h"
#include <QtGui/QPushButton>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <kapplication.h>
KHBoxTest::KHBoxTest( QWidget* parentWidget )
: KHBox( parentWidget )
{
pbAdd = new QPushButton( "Add a button", this );
connect( pbAdd, SIGNAL(clicked()), this, SLOT(slotAdd()) );
pbRemove = 0;
}
void KHBoxTest::slotAdd()
{
if ( !pbRemove ) {
pbRemove = new QPushButton( "Remove me", this );
connect( pbRemove, SIGNAL(clicked()), this, SLOT(slotRemove()) );
pbAdd->setEnabled( false );
}
}
void KHBoxTest::slotRemove()
{
pbAdd->setEnabled( true );
pbRemove->deleteLater();
pbRemove = 0;
}
int main( int argc, char ** argv )
{
KAboutData about("KHBoxTest", 0, ki18n("KHBoxTest"), "version");
KCmdLineArgs::init(argc, argv, &about);
KApplication app;
KHBoxTest *toplevel = new KHBoxTest(0);
toplevel->show();
app.exec();
}
#include "moc_khboxtest.cpp"