Doc: remove Config Dialog Example

Task-number: QTBUG-60635
Change-Id: I089f14a92f1b9c53b26200c93cac7ee3c9f26d65
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
This commit is contained in:
Nico Vertriest 2017-12-01 14:36:48 +01:00 committed by Frederik Gladhorn
parent 0c4d31d8c9
commit 0fd5fe28ab
12 changed files with 0 additions and 558 deletions

View File

@ -1,124 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, 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 <QtWidgets>
#include "configdialog.h"
#include "pages.h"
ConfigDialog::ConfigDialog()
{
contentsWidget = new QListWidget;
contentsWidget->setViewMode(QListView::IconMode);
contentsWidget->setIconSize(QSize(96, 84));
contentsWidget->setMovement(QListView::Static);
contentsWidget->setMaximumWidth(128);
contentsWidget->setSpacing(12);
pagesWidget = new QStackedWidget;
pagesWidget->addWidget(new ConfigurationPage);
pagesWidget->addWidget(new UpdatePage);
pagesWidget->addWidget(new QueryPage);
QPushButton *closeButton = new QPushButton(tr("Close"));
createIcons();
contentsWidget->setCurrentRow(0);
connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close);
QHBoxLayout *horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget(contentsWidget);
horizontalLayout->addWidget(pagesWidget, 1);
QHBoxLayout *buttonsLayout = new QHBoxLayout;
buttonsLayout->addStretch(1);
buttonsLayout->addWidget(closeButton);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(horizontalLayout);
mainLayout->addStretch(1);
mainLayout->addSpacing(12);
mainLayout->addLayout(buttonsLayout);
setLayout(mainLayout);
setWindowTitle(tr("Config Dialog"));
}
void ConfigDialog::createIcons()
{
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
configButton->setIcon(QIcon(":/images/config.png"));
configButton->setText(tr("Configuration"));
configButton->setTextAlignment(Qt::AlignHCenter);
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *updateButton = new QListWidgetItem(contentsWidget);
updateButton->setIcon(QIcon(":/images/update.png"));
updateButton->setText(tr("Update"));
updateButton->setTextAlignment(Qt::AlignHCenter);
updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QListWidgetItem *queryButton = new QListWidgetItem(contentsWidget);
queryButton->setIcon(QIcon(":/images/query.png"));
queryButton->setText(tr("Query"));
queryButton->setTextAlignment(Qt::AlignHCenter);
queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage);
}
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
{
if (!current)
current = previous;
pagesWidget->setCurrentIndex(contentsWidget->row(current));
}

View File

@ -1,79 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, 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$
**
****************************************************************************/
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
#include <QDialog>
QT_BEGIN_NAMESPACE
class QListWidget;
class QListWidgetItem;
class QStackedWidget;
QT_END_NAMESPACE
class ConfigDialog : public QDialog
{
Q_OBJECT
public:
ConfigDialog();
public slots:
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
private:
void createIcons();
QListWidget *contentsWidget;
QStackedWidget *pagesWidget;
};
#endif

View File

@ -1,12 +0,0 @@
QT += widgets
HEADERS = configdialog.h \
pages.h
SOURCES = configdialog.cpp \
main.cpp \
pages.cpp
RESOURCES += configdialog.qrc
# install
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/configdialog
INSTALLS += target

View File

@ -1,7 +0,0 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>images/config.png</file>
<file>images/query.png</file>
<file>images/update.png</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -1,63 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, 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 "configdialog.h"
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(configdialog);
QApplication app(argc, argv);
app.setApplicationDisplayName("Qt Example");
ConfigDialog dialog;
return dialog.exec();
}

View File

@ -1,161 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, 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 <QtWidgets>
#include "pages.h"
ConfigurationPage::ConfigurationPage(QWidget *parent)
: QWidget(parent)
{
QGroupBox *configGroup = new QGroupBox(tr("Server configuration"));
QLabel *serverLabel = new QLabel(tr("Server:"));
QComboBox *serverCombo = new QComboBox;
serverCombo->addItem(tr("Qt (Australia)"));
serverCombo->addItem(tr("Qt (Germany)"));
serverCombo->addItem(tr("Qt (Norway)"));
serverCombo->addItem(tr("Qt (People's Republic of China)"));
serverCombo->addItem(tr("Qt (USA)"));
QHBoxLayout *serverLayout = new QHBoxLayout;
serverLayout->addWidget(serverLabel);
serverLayout->addWidget(serverCombo);
QVBoxLayout *configLayout = new QVBoxLayout;
configLayout->addLayout(serverLayout);
configGroup->setLayout(configLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(configGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
UpdatePage::UpdatePage(QWidget *parent)
: QWidget(parent)
{
QGroupBox *updateGroup = new QGroupBox(tr("Package selection"));
QCheckBox *systemCheckBox = new QCheckBox(tr("Update system"));
QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications"));
QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation"));
QGroupBox *packageGroup = new QGroupBox(tr("Existing packages"));
QListWidget *packageList = new QListWidget;
QListWidgetItem *qtItem = new QListWidgetItem(packageList);
qtItem->setText(tr("Qt"));
QListWidgetItem *qsaItem = new QListWidgetItem(packageList);
qsaItem->setText(tr("QSA"));
QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList);
teamBuilderItem->setText(tr("Teambuilder"));
QPushButton *startUpdateButton = new QPushButton(tr("Start update"));
QVBoxLayout *updateLayout = new QVBoxLayout;
updateLayout->addWidget(systemCheckBox);
updateLayout->addWidget(appsCheckBox);
updateLayout->addWidget(docsCheckBox);
updateGroup->setLayout(updateLayout);
QVBoxLayout *packageLayout = new QVBoxLayout;
packageLayout->addWidget(packageList);
packageGroup->setLayout(packageLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(updateGroup);
mainLayout->addWidget(packageGroup);
mainLayout->addSpacing(12);
mainLayout->addWidget(startUpdateButton);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
QueryPage::QueryPage(QWidget *parent)
: QWidget(parent)
{
QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages"));
QLabel *nameLabel = new QLabel(tr("Name:"));
QLineEdit *nameEdit = new QLineEdit;
QLabel *dateLabel = new QLabel(tr("Released after:"));
QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases"));
QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades"));
QSpinBox *hitsSpinBox = new QSpinBox;
hitsSpinBox->setPrefix(tr("Return up to "));
hitsSpinBox->setSuffix(tr(" results"));
hitsSpinBox->setSpecialValueText(tr("Return only the first result"));
hitsSpinBox->setMinimum(1);
hitsSpinBox->setMaximum(100);
hitsSpinBox->setSingleStep(10);
QPushButton *startQueryButton = new QPushButton(tr("Start query"));
QGridLayout *packagesLayout = new QGridLayout;
packagesLayout->addWidget(nameLabel, 0, 0);
packagesLayout->addWidget(nameEdit, 0, 1);
packagesLayout->addWidget(dateLabel, 1, 0);
packagesLayout->addWidget(dateEdit, 1, 1);
packagesLayout->addWidget(releasesCheckBox, 2, 0);
packagesLayout->addWidget(upgradesCheckBox, 3, 0);
packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
packagesGroup->setLayout(packagesLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(packagesGroup);
mainLayout->addSpacing(12);
mainLayout->addWidget(startQueryButton);
mainLayout->addStretch(1);
setLayout(mainLayout);
}

View File

@ -1,74 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, 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$
**
****************************************************************************/
#ifndef PAGES_H
#define PAGES_H
#include <QWidget>
class ConfigurationPage : public QWidget
{
public:
ConfigurationPage(QWidget *parent = 0);
};
class QueryPage : public QWidget
{
public:
QueryPage(QWidget *parent = 0);
};
class UpdatePage : public QWidget
{
public:
UpdatePage(QWidget *parent = 0);
};
#endif

View File

@ -2,7 +2,6 @@ QT_FOR_CONFIG += widgets
TEMPLATE = subdirs
SUBDIRS = classwizard \
configdialog \
extension \
findfiles \
licensewizard \

View File

@ -1,37 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\example dialogs/configdialog
\title Config Dialog Example
\ingroup examples-dialogs
\brief The Config Dialog examples shows how a configuration dialog can be created by
using an icon view with a stacked widget.
\image configdialog-example.png
*/