SIC: QPrintSupport - Remove options api from QPageSetupDialog
QPageSetupDialog has an enum PageSetupDialogOption, however one option had support removed in Qt 4.5 and the remaining 2 are actually for an internal implementation detail that could lead to memory leaks if changed by an app. This change removes the enum and the api as they is now useless. Change-Id: I9a3ab689dcab57151de894db5ebf22f6ad90d71e Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>
This commit is contained in:
parent
88e735c9c9
commit
b9fc8bc10f
3
dist/changes-5.0.0
vendored
3
dist/changes-5.0.0
vendored
@ -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 *
|
||||
****************************************************************************
|
||||
|
@ -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)
|
||||
|
@ -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<QObject> receiverToDisconnectOnClose;
|
||||
QByteArray memberToDisconnectOnClose;
|
||||
};
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user