~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/plasmagenericshell/tests/main.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <QtGui>
 
2
// #include "customwidgets.h"
 
3
#include <plasma/applet.h>
 
4
#include "widgetsexplorer/widgetexplorer.h"
 
5
#include <plasma/containment.h>
 
6
#include <QDesktopWidget>
 
7
#include <plasma/corona.h>
 
8
#include <plasma/view.h>
 
9
#include <plasma/containment.h>
 
10
 
 
11
int main(int argc, char *argv[])
 
12
{
 
13
    QApplication app(argc, argv);
 
14
 
 
15
    Plasma::Containment *containment = new Plasma::Containment();
 
16
 
 
17
    Plasma::WidgetExplorer *appletBrowser;
 
18
 
 
19
    Qt::Orientation orientation = Qt::Vertical;
 
20
//    Qt::Orientation orientation = Qt::Horizontal;
 
21
 
 
22
    appletBrowser = new Plasma::WidgetExplorer();
 
23
    appletBrowser->setContainment(containment);
 
24
    appletBrowser->setLocation(Plasma::BottomEdge);
 
25
    appletBrowser->populateWidgetList();
 
26
 
 
27
    Plasma::Corona *scene = new Plasma::Corona();
 
28
    scene->addItem(appletBrowser);
 
29
    scene->setSceneRect(QRectF(0, 0, appletBrowser->minimumWidth(), appletBrowser->minimumHeight()));
 
30
 
 
31
    Plasma::View *view = new Plasma::View(appletBrowser->containment(), 0);
 
32
    view->setScene(scene);
 
33
    view->setWindowFlags(Qt::FramelessWindowHint);
 
34
    view->setAttribute(Qt::WA_TranslucentBackground, true);
 
35
    view->setStyleSheet("background: transparent");
 
36
 
 
37
    QDesktopWidget *screen = new QDesktopWidget();
 
38
 
 
39
    view->setMinimumWidth(appletBrowser->minimumWidth());
 
40
    view->setMaximumWidth(appletBrowser->minimumWidth());
 
41
    view->setMinimumHeight(appletBrowser->minimumHeight());
 
42
    view->setMaximumHeight(appletBrowser->minimumHeight());
 
43
 
 
44
    if(orientation == Qt::Horizontal) {
 
45
        view->move(0, screen->height() - view->maximumHeight());
 
46
    } else {
 
47
        view->move(0, 0);
 
48
    }
 
49
 
 
50
    view->show();
 
51
 
 
52
    view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
53
    view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
 
54
 
 
55
    return app.exec();
 
56
}