Add layout test
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=696814
This commit is contained in:
parent
61b1dccc3d
commit
26569e231c
@ -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
1
widgets/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
add_subdirectory( tests )
|
10
widgets/tests/CMakeLists.txt
Normal file
10
widgets/tests/CMakeLists.txt
Normal 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)
|
||||||
|
|
65
widgets/tests/testLayouts.cpp
Normal file
65
widgets/tests/testLayouts.cpp
Normal 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();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user