diff options
author | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2016-09-21 10:46:21 +0200 |
---|---|---|
committer | Leena Miettinen <riitta-leena.miettinen@qt.io> | 2016-09-22 09:45:37 +0000 |
commit | 5a7f77b6680b27711c21bc1a98d191a69e096005 (patch) | |
tree | 91e376fb0695bb07c4662923ad7a585c43cdc73e /doc/tutorial/AddressBook | |
parent | 5e64f5933f8d4fafeac8036e2e0d8aa95e5d3b2d (diff) |
Doc: Update Qt VS Tools docs to version 2.0
The docs were removed in a previous commit, so this commit
uses the standard doc file structure for Qt tools docs and
updates all screen shots.
Change-Id: I41193c18895ccab22ff66ef090668f161ead16fa
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'doc/tutorial/AddressBook')
-rw-r--r-- | doc/tutorial/AddressBook/AddressBook.ico | bin | 0 -> 370070 bytes | |||
-rw-r--r-- | doc/tutorial/AddressBook/AddressBook.pro | 13 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/AddressBook.rc | 2 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/adddialog.cpp | 51 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/adddialog.h | 53 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/adddialog.ui | 126 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/addressbook.cpp | 97 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/addressbook.h | 61 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/addressbook.ui | 86 | ||||
-rw-r--r-- | doc/tutorial/AddressBook/main.cpp | 50 |
10 files changed, 539 insertions, 0 deletions
diff --git a/doc/tutorial/AddressBook/AddressBook.ico b/doc/tutorial/AddressBook/AddressBook.ico Binary files differnew file mode 100644 index 00000000..1c4fb80d --- /dev/null +++ b/doc/tutorial/AddressBook/AddressBook.ico diff --git a/doc/tutorial/AddressBook/AddressBook.pro b/doc/tutorial/AddressBook/AddressBook.pro new file mode 100644 index 00000000..63f66615 --- /dev/null +++ b/doc/tutorial/AddressBook/AddressBook.pro @@ -0,0 +1,13 @@ +TEMPLATE = app +INCLUDEPATH += . +TARGET = AddressBook +QT += core gui widgets + +HEADERS += adddialog.h \ + addressbook.h +SOURCES += main.cpp \ + adddialog.cpp \ + addressbook.cpp + +RC_FILE += AddressBook.rc +FORMS += adddialog.ui addressbook.ui diff --git a/doc/tutorial/AddressBook/AddressBook.rc b/doc/tutorial/AddressBook/AddressBook.rc new file mode 100644 index 00000000..403ed0bd --- /dev/null +++ b/doc/tutorial/AddressBook/AddressBook.rc @@ -0,0 +1,2 @@ +IDI_ICON1 ICON DISCARDABLE "AddressBook.ico" + diff --git a/doc/tutorial/AddressBook/adddialog.cpp b/doc/tutorial/AddressBook/adddialog.cpp new file mode 100644 index 00000000..84c89ee5 --- /dev/null +++ b/doc/tutorial/AddressBook/adddialog.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "adddialog.h" + +AddDialog::AddDialog(QWidget *parent) + : QDialog(parent) +{ + setupUi(this); +} + +AddDialog::~AddDialog() +{ +} diff --git a/doc/tutorial/AddressBook/adddialog.h b/doc/tutorial/AddressBook/adddialog.h new file mode 100644 index 00000000..6bab9675 --- /dev/null +++ b/doc/tutorial/AddressBook/adddialog.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#pragma once + +#include <QDialog> +#include "ui_adddialog.h" + +class AddDialog : public QDialog, public Ui::AddDialog +{ + Q_OBJECT + +public: + AddDialog(QWidget *parent = Q_NULLPTR); + ~AddDialog(); +}; diff --git a/doc/tutorial/AddressBook/adddialog.ui b/doc/tutorial/AddressBook/adddialog.ui new file mode 100644 index 00000000..88b3c015 --- /dev/null +++ b/doc/tutorial/AddressBook/adddialog.ui @@ -0,0 +1,126 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>AddDialogClass</class> + <widget class="QDialog" name="AddDialogClass" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>321</width> + <height>113</height> + </rect> + </property> + <property name="windowTitle" > + <string>AddDialog</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <layout class="QGridLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="1" column="1" > + <widget class="QLineEdit" name="emailEdit" /> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="emailText" > + <property name="text" > + <string>Email:</string> + </property> + </widget> + </item> + <item row="0" column="1" > + <widget class="QLineEdit" name="nameEdit" /> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="nameText" > + <property name="text" > + <string>Name:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="okButton" > + <property name="text" > + <string>OK</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <tabstops> + <tabstop>nameEdit</tabstop> + <tabstop>emailEdit</tabstop> + <tabstop>okButton</tabstop> + </tabstops> + <resources/> + <connections> + <connection> + <sender>okButton</sender> + <signal>clicked()</signal> + <receiver>AddDialogClass</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>290</x> + <y>92</y> + </hint> + <hint type="destinationlabel" > + <x>201</x> + <y>59</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/doc/tutorial/AddressBook/addressbook.cpp b/doc/tutorial/AddressBook/addressbook.cpp new file mode 100644 index 00000000..6bb2afda --- /dev/null +++ b/doc/tutorial/AddressBook/addressbook.cpp @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "addressbook.h" +#include "adddialog.h" + +AddressBook::AddressBook(QWidget *parent) + : QWidget(parent) +{ + ui.setupUi(this); +} + +AddressBook::~AddressBook() +{ +} + +void AddressBook::on_addButton_clicked() +{ + AddDialog dialog(this); + + if (dialog.exec()) { + QString name = dialog.nameEdit->text(); + QString email = dialog.emailEdit->text(); + + if (!name.isEmpty() && !email.isEmpty()) { + QListWidgetItem *item = new QListWidgetItem(name, ui.addressList); + item->setData(Qt::UserRole, email); + ui.addressList->setCurrentItem(item); + } + } +} + +void AddressBook::on_addressList_currentItemChanged() +{ + QListWidgetItem *curItem = ui.addressList->currentItem(); + + if (curItem) { + ui.nameLabel->setText("Name: " + curItem->text()); + ui.emailLabel->setText("Email: " + curItem->data(Qt::UserRole).toString()); + } else { + ui.nameLabel->setText("<No item selected>"); + ui.emailLabel->clear(); + } +} + +void AddressBook::on_deleteButton_clicked() +{ + QListWidgetItem *curItem = ui.addressList->currentItem(); + + if (curItem) { + int row = ui.addressList->row(curItem); + ui.addressList->takeItem(row); + delete curItem; + + if (ui.addressList->count() > 0) + ui.addressList->setCurrentRow(0); + else + on_addressList_currentItemChanged(); + } +} diff --git a/doc/tutorial/AddressBook/addressbook.h b/doc/tutorial/AddressBook/addressbook.h new file mode 100644 index 00000000..bf71441e --- /dev/null +++ b/doc/tutorial/AddressBook/addressbook.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#pragma once + +#include <QWidget> +#include "ui_addressbook.h" + +class AddressBook : public QWidget +{ + Q_OBJECT + +public: + AddressBook(QWidget *parent = 0); + ~AddressBook(); + +private: + Ui::AddressBookClass ui; + +private slots: + void on_deleteButton_clicked(); + void on_addButton_clicked(); + void on_addressList_currentItemChanged(); +}; diff --git a/doc/tutorial/AddressBook/addressbook.ui b/doc/tutorial/AddressBook/addressbook.ui new file mode 100644 index 00000000..66aad7a0 --- /dev/null +++ b/doc/tutorial/AddressBook/addressbook.ui @@ -0,0 +1,86 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>AddressBookClass</class> + <widget class="QWidget" name="AddressBookClass" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>365</width> + <height>256</height> + </rect> + </property> + <property name="windowTitle" > + <string>AddressBook</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="1" > + <layout class="QVBoxLayout" > + <property name="margin" > + <number>0</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QPushButton" name="addButton" > + <property name="text" > + <string>Add</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="deleteButton" > + <property name="text" > + <string>Delete</string> + </property> + </widget> + </item> + <item> + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item row="2" column="0" colspan="2" > + <widget class="QLabel" name="emailLabel" /> + </item> + <item row="1" column="0" colspan="2" > + <widget class="QLabel" name="nameLabel" > + <property name="text" > + <string><No items selected></string> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QListWidget" name="addressList" /> + </item> + </layout> + </widget> + <layoutdefault spacing="6" margin="11" /> + <pixmapfunction></pixmapfunction> + <tabstops> + <tabstop>addressList</tabstop> + <tabstop>addButton</tabstop> + <tabstop>deleteButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git a/doc/tutorial/AddressBook/main.cpp b/doc/tutorial/AddressBook/main.cpp new file mode 100644 index 00000000..081412aa --- /dev/null +++ b/doc/tutorial/AddressBook/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtSensors module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include "addressbook.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + AddressBook w; + w.show(); + return a.exec(); +} |