diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2018-04-25 21:46:02 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2018-04-26 20:04:36 +0000 |
commit | 2660aefdbc52c5f2ef1ec96216c7ab82aa0c7324 (patch) | |
tree | a6aeaf2329476d3d5aafefff23ce0ad6d163edbb /src/printsupport/dialogs | |
parent | 26e3dfd4ab25f578a988703e693d7cd073277bd6 (diff) |
Remove hack that violates ODR
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) <ogoffart@woboq.com>
Diffstat (limited to 'src/printsupport/dialogs')
-rw-r--r-- | src/printsupport/dialogs/qabstractprintdialog.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
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<QAbstractPrintDialogPrivate *>(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<const QAbstractPrintDialogPrivate *>(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<QAbstractPrintDialogPrivate *>(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<const QAbstractPrintDialogPrivate *>(d_ptr.data()); return d->options; } @@ -464,7 +459,7 @@ void QAbstractPrintDialog::setOptionTabs(const QList<QWidget*> &tabs) */ void QPrintDialog::done(int result) { - Q_D(QPrintDialog); + auto *d = static_cast<QAbstractPrintDialogPrivate *>(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<QAbstractPrintDialogPrivate *>(d_ptr.data()); connect(this, SIGNAL(accepted(QPrinter*)), receiver, member); d->receiverToDisconnectOnClose = receiver; d->memberToDisconnectOnClose = member; |