diff --git a/dist/changes-5.0.0 b/dist/changes-5.0.0 index 1775a4c556..d21fff1f7c 100644 --- a/dist/changes-5.0.0 +++ b/dist/changes-5.0.0 @@ -276,6 +276,9 @@ information about a particular change. QColorDialog::setCustomColor() and QColorDialog::setStandardColor() now take a QColor value for their second parameter instead of QRgb. +- QPageSetupDialog has had the PageSetupDialogOption enum and the api to + set and get the enum removed as none of the Options are used any more. + **************************************************************************** * General * **************************************************************************** diff --git a/src/printsupport/dialogs/qabstractpagesetupdialog.cpp b/src/printsupport/dialogs/qabstractpagesetupdialog.cpp index 7406c820ac..0bf31c6b45 100644 --- a/src/printsupport/dialogs/qabstractpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qabstractpagesetupdialog.cpp @@ -84,7 +84,7 @@ QAbstractPageSetupDialog::QAbstractPageSetupDialog(QAbstractPageSetupDialogPriva QAbstractPageSetupDialog::~QAbstractPageSetupDialog() { Q_D(QAbstractPageSetupDialog); - if (d->opts & QPageSetupDialog::OwnsPrinter) + if (d->ownsPrinter) delete d->printer; } @@ -101,9 +101,10 @@ void QAbstractPageSetupDialogPrivate::setPrinter(QPrinter *newPrinter) { if (newPrinter) { printer = newPrinter; + ownsPrinter = false; } else { printer = new QPrinter; - opts |= QPageSetupDialog::OwnsPrinter; + ownsPrinter = true; } #ifndef Q_WS_X11 if (printer->outputFormat() != QPrinter::NativeFormat) diff --git a/src/printsupport/dialogs/qabstractpagesetupdialog_p.h b/src/printsupport/dialogs/qabstractpagesetupdialog_p.h index c8cc7d66e1..565b03185e 100644 --- a/src/printsupport/dialogs/qabstractpagesetupdialog_p.h +++ b/src/printsupport/dialogs/qabstractpagesetupdialog_p.h @@ -71,12 +71,12 @@ class QAbstractPageSetupDialogPrivate : public QDialogPrivate Q_DECLARE_PUBLIC(QAbstractPageSetupDialog) public: - QAbstractPageSetupDialogPrivate() : printer(0) {} + QAbstractPageSetupDialogPrivate() : printer(0), ownsPrinter(false) {} void setPrinter(QPrinter *newPrinter); QPrinter *printer; - QPageSetupDialog::PageSetupDialogOptions opts; + bool ownsPrinter; QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; }; diff --git a/src/printsupport/dialogs/qpagesetupdialog.cpp b/src/printsupport/dialogs/qpagesetupdialog.cpp index 53b304df9e..3c3362c550 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog.cpp @@ -97,118 +97,6 @@ class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate { }; -/*! - \enum QPageSetupDialog::PageSetupDialogOption - \since 4.4 - - Used to specify options to the page setup dialog - - This value is obsolete and does nothing since Qt 4.5: - - \value DontUseSheet In previous versions of QDialog::exec() the - page setup dialog would create a sheet by default if the dialog - was given a parent. This is no longer supported from Qt 4.5. If - you want to use sheets, use QPageSetupDialog::open() instead. - - \omitvalue None - \omitvalue OwnsPrinter -*/ - -/*! - Sets the given \a option to be enabled if \a on is true; - otherwise, clears the given \a option. - - \sa options, testOption() -*/ -void QPageSetupDialog::setOption(PageSetupDialogOption option, bool on) -{ - Q_D(QPageSetupDialog); - if (!(d->opts & option) != !on) - setOptions(d->opts ^ option); -} - -/*! - Returns true if the given \a option is enabled; otherwise, returns - false. - - \sa options, setOption() -*/ -bool QPageSetupDialog::testOption(PageSetupDialogOption option) const -{ - Q_D(const QPageSetupDialog); - return (d->opts & option) != 0; -} - -/*! - \property QPageSetupDialog::options - \brief the various options that affect the look and feel of the dialog - \since 4.5 - - By default, all options are disabled. - - Options should be set before showing the dialog. Setting them while the - dialog is visible is not guaranteed to have an immediate effect on the - dialog (depending on the option and on the platform). - - \sa setOption(), testOption() -*/ -void QPageSetupDialog::setOptions(PageSetupDialogOptions options) -{ - Q_D(QPageSetupDialog); - - PageSetupDialogOptions changed = (options ^ d->opts); - if (!changed) - return; - - d->opts = options; -} - -QPageSetupDialog::PageSetupDialogOptions QPageSetupDialog::options() const -{ - Q_D(const QPageSetupDialog); - return d->opts; -} - -/*! - \obsolete - - Use setOption(\a option, true) instead. -*/ -void QPageSetupDialog::addEnabledOption(PageSetupDialogOption option) -{ - setOption(option, true); -} - -/*! - \obsolete - - Use setOptions(\a options) instead. -*/ -void QPageSetupDialog::setEnabledOptions(PageSetupDialogOptions options) -{ - setOptions(options); -} - -/*! - \obsolete - - Use options() instead. -*/ -QPageSetupDialog::PageSetupDialogOptions QPageSetupDialog::enabledOptions() const -{ - return options(); -} - -/*! - \obsolete - - Use testOption(\a option) instead. -*/ -bool QPageSetupDialog::isOptionEnabled(PageSetupDialogOption option) const -{ - return testOption(option); -} - /*! \overload \since 4.5 diff --git a/src/printsupport/dialogs/qpagesetupdialog.h b/src/printsupport/dialogs/qpagesetupdialog.h index 466550b28b..c17008150f 100644 --- a/src/printsupport/dialogs/qpagesetupdialog.h +++ b/src/printsupport/dialogs/qpagesetupdialog.h @@ -57,32 +57,11 @@ class Q_PRINTSUPPORT_EXPORT QPageSetupDialog : public QAbstractPageSetupDialog { Q_OBJECT Q_DECLARE_PRIVATE(QPageSetupDialog) - Q_ENUMS(PageSetupDialogOption) - Q_PROPERTY(PageSetupDialogOptions options READ options WRITE setOptions) public: - enum PageSetupDialogOption { - None = 0x00000000, // internal - DontUseSheet = 0x00000001, - OwnsPrinter = 0x80000000 // internal - }; - - Q_DECLARE_FLAGS(PageSetupDialogOptions, PageSetupDialogOption) - explicit QPageSetupDialog(QPrinter *printer, QWidget *parent = 0); explicit QPageSetupDialog(QWidget *parent = 0); - // obsolete - void addEnabledOption(PageSetupDialogOption option); - void setEnabledOptions(PageSetupDialogOptions options); - PageSetupDialogOptions enabledOptions() const; - bool isOptionEnabled(PageSetupDialogOption option) const; - - void setOption(PageSetupDialogOption option, bool on = true); - bool testOption(PageSetupDialogOption option) const; - void setOptions(PageSetupDialogOptions options); - PageSetupDialogOptions options() const; - #if defined(Q_OS_MAC) || defined(Q_OS_WIN) virtual void setVisible(bool visible); #endif