From 2660aefdbc52c5f2ef1ec96216c7ab82aa0c7324 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 25 Apr 2018 21:46:02 -0700 Subject: Remove hack that violates ODR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC with LTO sees through our hack: qprintdialog_unix.cpp:212:7: warning: type ‘struct QPrintDialogPrivate’ violates the C++ One Definition Rule [-Wodr] qabstractprintdialog.cpp:49:7: note: a different type is defined in another translation unit This hack was there so that the QPrintDialog functions in qabstractprintdialog.cpp could use the d pointer. So instead of hacking around the issue, just use the class that this file has access to: QAbstractPrintDialogPrivate. Change-Id: I3840d727dee443318644fffd1528e2e8b814e983 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/printsupport/dialogs/qabstractprintdialog.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'src/printsupport') diff --git a/src/printsupport/dialogs/qabstractprintdialog.cpp b/src/printsupport/dialogs/qabstractprintdialog.cpp index 71b5500bab..1a2aa7afac 100644 --- a/src/printsupport/dialogs/qabstractprintdialog.cpp +++ b/src/printsupport/dialogs/qabstractprintdialog.cpp @@ -45,11 +45,6 @@ QT_BEGIN_NAMESPACE -// hack -class QPrintDialogPrivate : public QAbstractPrintDialogPrivate -{ -}; - /*! \class QAbstractPrintDialog \brief The QAbstractPrintDialog class provides a base implementation for @@ -145,7 +140,7 @@ QAbstractPrintDialog::~QAbstractPrintDialog() */ void QPrintDialog::setOption(PrintDialogOption option, bool on) { - Q_D(QPrintDialog); + auto *d = static_cast(d_ptr.data()); if (!(d->options & option) != !on) setOptions(d->options ^ option); } @@ -158,7 +153,7 @@ void QPrintDialog::setOption(PrintDialogOption option, bool on) */ bool QPrintDialog::testOption(PrintDialogOption option) const { - Q_D(const QPrintDialog); + auto *d = static_cast(d_ptr.data()); return (d->options & option) != 0; } @@ -177,7 +172,7 @@ bool QPrintDialog::testOption(PrintDialogOption option) const */ void QPrintDialog::setOptions(PrintDialogOptions options) { - Q_D(QPrintDialog); + auto *d = static_cast(d_ptr.data()); PrintDialogOptions changed = (options ^ d->options); if (!changed) @@ -188,7 +183,7 @@ void QPrintDialog::setOptions(PrintDialogOptions options) QPrintDialog::PrintDialogOptions QPrintDialog::options() const { - Q_D(const QPrintDialog); + auto *d = static_cast(d_ptr.data()); return d->options; } @@ -464,7 +459,7 @@ void QAbstractPrintDialog::setOptionTabs(const QList &tabs) */ void QPrintDialog::done(int result) { - Q_D(QPrintDialog); + auto *d = static_cast(d_ptr.data()); QDialog::done(result); if (result == Accepted) emit accepted(printer()); @@ -487,7 +482,7 @@ void QPrintDialog::done(int result) */ void QPrintDialog::open(QObject *receiver, const char *member) { - Q_D(QPrintDialog); + auto *d = static_cast(d_ptr.data()); connect(this, SIGNAL(accepted(QPrinter*)), receiver, member); d->receiverToDisconnectOnClose = receiver; d->memberToDisconnectOnClose = member; -- cgit v1.2.3