2007-08-06 01:05:57 +02:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QGraphicsScene>
|
|
|
|
#include <QGraphicsView>
|
|
|
|
|
|
|
|
#include <KUniqueApplication>
|
|
|
|
#include <KCmdLineArgs>
|
|
|
|
#include <KCmdLineOptions>
|
|
|
|
#include <KAboutData>
|
|
|
|
#include <KIcon>
|
|
|
|
|
2008-02-29 18:50:57 +01:00
|
|
|
#include "plasma/layouts/boxlayout.h"
|
2007-11-20 00:45:56 +01:00
|
|
|
#include "plasma/widgets/pushbutton.h"
|
|
|
|
#include "plasma/widgets/lineedit.h"
|
|
|
|
#include "plasma/widgets/widget.h"
|
|
|
|
#include "plasma/widgets/label.h"
|
2007-08-06 01:05:57 +02:00
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
KAboutData aboutData( QByteArray("test"), 0, ki18n("test"),
|
|
|
|
KDE_VERSION_STRING, ki18n("test"), KAboutData::License_BSD,
|
|
|
|
ki18n("test") );
|
|
|
|
KCmdLineArgs::init(argc, argv, &aboutData);
|
|
|
|
KApplication app;
|
|
|
|
|
|
|
|
QGraphicsView view;
|
|
|
|
QGraphicsScene scene;
|
|
|
|
view.setScene(&scene);
|
|
|
|
|
2008-02-29 18:50:57 +01:00
|
|
|
Plasma::VBoxLayout *widgetLayout = new Plasma::VBoxLayout(0);
|
2007-08-06 01:05:57 +02:00
|
|
|
widgetLayout->setGeometry( QRectF(0.0, 0.0, 400.0, 700.0) );
|
|
|
|
|
2008-02-29 18:50:57 +01:00
|
|
|
Plasma::HBoxLayout *h1 = new Plasma::HBoxLayout( 0 );
|
|
|
|
Plasma::HBoxLayout *h2 = new Plasma::HBoxLayout( 0 );
|
2007-08-17 16:36:48 +02:00
|
|
|
widgetLayout->addItem( h1 );
|
|
|
|
widgetLayout->addItem( h2 );
|
2007-08-06 01:05:57 +02:00
|
|
|
|
2007-08-17 16:36:48 +02:00
|
|
|
// should be first row
|
|
|
|
Plasma::PushButton *pushOne = new Plasma::PushButton("pushbutton one");
|
|
|
|
h1->addItem(pushOne);
|
2007-08-06 01:05:57 +02:00
|
|
|
scene.addItem(pushOne);
|
|
|
|
|
|
|
|
Plasma::LineEdit *editOne = new Plasma::LineEdit;
|
2007-08-17 16:36:48 +02:00
|
|
|
h1->addItem(editOne);
|
|
|
|
scene.addItem(editOne);
|
2007-08-06 01:05:57 +02:00
|
|
|
|
2007-08-17 16:36:48 +02:00
|
|
|
Plasma::Label *labelOne = new Plasma::Label( 0 );
|
|
|
|
labelOne->setText( "hello world 1" );
|
|
|
|
h1->addItem(labelOne);
|
|
|
|
scene.addItem(labelOne);
|
2007-08-06 01:05:57 +02:00
|
|
|
|
2007-08-17 16:36:48 +02:00
|
|
|
// should be second row
|
|
|
|
Plasma::PushButton *pushTwo = new Plasma::PushButton("pushbutton two");
|
|
|
|
h2->addItem(pushTwo);
|
|
|
|
scene.addItem(pushTwo);
|
|
|
|
|
2007-09-01 14:34:22 +02:00
|
|
|
Plasma::LineEdit *editTwo = new Plasma::LineEdit;
|
|
|
|
h2->addItem(editTwo);
|
|
|
|
scene.addItem(editTwo);
|
2007-08-17 16:36:48 +02:00
|
|
|
|
2007-09-01 14:34:22 +02:00
|
|
|
Plasma::Label *labelTwo = new Plasma::Label( 0 );
|
|
|
|
labelTwo->setText( "hello world 2" );
|
|
|
|
h2->addItem(labelTwo);
|
|
|
|
scene.addItem(labelTwo);
|
|
|
|
|
2007-11-20 00:45:56 +01:00
|
|
|
widgetLayout->updateGeometry();
|
2007-08-06 01:05:57 +02:00
|
|
|
|
|
|
|
view.show();
|
|
|
|
return app.exec();
|
|
|
|
}
|
|
|
|
|