Fix compilation of the manual dialogs test with Qt 4.

This is useful for comparisons and bug fixes.

Change-Id: Ib5c5bcb7df4b15779be0b613782206f052c94430
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
This commit is contained in:
Friedemann Kleint 2013-11-01 16:05:39 +01:00 committed by The Qt Project
parent 59569fd020
commit dd5f1ab454
3 changed files with 16 additions and 0 deletions

View File

@ -355,6 +355,7 @@ 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)),
@ -367,6 +368,7 @@ void FileDialogPanel::getOpenFileUrls()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
}
#endif // Qt 5
}
void FileDialogPanel::getOpenFileName()
@ -386,6 +388,7 @@ 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)),
@ -398,6 +401,7 @@ void FileDialogPanel::getOpenFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
}
#endif // Qt 5
}
void FileDialogPanel::getSaveFileName()
@ -417,6 +421,7 @@ 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)),
@ -429,6 +434,7 @@ void FileDialogPanel::getSaveFileUrl()
<< "\nName filter: " << selectedFilter;
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
}
#endif // Qt 5
}
void FileDialogPanel::getExistingDirectory()
@ -442,12 +448,14 @@ 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)),
QUrl(m_directory->text()), options() | QFileDialog::ShowDirsOnly,
allowedSchemes());
if (!dir.isEmpty())
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
#endif // Qt 5
}
void FileDialogPanel::restoreDefaults()
@ -493,9 +501,11 @@ 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);

View File

@ -209,10 +209,12 @@ 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());

View File

@ -149,9 +149,11 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
if (box.standardButtons() == (QMessageBox::StandardButtons) 0)
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());
}
@ -176,12 +178,14 @@ 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()