diff options
Diffstat (limited to 'tests/manual/dialogs/colordialogpanel.cpp')
-rw-r--r-- | tests/manual/dialogs/colordialogpanel.cpp | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/tests/manual/dialogs/colordialogpanel.cpp b/tests/manual/dialogs/colordialogpanel.cpp index 24416fdfa1..cad33365e4 100644 --- a/tests/manual/dialogs/colordialogpanel.cpp +++ b/tests/manual/dialogs/colordialogpanel.cpp @@ -1,40 +1,32 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL$ +** $QT_BEGIN_LICENSE:LGPL21$ ** 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 Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** 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. +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, 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. -** -** ** $QT_END_LICENSE$ ** ****************************************************************************/ @@ -169,6 +161,8 @@ void ColorDialogPanel::execModal() QColorDialog dialog(this); applySettings(&dialog); connect(&dialog, SIGNAL(accepted()), this, SLOT(accepted())); + connect(&dialog, SIGNAL(rejected()), this, SLOT(rejected())); + connect(&dialog, SIGNAL(currentColorChanged(const QColor&)), this, SLOT(currentColorChanged(const QColor&))); dialog.setWindowTitle(tr("Modal Color Dialog Qt %1").arg(QLatin1String(QT_VERSION_STR))); dialog.exec(); } @@ -180,6 +174,8 @@ void ColorDialogPanel::showModal() m_modalDialog = new QColorDialog(this); m_modalDialog->setModal(true); connect(m_modalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted())); + connect(m_modalDialog.data(), SIGNAL(rejected()), this, SLOT(rejected())); + connect(m_modalDialog.data(), SIGNAL(currentColorChanged(const QColor&)), this, SLOT(currentColorChanged(const QColor&))); m_modalDialog->setWindowTitle(tr("Modal Color Dialog #%1 Qt %2") .arg(++n) .arg(QLatin1String(QT_VERSION_STR))); @@ -195,6 +191,8 @@ void ColorDialogPanel::showNonModal() static int n = 0; m_nonModalDialog = new QColorDialog(this); connect(m_nonModalDialog.data(), SIGNAL(accepted()), this, SLOT(accepted())); + connect(m_nonModalDialog.data(), SIGNAL(rejected()), this, SLOT(rejected())); + connect(m_nonModalDialog.data(), SIGNAL(currentColorChanged(const QColor&)), this, SLOT(currentColorChanged(const QColor&))); m_nonModalDialog->setWindowTitle(tr("Non-Modal Color Dialog #%1 Qt %2") .arg(++n) .arg(QLatin1String(QT_VERSION_STR))); @@ -223,12 +221,24 @@ void ColorDialogPanel::accepted() const QColorDialog *d = qobject_cast<const QColorDialog *>(sender()); Q_ASSERT(d); m_result.clear(); + qDebug() << "Current color: " << d->currentColor() + << "Selected color: " << d->selectedColor(); QDebug(&m_result).nospace() << "Current color: " << d->currentColor() << "\nSelected color: " << d->selectedColor(); QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent. } +void ColorDialogPanel::rejected() +{ + qDebug() << "rejected"; +} + +void ColorDialogPanel::currentColorChanged(const QColor &color) +{ + qDebug() << color; +} + void ColorDialogPanel::showAcceptedResult() { QMessageBox::information(this, tr("Color Dialog Accepted"), m_result, QMessageBox::Ok); |