diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f47dbfb5..0cefd8857 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDEBASE_WORKSPACE_SOURCE_DIR}/ find_package(OpenGL) +add_subdirectory( widgets ) + ########### next target ############### set(plasmagik_SRCS diff --git a/widgets/CMakeLists.txt b/widgets/CMakeLists.txt new file mode 100644 index 000000000..c2404eddc --- /dev/null +++ b/widgets/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory( tests ) diff --git a/widgets/tests/CMakeLists.txt b/widgets/tests/CMakeLists.txt new file mode 100644 index 000000000..d0bc7bfa3 --- /dev/null +++ b/widgets/tests/CMakeLists.txt @@ -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) + diff --git a/widgets/tests/testLayouts.cpp b/widgets/tests/testLayouts.cpp new file mode 100644 index 000000000..dc2c29cea --- /dev/null +++ b/widgets/tests/testLayouts.cpp @@ -0,0 +1,65 @@ +#include +#include +#include + +#include +#include +#include +#include +#include + +#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(); +} +