diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2009-03-23 09:34:13 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-03-23 09:34:13 (GMT) |
commit | 67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch) | |
tree | 1dbf50b3dff8d5ca7e9344733968c72704eb15ff /examples/designer/calculatorform | |
download | Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.zip Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.gz Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.bz2 |
Long live Qt!
Diffstat (limited to 'examples/designer/calculatorform')
-rw-r--r-- | examples/designer/calculatorform/calculatorform.cpp | 66 | ||||
-rw-r--r-- | examples/designer/calculatorform/calculatorform.h | 66 | ||||
-rw-r--r-- | examples/designer/calculatorform/calculatorform.pro | 13 | ||||
-rw-r--r-- | examples/designer/calculatorform/calculatorform.ui | 284 | ||||
-rw-r--r-- | examples/designer/calculatorform/main.cpp | 53 |
5 files changed, 482 insertions, 0 deletions
diff --git a/examples/designer/calculatorform/calculatorform.cpp b/examples/designer/calculatorform/calculatorform.cpp new file mode 100644 index 0000000..3de2852 --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.cpp @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used 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. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> + +#include "calculatorform.h" + +//! [0] +CalculatorForm::CalculatorForm(QWidget *parent) + : QWidget(parent) +{ + ui.setupUi(this); +} +//! [0] + +//! [1] +void CalculatorForm::on_inputSpinBox1_valueChanged(int value) +{ + ui.outputWidget->setText(QString::number(value + ui.inputSpinBox2->value())); +} +//! [1] + +//! [2] +void CalculatorForm::on_inputSpinBox2_valueChanged(int value) +{ + ui.outputWidget->setText(QString::number(value + ui.inputSpinBox1->value())); +} +//! [2] diff --git a/examples/designer/calculatorform/calculatorform.h b/examples/designer/calculatorform/calculatorform.h new file mode 100644 index 0000000..37f0a18 --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used 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. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CALCULATORFORM_H +#define CALCULATORFORM_H + +//! [0] +#include "ui_calculatorform.h" +//! [0] + +//! [1] +class CalculatorForm : public QWidget +{ + Q_OBJECT + +public: + CalculatorForm(QWidget *parent = 0); + +private slots: + void on_inputSpinBox1_valueChanged(int value); + void on_inputSpinBox2_valueChanged(int value); + +private: + Ui::CalculatorForm ui; +}; +//! [1] + +#endif diff --git a/examples/designer/calculatorform/calculatorform.pro b/examples/designer/calculatorform/calculatorform.pro new file mode 100644 index 0000000..73f4351 --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.pro @@ -0,0 +1,13 @@ +#! [0] +HEADERS = calculatorform.h +#! [0] #! [1] +FORMS = calculatorform.ui +#! [1] +SOURCES = calculatorform.cpp \ + main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/designer/calculatorform +INSTALLS += target sources diff --git a/examples/designer/calculatorform/calculatorform.ui b/examples/designer/calculatorform/calculatorform.ui new file mode 100644 index 0000000..3a95639 --- /dev/null +++ b/examples/designer/calculatorform/calculatorform.ui @@ -0,0 +1,284 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>CalculatorForm</class> + <widget class="QWidget" name="CalculatorForm" > + <property name="objectName" > + <string notr="true" >CalculatorForm</string> + </property> + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="windowTitle" > + <string>Calculator Form</string> + </property> + <layout class="QGridLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="6" > + <spacer> + <property name="objectName" > + <string notr="true" >horizontalSpacer</string> + </property> + <property name="geometry" > + <rect> + <x>239</x> + <y>9</y> + <width>152</width> + <height>52</height> + </rect> + </property> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="4" > + <widget class="QLabel" name="label_3_2" > + <property name="objectName" > + <string notr="true" >label_3_2</string> + </property> + <property name="geometry" > + <rect> + <x>169</x> + <y>9</y> + <width>20</width> + <height>52</height> + </rect> + </property> + <property name="text" > + <string>=</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="5" > + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_2_2_2" > + <property name="objectName" > + <string notr="true" >label_2_2_2</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>1</y> + <width>36</width> + <height>17</height> + </rect> + </property> + <property name="text" > + <string>Output</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="outputWidget" > + <property name="objectName" > + <string notr="true" >outputWidget</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>24</y> + <width>36</width> + <height>27</height> + </rect> + </property> + <property name="frameShape" > + <enum>QFrame::Box</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Sunken</enum> + </property> + <property name="text" > + <string>0</string> + </property> + <property name="alignment" > + <set>Qt::AlignAbsolute|Qt::AlignBottom|Qt::AlignCenter|Qt::AlignHCenter|Qt::AlignHorizontal_Mask|Qt::AlignJustify|Qt::AlignLeading|Qt::AlignLeft|Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing|Qt::AlignVCenter|Qt::AlignVertical_Mask</set> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="2" > + <spacer> + <property name="objectName" > + <string notr="true" >verticalSpacer</string> + </property> + <property name="geometry" > + <rect> + <x>89</x> + <y>67</y> + <width>20</width> + <height>224</height> + </rect> + </property> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="3" > + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label_2" > + <property name="objectName" > + <string notr="true" >label_2</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>1</y> + <width>46</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Input 2</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="inputSpinBox2" > + <property name="objectName" > + <string notr="true" >inputSpinBox2</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>26</y> + <width>46</width> + <height>25</height> + </rect> + </property> + </widget> + </item> + </layout> + </item> + <item row="0" column="1" > + <widget class="QLabel" name="label_3" > + <property name="objectName" > + <string notr="true" >label_3</string> + </property> + <property name="geometry" > + <rect> + <x>63</x> + <y>9</y> + <width>20</width> + <height>52</height> + </rect> + </property> + <property name="text" > + <string>+</string> + </property> + <property name="alignment" > + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="0" > + <layout class="QVBoxLayout" > + <property name="objectName" > + <string notr="true" /> + </property> + <property name="margin" > + <number>1</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label" > + <property name="objectName" > + <string notr="true" >label</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>1</y> + <width>46</width> + <height>19</height> + </rect> + </property> + <property name="text" > + <string>Input 1</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="inputSpinBox1" > + <property name="objectName" > + <string notr="true" >inputSpinBox1</string> + </property> + <property name="geometry" > + <rect> + <x>1</x> + <y>26</y> + <width>46</width> + <height>25</height> + </rect> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <resources/> + <connections/> +</ui> diff --git a/examples/designer/calculatorform/main.cpp b/examples/designer/calculatorform/main.cpp new file mode 100644 index 0000000..dcb7366 --- /dev/null +++ b/examples/designer/calculatorform/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used 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. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> + +#include "calculatorform.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + CalculatorForm calculator; + calculator.show(); + return app.exec(); +} + |