summaryrefslogtreecommitdiffstats
path: root/tests/manual/dialogs
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-09-17 16:07:10 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2021-09-23 16:57:03 +0200
commit298e41b830f60c0f2f078996ace77a4254a9f335 (patch)
tree4bf6029da36fb143aeeb11c04a2bdf442ef56b42 /tests/manual/dialogs
parente5d65996a93bbf4cbc8a155887def6efa3ad73de (diff)
Remove fatuously true or false QT_VERSION checks
QT_VERSION is now at least QT_VERSION_CHECK(6, 3, 0), so remove all checks against Qt 6.0.0 or earlier. They are superfluous. Tidied up in some places in the process, particularly #include order. Change-Id: I2636b2fd13be5b976f5b043ef2f8cddc038a72a4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/manual/dialogs')
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp16
-rw-r--r--tests/manual/dialogs/fontdialogpanel.cpp2
-rw-r--r--tests/manual/dialogs/main.cpp10
-rw-r--r--tests/manual/dialogs/messageboxpanel.cpp4
-rw-r--r--tests/manual/dialogs/printdialogpanel.h34
5 files changed, 3 insertions, 63 deletions
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 9f2ae559d7..f72ab3d107 100644
--- a/tests/manual/dialogs/filedialogpanel.cpp
+++ b/tests/manual/dialogs/filedialogpanel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -326,7 +326,6 @@ void FileDialogPanel::getOpenFileNames()
void FileDialogPanel::getOpenFileUrls()
{
-#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QList<QUrl> files =
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -339,7 +338,6 @@ void FileDialogPanel::getOpenFileUrls()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
}
-#endif // Qt 5
}
void FileDialogPanel::getOpenFileName()
@@ -359,7 +357,6 @@ void FileDialogPanel::getOpenFileName()
void FileDialogPanel::getOpenFileUrl()
{
-#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QUrl file =
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -372,7 +369,6 @@ void FileDialogPanel::getOpenFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
}
-#endif // Qt 5
}
void FileDialogPanel::getSaveFileName()
@@ -392,7 +388,6 @@ void FileDialogPanel::getSaveFileName()
void FileDialogPanel::getSaveFileUrl()
{
-#if QT_VERSION >= 0x050000
QString selectedFilter = m_selectedNameFilter->text().trimmed();
const QUrl file =
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
@@ -405,7 +400,6 @@ void FileDialogPanel::getSaveFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
}
-#endif // Qt 5
}
void FileDialogPanel::getExistingDirectory()
@@ -419,14 +413,12 @@ void FileDialogPanel::getExistingDirectory()
void FileDialogPanel::getExistingDirectoryUrl()
{
-#if QT_VERSION >= 0x050000
const QUrl dir =
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
currentDirectoryUrl(), options() | QFileDialog::ShowDirsOnly,
allowedSchemes());
if (!dir.isEmpty())
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
-#endif // Qt 5
}
void FileDialogPanel::restoreDefaults()
@@ -473,11 +465,9 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
if (!filter.isEmpty())
d->selectNameFilter(filter);
} else {
-#if QT_VERSION >= 0x050000
d->setMimeTypeFilters(filters);
if (!filter.isEmpty())
d->selectMimeTypeFilter(filter);
-#endif // Qt 5
}
foreach (LabelLineEdit *l, m_labelLineEdits)
l->apply(d);
@@ -504,14 +494,10 @@ void FileDialogPanel::accepted()
Q_ASSERT(d);
m_result.clear();
QDebug(&m_result).nospace()
-#if QT_VERSION >= 0x050000
<< "URLs: " << d->selectedUrls() << '\n'
-#endif
<< "Files: " << d->selectedFiles()
<< "\nDirectory: "
-#if QT_VERSION >= 0x050000
<< d->directoryUrl() << ", "
-#endif
<< d->directory().absolutePath()
<< "\nName filter: " << d->selectedNameFilter();
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
diff --git a/tests/manual/dialogs/fontdialogpanel.cpp b/tests/manual/dialogs/fontdialogpanel.cpp
index 8ed52a8a75..629fa95262 100644
--- a/tests/manual/dialogs/fontdialogpanel.cpp
+++ b/tests/manual/dialogs/fontdialogpanel.cpp
@@ -196,12 +196,10 @@ void FontDialogPanel::applySettings(QFontDialog *d) const
{
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
-#if QT_VERSION >= 0x050000
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
-#endif // Qt 5
QFont font = m_fontFamilyBox->currentFont();
font.setPointSizeF(m_fontSizeBox->value());
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index da9daab942..90915b18ea 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -59,15 +59,9 @@ AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QFormLayout *mainLayout = new QFormLayout(this);
-#if QT_VERSION >= 0x050600
mainLayout->addRow(new QLabel(QLibraryInfo::build()));
-#else
- mainLayout->addRow(new QLabel(QLatin1String("Qt ") + QLatin1String(QT_VERSION_STR )));
-#endif
mainLayout->addRow("Style:", new QLabel(qApp->style()->objectName()));
-#if QT_VERSION >= 0x050600
mainLayout->addRow("DPR:", new QLabel(QString::number(qApp->devicePixelRatio())));
-#endif
const QString resolution = QString::number(logicalDpiX()) + QLatin1Char(',')
+ QString::number(logicalDpiY()) + QLatin1String("dpi");
mainLayout->addRow("Resolution:", new QLabel(resolution));
@@ -129,9 +123,7 @@ int main(int argc, char *argv[])
for (int a = 1; a < argc; ++a) {
if (!qstrcmp(argv[a], "-n")) {
qDebug("AA_DontUseNativeDialogs");
-#if QT_VERSION >= 0x050700
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
-#endif
} else if (!qstrcmp(argv[a], "-p")) {
optNoPrinter = true; // Avoid startup slowdown by printer code
}
diff --git a/tests/manual/dialogs/messageboxpanel.cpp b/tests/manual/dialogs/messageboxpanel.cpp
index 6a305523ea..25c230a855 100644
--- a/tests/manual/dialogs/messageboxpanel.cpp
+++ b/tests/manual/dialogs/messageboxpanel.cpp
@@ -138,11 +138,9 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
if (box.standardButtons() == QMessageBox::StandardButtons())
box.setStandardButtons(QMessageBox::Ok); // just to have something.
-#if QT_VERSION >= 0x050000
box.setCheckBox(0);
if (m_checkboxText->text().length() > 0)
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
-#endif // Qt 5
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
}
@@ -167,14 +165,12 @@ void MessageBoxPanel::doExec()
QString sres;
sres.setNum(res, 16);
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
-#if QT_VERSION >= 0x050000
if (m_msgbox->checkBox()) {
if (m_msgbox->checkBox()->isChecked())
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
else
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
}
-#endif // Qt 5
}
void MessageBoxPanel::doShowApply()
diff --git a/tests/manual/dialogs/printdialogpanel.h b/tests/manual/dialogs/printdialogpanel.h
index 618e34d596..0f34d01033 100644
--- a/tests/manual/dialogs/printdialogpanel.h
+++ b/tests/manual/dialogs/printdialogpanel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -33,9 +33,7 @@
#include "ui_printdialogpanel.h"
-#if QT_VERSION >= 0x050300
#include <QPageLayout>
-#endif
#include <QPrinter>
#include <QWidget>
@@ -50,31 +48,6 @@ QT_END_NAMESPACE
class PageSizeControl;
class OptionsControl;
-#if QT_VERSION < 0x050300
-// Copied from class QPageLayout introduced in Qt 5.3
-namespace QPageLayout
-{
- enum Unit {
- Millimeter,
- Point,
- Inch,
- Pica,
- Didot,
- Cicero
- };
-
- enum Orientation {
- Portrait,
- Landscape
- };
-
- enum Mode {
- StandardMode, // Paint Rect includes margins
- FullPageMode // Paint Rect excludes margins
- };
-}
-#endif
-
class PrintDialogPanel : public QWidget
{
Q_OBJECT
@@ -107,12 +80,7 @@ private:
bool m_blockSignals;
Ui::PrintDialogPanel m_panel;
-#if QT_VERSION >= 0x050300
QPageLayout m_pageLayout;
-#else
- QPrinter m_printerLayout;
- QPrinter::Unit m_units;
-#endif
QScopedPointer<QPrinter> m_printer;
};