Add layout test

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=696814
This commit is contained in:
Matt Broadstone 2007-08-05 23:05:57 +00:00
parent 61b1dccc3d
commit 26569e231c
4 changed files with 78 additions and 0 deletions

View File

@ -2,6 +2,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDEBASE_WORKSPACE_SOURCE_DIR}/
find_package(OpenGL) find_package(OpenGL)
add_subdirectory( widgets )
########### next target ############### ########### next target ###############
set(plasmagik_SRCS set(plasmagik_SRCS

1
widgets/CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory( tests )

View File

@ -0,0 +1,10 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
########### testLayouts ###############
set(testlayouts_SRCS
testLayouts.cpp
)
kde4_add_executable(testLayouts ${testlayouts_SRCS} )
target_link_libraries( testLayouts ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} plasma)

View File

@ -0,0 +1,65 @@
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <KUniqueApplication>
#include <KCmdLineArgs>
#include <KCmdLineOptions>
#include <KAboutData>
#include <KIcon>
#include "../pushbutton.h"
#include "../lineedit.h"
#include "../vboxlayout.h"
#include "../hboxlayout.h"
#include "../widget.h"
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);
Plasma::VBoxLayout *widgetLayout = new Plasma::VBoxLayout(0);
widgetLayout->setGeometry( QRectF(0.0, 0.0, 400.0, 700.0) );
Plasma::PushButton *pushOne = new Plasma::PushButton("pushbutton one");
Plasma::PushButton *pushTwo = new Plasma::PushButton("pushbutton two");
Plasma::PushButton *pushThree = new Plasma::PushButton("pushbutton three");
Plasma::PushButton *pushFour = new Plasma::PushButton("pushbutton four");
widgetLayout->addItem(pushOne);
widgetLayout->addItem(pushTwo);
widgetLayout->addItem(pushThree);
widgetLayout->addItem(pushFour);
scene.addItem(pushOne);
scene.addItem(pushTwo);
scene.addItem(pushThree);
scene.addItem(pushFour);
Plasma::LineEdit *editOne = new Plasma::LineEdit;
Plasma::LineEdit *editTwo = new Plasma::LineEdit;
Plasma::LineEdit *editThree = new Plasma::LineEdit;
Plasma::LineEdit *editFour = new Plasma::LineEdit;
widgetLayout->addItem(editOne);
widgetLayout->addItem(editTwo);
widgetLayout->addItem(editThree);
widgetLayout->addItem(editFour);
scene.addItem(editOne);
scene.addItem(editTwo);
scene.addItem(editThree);
scene.addItem(editFour);
view.show();
return app.exec();
}