clean this up a bit

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=804345
This commit is contained in:
Aaron J. Seigo 2008-05-05 18:37:18 +00:00
parent ad1376f069
commit a7fd1ce868
5 changed files with 0 additions and 202 deletions

View File

@ -3,7 +3,6 @@ include (KDE4Defaults)
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${KDEBASE_WORKSPACE_SOURCE_DIR}/libs ${CMAKE_CURRENT_SOURCE_DIR}/.. ${KDE4_INCLUDES} ${OPENGL_INCLUDE_DIR})
add_subdirectory(widgets)
#add_subdirectory(tests)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=1209)

View File

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

View File

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

View File

@ -1,70 +0,0 @@
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <KUniqueApplication>
#include <KCmdLineArgs>
#include <KCmdLineOptions>
#include <KAboutData>
#include <KIcon>
#include "plasma/layouts/boxlayout.h"
#include "plasma/widgets/pushbutton.h"
#include "plasma/widgets/lineedit.h"
#include "plasma/widgets/widget.h"
#include "plasma/widgets/label.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::HBoxLayout *h1 = new Plasma::HBoxLayout( 0 );
Plasma::HBoxLayout *h2 = new Plasma::HBoxLayout( 0 );
widgetLayout->addItem( h1 );
widgetLayout->addItem( h2 );
// should be first row
Plasma::PushButton *pushOne = new Plasma::PushButton("pushbutton one");
h1->addItem(pushOne);
scene.addItem(pushOne);
Plasma::LineEdit *editOne = new Plasma::LineEdit;
h1->addItem(editOne);
scene.addItem(editOne);
Plasma::Label *labelOne = new Plasma::Label( 0 );
labelOne->setText( "hello world 1" );
h1->addItem(labelOne);
scene.addItem(labelOne);
// should be second row
Plasma::PushButton *pushTwo = new Plasma::PushButton("pushbutton two");
h2->addItem(pushTwo);
scene.addItem(pushTwo);
Plasma::LineEdit *editTwo = new Plasma::LineEdit;
h2->addItem(editTwo);
scene.addItem(editTwo);
Plasma::Label *labelTwo = new Plasma::Label( 0 );
labelTwo->setText( "hello world 2" );
h2->addItem(labelTwo);
scene.addItem(labelTwo);
widgetLayout->updateGeometry();
view.show();
return app.exec();
}

View File

@ -1,113 +0,0 @@
#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTimer>
#include <KUniqueApplication>
#include <KCmdLineArgs>
#include <KCmdLineOptions>
#include <KAboutData>
#include <KIcon>
#include "plasma/layouts/boxlayout.h"
#include "plasma/widgets/progressbar.h"
class Counter : QObject
{
Q_OBJECT
public:
Counter(Plasma::ProgressBar *p);
~Counter();
void start();
private Q_SLOTS:
void updateValue();
private:
QTimer timer;
Plasma::ProgressBar *pbar;
int seconds;
};
Counter::Counter(Plasma::ProgressBar *p)
: QObject(), timer(0)
{
seconds = 10;
pbar = p;
}
Counter::~Counter()
{
}
void Counter::start()
{
connect(&timer, SIGNAL(timeout()),
this, SLOT(updateValue()));
timer.start(100);
}
void Counter::updateValue()
{
int inc = 1;
pbar->setValue(pbar->value() + inc);
if (pbar->value() >= 100) {
timer.stop();
}
}
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, 350.0, 30.0));
Plasma::HBoxLayout *h1 = new Plasma::HBoxLayout(0);
widgetLayout->addItem(h1);
Plasma::ProgressBar *progressBar = new Plasma::ProgressBar(0);
h1->addItem(progressBar);
scene.addItem(progressBar);
widgetLayout->updateGeometry();
view.show();
Counter *c = new Counter(progressBar);
c->start();
// Uncomment for hide the text.
// progressBar->setTextVisible( false );
//
// Uncomment for change the progressbar alignment
// progressBar->setAlignment( Qt::AlignRight );
//
// Uncomment in order to invert the progress, from right to left.
// progressBar->setInvertedAppearance( true );;
progressBar->setGeometry(QRectF(0, 0, 200, 30));
return app.exec();
}
#include "testLayouts.moc"