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:
parent
59569fd020
commit
dd5f1ab454
@ -355,6 +355,7 @@ void FileDialogPanel::getOpenFileNames()
|
|||||||
|
|
||||||
void FileDialogPanel::getOpenFileUrls()
|
void FileDialogPanel::getOpenFileUrls()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
||||||
const QList<QUrl> files =
|
const QList<QUrl> files =
|
||||||
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getOpenFileUrls(this, tr("getOpenFileNames Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
@ -367,6 +368,7 @@ void FileDialogPanel::getOpenFileUrls()
|
|||||||
<< "\nName filter: " << selectedFilter;
|
<< "\nName filter: " << selectedFilter;
|
||||||
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
|
QMessageBox::information(this, tr("getOpenFileNames"), result, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
#endif // Qt 5
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::getOpenFileName()
|
void FileDialogPanel::getOpenFileName()
|
||||||
@ -386,6 +388,7 @@ void FileDialogPanel::getOpenFileName()
|
|||||||
|
|
||||||
void FileDialogPanel::getOpenFileUrl()
|
void FileDialogPanel::getOpenFileUrl()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
||||||
const QUrl file =
|
const QUrl file =
|
||||||
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getOpenFileUrl(this, tr("getOpenFileUrl Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
@ -398,6 +401,7 @@ void FileDialogPanel::getOpenFileUrl()
|
|||||||
<< "\nName filter: " << selectedFilter;
|
<< "\nName filter: " << selectedFilter;
|
||||||
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
|
QMessageBox::information(this, tr("getOpenFileName"), result, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
#endif // Qt 5
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::getSaveFileName()
|
void FileDialogPanel::getSaveFileName()
|
||||||
@ -417,6 +421,7 @@ void FileDialogPanel::getSaveFileName()
|
|||||||
|
|
||||||
void FileDialogPanel::getSaveFileUrl()
|
void FileDialogPanel::getSaveFileUrl()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
QString selectedFilter = m_selectedNameFilter->text().trimmed();
|
||||||
const QUrl file =
|
const QUrl file =
|
||||||
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getSaveFileUrl(this, tr("getSaveFileName Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
@ -429,6 +434,7 @@ void FileDialogPanel::getSaveFileUrl()
|
|||||||
<< "\nName filter: " << selectedFilter;
|
<< "\nName filter: " << selectedFilter;
|
||||||
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
|
QMessageBox::information(this, tr("getSaveFileNames"), result, QMessageBox::Ok);
|
||||||
}
|
}
|
||||||
|
#endif // Qt 5
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::getExistingDirectory()
|
void FileDialogPanel::getExistingDirectory()
|
||||||
@ -442,12 +448,14 @@ void FileDialogPanel::getExistingDirectory()
|
|||||||
|
|
||||||
void FileDialogPanel::getExistingDirectoryUrl()
|
void FileDialogPanel::getExistingDirectoryUrl()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
const QUrl dir =
|
const QUrl dir =
|
||||||
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
QFileDialog::getExistingDirectoryUrl(this, tr("getExistingDirectory Qt %1").arg(QLatin1String(QT_VERSION_STR)),
|
||||||
QUrl(m_directory->text()), options() | QFileDialog::ShowDirsOnly,
|
QUrl(m_directory->text()), options() | QFileDialog::ShowDirsOnly,
|
||||||
allowedSchemes());
|
allowedSchemes());
|
||||||
if (!dir.isEmpty())
|
if (!dir.isEmpty())
|
||||||
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
|
QMessageBox::information(this, tr("getExistingDirectory"), QLatin1String("Directory: ") + dir.toString(), QMessageBox::Ok);
|
||||||
|
#endif // Qt 5
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogPanel::restoreDefaults()
|
void FileDialogPanel::restoreDefaults()
|
||||||
@ -493,9 +501,11 @@ void FileDialogPanel::applySettings(QFileDialog *d) const
|
|||||||
if (!filter.isEmpty())
|
if (!filter.isEmpty())
|
||||||
d->selectNameFilter(filter);
|
d->selectNameFilter(filter);
|
||||||
} else {
|
} else {
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
d->setMimeTypeFilters(filters);
|
d->setMimeTypeFilters(filters);
|
||||||
if (!filter.isEmpty())
|
if (!filter.isEmpty())
|
||||||
d->selectMimeTypeFilter(filter);
|
d->selectMimeTypeFilter(filter);
|
||||||
|
#endif // Qt 5
|
||||||
}
|
}
|
||||||
foreach (LabelLineEdit *l, m_labelLineEdits)
|
foreach (LabelLineEdit *l, m_labelLineEdits)
|
||||||
l->apply(d);
|
l->apply(d);
|
||||||
|
@ -209,10 +209,12 @@ void FontDialogPanel::applySettings(QFontDialog *d) const
|
|||||||
{
|
{
|
||||||
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
|
d->setOption(QFontDialog::NoButtons, m_noButtons->isChecked());
|
||||||
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
|
d->setOption(QFontDialog::DontUseNativeDialog, m_dontUseNativeDialog->isChecked());
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
|
d->setOption(QFontDialog::ScalableFonts, m_scalableFilter->isChecked());
|
||||||
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
|
d->setOption(QFontDialog::NonScalableFonts, m_nonScalableFilter->isChecked());
|
||||||
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
|
d->setOption(QFontDialog::MonospacedFonts, m_monospacedFilter->isChecked());
|
||||||
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
|
d->setOption(QFontDialog::ProportionalFonts, m_proportionalFilter->isChecked());
|
||||||
|
#endif // Qt 5
|
||||||
|
|
||||||
QFont font = m_fontFamilyBox->currentFont();
|
QFont font = m_fontFamilyBox->currentFont();
|
||||||
font.setPointSizeF(m_fontSizeBox->value());
|
font.setPointSizeF(m_fontSizeBox->value());
|
||||||
|
@ -149,9 +149,11 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
|
|||||||
if (box.standardButtons() == (QMessageBox::StandardButtons) 0)
|
if (box.standardButtons() == (QMessageBox::StandardButtons) 0)
|
||||||
box.setStandardButtons(QMessageBox::Ok); // just to have something.
|
box.setStandardButtons(QMessageBox::Ok); // just to have something.
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
box.setCheckBox(0);
|
box.setCheckBox(0);
|
||||||
if (m_checkboxText->text().length() > 0)
|
if (m_checkboxText->text().length() > 0)
|
||||||
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
|
box.setCheckBox(new QCheckBox(m_checkboxText->text()));
|
||||||
|
#endif // Qt 5
|
||||||
|
|
||||||
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
|
box.setIcon((QMessageBox::Icon) m_iconComboBox->currentIndex());
|
||||||
}
|
}
|
||||||
@ -176,12 +178,14 @@ void MessageBoxPanel::doExec()
|
|||||||
QString sres;
|
QString sres;
|
||||||
sres.setNum(res, 16);
|
sres.setNum(res, 16);
|
||||||
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
|
m_resultLabel->setText(QString::fromLatin1("Return value (hex): %1").arg(sres));
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
if (m_msgbox->checkBox()) {
|
if (m_msgbox->checkBox()) {
|
||||||
if (m_msgbox->checkBox()->isChecked())
|
if (m_msgbox->checkBox()->isChecked())
|
||||||
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
|
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was checked"));
|
||||||
else
|
else
|
||||||
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
|
m_checkBoxResult->setText(QString::fromLatin1("Checkbox was not checked"));
|
||||||
}
|
}
|
||||||
|
#endif // Qt 5
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageBoxPanel::doShowApply()
|
void MessageBoxPanel::doShowApply()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user