diff options
author | Bernd Lamecker <bernd.lamecker@basyskom.de> | 2010-02-22 10:37:04 +0100 |
---|---|---|
committer | Bernd Lamecker <bernd.lamecker@basyskom.de> | 2010-02-22 14:35:30 +0100 |
commit | a538a0b10755f246ebce89e848096852deb55e40 (patch) | |
tree | ddcdbe588bff264fa423083edfde4d5dbfda2e53 /demos | |
parent | b8f20b8ebb65f4d78ab5717b861808aff3acf020 (diff) |
Changes: Added kinetic scrolling support to plain Qt
RevBy: TrustMe
Diffstat (limited to 'demos')
-rw-r--r-- | demos/demos.pro | 1 | ||||
-rw-r--r-- | demos/qtstylekinetic/MainWindow.cpp | 49 | ||||
-rw-r--r-- | demos/qtstylekinetic/MainWindow.h | 35 | ||||
-rw-r--r-- | demos/qtstylekinetic/MainWindow.ui | 334 | ||||
-rw-r--r-- | demos/qtstylekinetic/main.cpp | 33 | ||||
-rw-r--r-- | demos/qtstylekinetic/qtstylekinetic.pro | 54 |
6 files changed, 506 insertions, 0 deletions
diff --git a/demos/demos.pro b/demos/demos.pro index 77ed6385..4fa99332 100644 --- a/demos/demos.pro +++ b/demos/demos.pro @@ -7,6 +7,7 @@ SUBDIRS = \ animatedlayout/translations \ qtstyleexample \ qtstyledialogs \ + qtstylekinetic \ appletinstallationsource # we do not have compiled QtDBusd4 diff --git a/demos/qtstylekinetic/MainWindow.cpp b/demos/qtstylekinetic/MainWindow.cpp new file mode 100644 index 00000000..f0a4b833 --- /dev/null +++ b/demos/qtstylekinetic/MainWindow.cpp @@ -0,0 +1,49 @@ +/*************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (directui@nokia.com) +** +** This file is part of libdui. +** +** If you have questions regarding the use of this file, please contact +** Nokia at directui@nokia.com. +** +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation +** and appearing in the file LICENSE.LGPL included in the packaging +** of this file. +** +****************************************************************************/ + +#include "MainWindow.h" + +#include <QPushButton> +#include <QTableWidgetItem> +#include <QDebug> + +MainWindow::MainWindow() : QMainWindow(NULL) +{ + setupUi(this); + + QWidget* w = new QWidget(); + w->setLayout(new QVBoxLayout); + for(int i = 0; i < 100; ++i) + w->layout()->addWidget(new QPushButton(QString("Button %1").arg(i))); + scrollArea->setWidget(w); + + for(int i = 0; i < 100; ++i) + new QListWidgetItem(QString("Item %1").arg(i), listWidget); + + for(int row = 0; row < 100; ++row) + for(int col = 0; col < 100; ++col) { + QTableWidgetItem* item = new QTableWidgetItem(QString("%1").arg(row*col)); + tableWidget->setItem(row, col, item); + } +} + +MainWindow::~MainWindow() +{ + +} diff --git a/demos/qtstylekinetic/MainWindow.h b/demos/qtstylekinetic/MainWindow.h new file mode 100644 index 00000000..8126fa2b --- /dev/null +++ b/demos/qtstylekinetic/MainWindow.h @@ -0,0 +1,35 @@ +/*************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (directui@nokia.com) +** +** This file is part of libdui. +** +** If you have questions regarding the use of this file, please contact +** Nokia at directui@nokia.com. +** +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation +** and appearing in the file LICENSE.LGPL included in the packaging +** of this file. +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> + +#include "ui_MainWindow.h" + +class MainWindow : public QMainWindow, Ui::MainWindow +{ + Q_OBJECT +public: + MainWindow(); + ~MainWindow(); +}; + +#endif diff --git a/demos/qtstylekinetic/MainWindow.ui b/demos/qtstylekinetic/MainWindow.ui new file mode 100644 index 00000000..4fd85726 --- /dev/null +++ b/demos/qtstylekinetic/MainWindow.ui @@ -0,0 +1,334 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>527</width> + <height>427</height> + </rect> + </property> + <property name="windowTitle"> + <string>Qt Style Dialog Test</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>2</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>ScrollArea</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QScrollArea" name="scrollArea"> + <property name="widgetResizable"> + <bool>true</bool> + </property> + <widget class="QWidget" name="scrollAreaWidgetContents"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>495</width> + <height>353</height> + </rect> + </property> + </widget> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>ListView</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QListWidget" name="listWidget"/> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_3"> + <attribute name="title"> + <string>TableView</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QTableWidget" name="tableWidget"> + <property name="rowCount"> + <number>100</number> + </property> + <property name="columnCount"> + <number>100</number> + </property> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <row/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + <column/> + </widget> + </item> + </layout> + </widget> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QStatusBar" name="statusbar"/> + <action name="actionNew"> + <property name="text"> + <string>New</string> + </property> + </action> + <action name="actionQuit"> + <property name="text"> + <string>Quit</string> + </property> + </action> + <action name="actionOpen"> + <property name="icon"> + <iconset> + <normaloff>:/images/images/icon-m-save.svg</normaloff>:/images/images/icon-m-save.svg</iconset> + </property> + <property name="text"> + <string>Open...</string> + </property> + </action> + <action name="actionOrder"> + <property name="icon"> + <iconset> + <normaloff>:/images/images/icon-m-message-send-receive.svg</normaloff>:/images/images/icon-m-message-send-receive.svg</iconset> + </property> + <property name="text"> + <string>order</string> + </property> + </action> + <action name="actionAction_1"> + <property name="text"> + <string>Action 1</string> + </property> + </action> + <action name="actionAction_2"> + <property name="text"> + <string>Action 2</string> + </property> + </action> + <action name="actionAction_3"> + <property name="text"> + <string>Action 3</string> + </property> + </action> + <action name="actionAction_4"> + <property name="text"> + <string>Action 4</string> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui> diff --git a/demos/qtstylekinetic/main.cpp b/demos/qtstylekinetic/main.cpp new file mode 100644 index 00000000..fd97c863 --- /dev/null +++ b/demos/qtstylekinetic/main.cpp @@ -0,0 +1,33 @@ +/*************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (directui@nokia.com) +** +** This file is part of libdui. +** +** If you have questions regarding the use of this file, please contact +** Nokia at directui@nokia.com. +** +** This library is free software; you can redistribute it and/or +** modify it under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation +** and appearing in the file LICENSE.LGPL included in the packaging +** of this file. +** +****************************************************************************/ + +#include <QApplication> +#include <QMainWindow> + +#include "MainWindow.h" + +int main(int argc, char **argv) +{ + QApplication app(argc, argv); + MainWindow mw; + mw.show(); + + return app.exec(); +} + diff --git a/demos/qtstylekinetic/qtstylekinetic.pro b/demos/qtstylekinetic/qtstylekinetic.pro new file mode 100644 index 00000000..93e680ed --- /dev/null +++ b/demos/qtstylekinetic/qtstylekinetic.pro @@ -0,0 +1,54 @@ +DUIROOT = ../.. +include($$DUIROOT/mkspecs/common.pri) +TEMPLATE = app +TARGET = qtstylekinetic +target.path = $$DUI_INSTALL_BIN +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += main.cpp \ + MainWindow.cpp +HEADERS += MainWindow.h +FORMS += MainWindow.ui + +# UI style definition +style_sheet.path = $$DUI_THEME_DIR/../qtstylekinetic/themes/style +style_sheet.files = style/qtstylekinetic.css +view_configuration.path = $$DUI_THEME_DIR/../qtstylekinetic/themes +view_configuration.files = style/qtstylekinetic.conf +style_images.path = $$DUI_THEME_DIR/../qtstylekinetic/themes/images +style_images.files = images/*.png \ + images/*.jpg +style_svg.path = $$DUI_THEME_DIR/../qtstylekinetic/themes/svg +style_svg.files = images/*.svg + +desktop_entry.path = $$DUI_INSTALL_DATA/applications +desktop_entry.files = \ + qtstylekinetic.desktop \ + qtstylekinetic-windows-style.desktop + +myname = com.nokia.qtstylekinetic + +services.CONFIG += no_check_exist +services.target = $${myname}.service +services.commands = cat $$IN_PWD/$${myname}.service.in \ + | sed -e "s:@DUI_INSTALL_BIN@:$${DUI_INSTALL_BIN}:g" \ + > $${myname}.service +services.files = $$OUT_PWD/$${myname}.service +services.path = $$DUI_DBUS_SERVICES_DIR + + +DEFINES += IMAGES_DIR=\"\\\"$$style_images.path/\\\"\" + +# Install instructions +INSTALLS += target \ + style_sheet \ + style_images \ + style_svg \ + desktop_entry \ + +!win32:!macx { + INSTALLS += services +} + |