summaryrefslogtreecommitdiffstats
path: root/src/printsupport/dialogs
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2019-12-06 13:19:37 +0100
committerOlivier Goffart <ogoffart@woboq.com>2019-12-15 12:30:52 +0100
commitd6266c757d2f2ea4ff1e71dc8545f9bf97aa3bb1 (patch)
tree37fff2c5d030728d65072b0d036b7e78fde058a5 /src/printsupport/dialogs
parent127533637e4ff4d3301fe02c88a2a506dd24c199 (diff)
Replace usages of QVariant::value by qvariant_cast
This is done automatically with a clazy check Change-Id: I3b59511d3d36d416c8eda74858ead611d327b116 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/printsupport/dialogs')
-rw-r--r--src/printsupport/dialogs/qpagesetupdialog_unix.cpp14
-rw-r--r--src/printsupport/dialogs/qprintdialog_unix.cpp18
2 files changed, 16 insertions, 16 deletions
diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
index ab7a2edb67..78e5b8d1ef 100644
--- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
+++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp
@@ -533,10 +533,10 @@ void QPageSetupWidget::setupPrinter() const
{
m_printer->setPageLayout(m_pageLayout);
#if QT_CONFIG(cups)
- QCUPSSupport::PagesPerSheet pagesPerSheet = m_ui.pagesPerSheetCombo->currentData()
- .value<QCUPSSupport::PagesPerSheet>();
- QCUPSSupport::PagesPerSheetLayout pagesPerSheetLayout = m_ui.pagesPerSheetLayoutCombo->currentData()
- .value<QCUPSSupport::PagesPerSheetLayout>();
+ QCUPSSupport::PagesPerSheet pagesPerSheet = qvariant_cast<QCUPSSupport::PagesPerSheet>(m_ui.pagesPerSheetCombo->currentData()
+);
+ QCUPSSupport::PagesPerSheetLayout pagesPerSheetLayout = qvariant_cast<QCUPSSupport::PagesPerSheetLayout>(m_ui.pagesPerSheetLayoutCombo->currentData()
+);
QCUPSSupport::setPagesPerSheetLayout(m_printer, pagesPerSheet, pagesPerSheetLayout);
#endif
#ifdef PSD_ENABLE_PAPERSOURCE
@@ -587,11 +587,11 @@ void QPageSetupWidget::pageSizeChanged()
{
QPageSize pageSize;
if (m_ui.pageSizeCombo->currentIndex() != m_realCustomPageSizeIndex) {
- pageSize = m_ui.pageSizeCombo->currentData().value<QPageSize>();
+ pageSize = qvariant_cast<QPageSize>(m_ui.pageSizeCombo->currentData());
#if QT_CONFIG(cups)
if (m_pageSizePpdOption) {
- ppd_file_t *ppd = m_printDevice->property(PDPK_PpdFile).value<ppd_file_t*>();
+ ppd_file_t *ppd = qvariant_cast<ppd_file_t*>(m_printDevice->property(PDPK_PpdFile));
QTextCodec *cupsCodec = QTextCodec::codecForName(ppd->lang_encoding);
for (int i = 0; i < m_pageSizePpdOption->num_choices; ++i) {
const ppd_choice_t *choice = &m_pageSizePpdOption->choices[i];
@@ -676,7 +676,7 @@ void QPageSetupWidget::unitChanged()
{
if (m_blockSignals)
return;
- m_units = m_ui.unitCombo->currentData().value<QPageLayout::Unit>();
+ m_units = qvariant_cast<QPageLayout::Unit>(m_ui.unitCombo->currentData());
m_pageLayout.setUnits(m_units);
updateWidget();
}
diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp
index d929367557..bf1633930c 100644
--- a/src/printsupport/dialogs/qprintdialog_unix.cpp
+++ b/src/printsupport/dialogs/qprintdialog_unix.cpp
@@ -426,7 +426,7 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget()
{
bool anyWidgetCreated = false;
- ppd_file_t *ppd = m_currentPrintDevice->property(PDPK_PpdFile).value<ppd_file_t*>();
+ ppd_file_t *ppd = qvariant_cast<ppd_file_t*>(m_currentPrintDevice->property(PDPK_PpdFile));
if (ppd) {
m_cupsCodec = QTextCodec::codecForName(ppd->lang_encoding);
@@ -532,7 +532,7 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget()
void QPrintPropertiesDialog::setPrinterAdvancedCupsOptions() const
{
for (const QComboBox *choicesCb : m_advancedOptionsCombos) {
- const ppd_option_t *option = choicesCb->property(ppdOptionProperty).value<const ppd_option_t *>();
+ const ppd_option_t *option = qvariant_cast<const ppd_option_t *>(choicesCb->property(ppdOptionProperty));
// We can't use choicesCb->currentIndex() to know the index of the option in the choices[] array
// because some of them may not be present in the list because they conflict with the
@@ -551,7 +551,7 @@ void QPrintPropertiesDialog::setPrinterAdvancedCupsOptions() const
void QPrintPropertiesDialog::revertAdvancedOptionsToSavedValues() const
{
for (QComboBox *choicesCb : m_advancedOptionsCombos) {
- const int originallySelectedChoice = choicesCb->property(ppdOriginallySelectedChoiceProperty).value<int>();
+ const int originallySelectedChoice = qvariant_cast<int>(choicesCb->property(ppdOriginallySelectedChoiceProperty));
const int newComboIndexToSelect = choicesCb->findData(originallySelectedChoice);
choicesCb->setCurrentIndex(newComboIndexToSelect);
// The currentIndexChanged lambda takes care of resetting the ppd option
@@ -580,8 +580,8 @@ bool QPrintPropertiesDialog::anyAdvancedOptionConflict() const
bool anyConflicted = false;
for (const QComboBox *choicesCb : m_advancedOptionsCombos) {
- const ppd_option_t *option = choicesCb->property(ppdOptionProperty).value<const ppd_option_t *>();
- QLabel *warningLabel = choicesCb->property(warningLabelProperty).value<QLabel *>();
+ const ppd_option_t *option = qvariant_cast<const ppd_option_t *>(choicesCb->property(ppdOptionProperty));
+ QLabel *warningLabel = qvariant_cast<QLabel *>(choicesCb->property(warningLabelProperty));
if (option->conflicted) {
anyConflicted = true;
const int pixmap_size = choicesCb->sizeHint().height() * .75;
@@ -900,7 +900,7 @@ void QPrintDialogPrivate::setupPrinter()
// page set
if (p->printRange() == QPrinter::AllPages || p->printRange() == QPrinter::PageRange) {
//If the application is selecting pages and the first page number is even then need to adjust the odd-even accordingly
- QCUPSSupport::PageSet pageSet = options.pageSetCombo->itemData(options.pageSetCombo->currentIndex()).value<QCUPSSupport::PageSet>();
+ QCUPSSupport::PageSet pageSet = qvariant_cast<QCUPSSupport::PageSet>(options.pageSetCombo->itemData(options.pageSetCombo->currentIndex()));
if (q->isOptionEnabled(QPrintDialog::PrintPageRange)
&& p->printRange() == QPrinter::PageRange
&& (q->fromPage() % 2 == 0)) {
@@ -1323,10 +1323,10 @@ bool QUnixPrintWidgetPrivate::checkFields()
#if QT_CONFIG(cups)
if (propertiesDialog) {
- QCUPSSupport::PagesPerSheet pagesPerSheet = propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo
- ->currentData().value<QCUPSSupport::PagesPerSheet>();
+ QCUPSSupport::PagesPerSheet pagesPerSheet = qvariant_cast<QCUPSSupport::PagesPerSheet>(propertiesDialog->widget.pageSetup->m_ui.pagesPerSheetCombo
+ ->currentData());
- QCUPSSupport::PageSet pageSet = optionsPane->options.pageSetCombo->currentData().value<QCUPSSupport::PageSet>();
+ QCUPSSupport::PageSet pageSet = qvariant_cast<QCUPSSupport::PageSet>(optionsPane->options.pageSetCombo->currentData());
if (pagesPerSheet != QCUPSSupport::OnePagePerSheet