summaryrefslogtreecommitdiffstats
path: root/examples/widgets/dialogs/sipdialog
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2012-08-17 13:23:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-20 12:20:55 +0200
commit806dda08d685bc5f9ed71dfe8b61f21848d48066 (patch)
treea63533a1c4a335ae17adc105abb0ae4e62e2f26e /examples/widgets/dialogs/sipdialog
parent9f942014e31842b512c3198de035d041c59f54a9 (diff)
Moving .qdoc files under examples/widgets/doc
Updated those .qdoc files to refer to the new relative examples emplacement. Images and snippets to be moved later. Also grouped all widgets related examples under widgets. Change-Id: Ib29696e2d8948524537f53e8dda88f9ee26a597f Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>
Diffstat (limited to 'examples/widgets/dialogs/sipdialog')
-rw-r--r--examples/widgets/dialogs/sipdialog/dialog.cpp122
-rw-r--r--examples/widgets/dialogs/sipdialog/dialog.h63
-rw-r--r--examples/widgets/dialogs/sipdialog/main.cpp52
-rw-r--r--examples/widgets/dialogs/sipdialog/sipdialog.desktop11
-rw-r--r--examples/widgets/dialogs/sipdialog/sipdialog.pro15
5 files changed, 263 insertions, 0 deletions
diff --git a/examples/widgets/dialogs/sipdialog/dialog.cpp b/examples/widgets/dialogs/sipdialog/dialog.cpp
new file mode 100644
index 0000000000..fdfbc94ca4
--- /dev/null
+++ b/examples/widgets/dialogs/sipdialog/dialog.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtWidgets>
+
+#include "dialog.h"
+
+//! [Dialog constructor part1]
+Dialog::Dialog()
+{
+ desktopGeometry = QApplication::desktop()->availableGeometry(0);
+
+ setWindowTitle(tr("SIP Dialog Example"));
+ QScrollArea *scrollArea = new QScrollArea(this);
+ QGroupBox *groupBox = new QGroupBox(scrollArea);
+ groupBox->setTitle(tr("SIP Dialog Example"));
+ QGridLayout *gridLayout = new QGridLayout(groupBox);
+ groupBox->setLayout(gridLayout);
+//! [Dialog constructor part1]
+
+//! [Dialog constructor part2]
+ QLineEdit* lineEdit = new QLineEdit(groupBox);
+ lineEdit->setText(tr("Open and close the SIP"));
+ lineEdit->setMinimumWidth(220);
+
+ QLabel* label = new QLabel(groupBox);
+ label->setText(tr("This dialog resizes if the SIP is opened"));
+ label->setMinimumWidth(220);
+
+ QPushButton* button = new QPushButton(groupBox);
+ button->setText(tr("Close Dialog"));
+ button->setMinimumWidth(220);
+//! [Dialog constructor part2]
+
+//! [Dialog constructor part3]
+ if (desktopGeometry.height() < 400)
+ gridLayout->setVerticalSpacing(80);
+ else
+ gridLayout->setVerticalSpacing(150);
+
+ gridLayout->addWidget(label);
+ gridLayout->addWidget(lineEdit);
+ gridLayout->addWidget(button);
+//! [Dialog constructor part3]
+
+//! [Dialog constructor part4]
+ scrollArea->setWidget(groupBox);
+ QHBoxLayout* layout = new QHBoxLayout();
+ layout->addWidget(scrollArea);
+ setLayout(layout);
+ scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+//! [Dialog constructor part4]
+
+//! [Dialog constructor part5]
+ connect(button, SIGNAL(clicked()),
+ qApp, SLOT(closeAllWindows()));
+ connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
+ this, SLOT(desktopResized(int)));
+}
+//! [Dialog constructor part5]
+
+//! [desktopResized() function]
+void Dialog::desktopResized(int screen)
+{
+ if (screen != 0)
+ return;
+ reactToSIP();
+}
+//! [desktopResized() function]
+
+//! [reactToSIP() function]
+void Dialog::reactToSIP()
+{
+ QRect availableGeometry = QApplication::desktop()->availableGeometry(0);
+
+ if (desktopGeometry != availableGeometry) {
+ if (windowState() | Qt::WindowMaximized)
+ setWindowState(windowState() & ~Qt::WindowMaximized);
+
+ setGeometry(availableGeometry);
+ }
+
+ desktopGeometry = availableGeometry;
+}
+//! [reactToSIP() function]
diff --git a/examples/widgets/dialogs/sipdialog/dialog.h b/examples/widgets/dialogs/sipdialog/dialog.h
new file mode 100644
index 0000000000..18eb92d857
--- /dev/null
+++ b/examples/widgets/dialogs/sipdialog/dialog.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples 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 Nokia Corporation and its Subsidiary(-ies) 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$
+**
+****************************************************************************/
+
+#ifndef DIALOG_H
+#define DIALOG_H
+
+#include <QDialog>
+
+//! [Dialog header]
+class Dialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ Dialog();
+ void reactToSIP();
+
+private:
+ QRect desktopGeometry;
+
+public slots:
+ void desktopResized(int screen);
+};
+//! [Dialog header]
+
+#endif
diff --git a/examples/widgets/dialogs/sipdialog/main.cpp b/examples/widgets/dialogs/sipdialog/main.cpp
new file mode 100644
index 0000000000..79fd956fb9
--- /dev/null
+++ b/examples/widgets/dialogs/sipdialog/main.cpp
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the examples 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 Nokia Corporation and its Subsidiary(-ies) 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 <QtWidgets>
+
+#include "dialog.h"
+
+//! [main() function]
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ Dialog dialog;
+ return dialog.exec();
+}
+//! [main() function]
diff --git a/examples/widgets/dialogs/sipdialog/sipdialog.desktop b/examples/widgets/dialogs/sipdialog/sipdialog.desktop
new file mode 100644
index 0000000000..b9c9955339
--- /dev/null
+++ b/examples/widgets/dialogs/sipdialog/sipdialog.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=SIP Dialog
+Exec=/opt/usr/bin/sipdialog
+Icon=sipdialog
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/widgets/dialogs/sipdialog/sipdialog.pro b/examples/widgets/dialogs/sipdialog/sipdialog.pro
new file mode 100644
index 0000000000..72db93f646
--- /dev/null
+++ b/examples/widgets/dialogs/sipdialog/sipdialog.pro
@@ -0,0 +1,15 @@
+HEADERS = dialog.h
+SOURCES = main.cpp \
+ dialog.cpp
+
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/sipdialog
+sources.files = $$SOURCES $$HEADERS *.pro
+sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/dialogs/sipdialog
+INSTALLS += target sources
+
+wince50standard-x86-msvc2005: LIBS += libcmt.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib coredll.lib winsock.lib ws2.lib
+
+QT += widgets
+
+simulator: warning(This example might not fully work on Simulator platform)