Get rid of Qt4 virtual hooks

They have existed throughout Qt5, and no longer used by any
QIconEngine I am aware of.

Change-Id: Iab0a978be808a60fb82379467e294e2457056bae
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2020-09-11 13:05:19 +02:00
parent b79b75adf9
commit fce84f76f0
2 changed files with 5 additions and 73 deletions

View File

@ -154,16 +154,6 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
These enum values are used for virtual_hook() to allow additional These enum values are used for virtual_hook() to allow additional
queries to icon engine without breaking binary compatibility. queries to icon engine without breaking binary compatibility.
\value AvailableSizesHook Allows to query the sizes of the
contained pixmaps for pixmap-based engines. The \a data argument
of the virtual_hook() function is a AvailableSizesArgument pointer
that should be filled with icon sizes. Engines that work in terms
of a scalable, vectorial format normally return an empty list.
\value IconNameHook Allows to query the name used to create the
icon, for example when instantiating an icon using
QIcon::fromTheme().
\value IsNullHook Allow to query if this engine represents a null \value IsNullHook Allow to query if this engine represents a null
icon. The \a data argument of the virtual_hook() is a pointer to a icon. The \a data argument of the virtual_hook() is a pointer to a
bool that can be set to true if the icon is null. This enum value bool that can be set to true if the icon is null. This enum value
@ -178,41 +168,6 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
\sa virtual_hook() \sa virtual_hook()
*/ */
/*!
\class QIconEngine::AvailableSizesArgument
\since 4.5
\inmodule QtGui
This struct represents arguments to virtual_hook() function when
\a id parameter is QIconEngine::AvailableSizesHook.
\sa virtual_hook(), QIconEngine::IconEngineHook
*/
/*!
\variable QIconEngine::AvailableSizesArgument::mode
\brief the requested mode of an image.
\sa QIcon::Mode
*/
/*!
\variable QIconEngine::AvailableSizesArgument::state
\brief the requested state of an image.
\sa QIcon::State
*/
/*!
\variable QIconEngine::AvailableSizesArgument::sizes
\brief image sizes that are available with specified \a mode and
\a state. This is an output parameter and is filled after call to
virtual_hook(). Engines that work in terms of a scalable,
vectorial format normally return an empty list.
*/
/*! /*!
\class QIconEngine::ScaledPixmapArgument \class QIconEngine::ScaledPixmapArgument
\since 5.9 \since 5.9
@ -316,12 +271,6 @@ bool QIconEngine::write(QDataStream &) const
void QIconEngine::virtual_hook(int id, void *data) void QIconEngine::virtual_hook(int id, void *data)
{ {
switch (id) { switch (id) {
case QIconEngine::AvailableSizesHook: {
QIconEngine::AvailableSizesArgument &arg =
*reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
arg.sizes.clear();
break;
}
case QIconEngine::ScaledPixmapHook: { case QIconEngine::ScaledPixmapHook: {
// We don't have any notion of scale besides "@nx", so just call pixmap() here. // We don't have any notion of scale besides "@nx", so just call pixmap() here.
QIconEngine::ScaledPixmapArgument &arg = QIconEngine::ScaledPixmapArgument &arg =
@ -339,30 +288,20 @@ void QIconEngine::virtual_hook(int id, void *data)
Returns sizes of all images that are contained in the engine for the Returns sizes of all images that are contained in the engine for the
specific \a mode and \a state. specific \a mode and \a state.
\include qiconengine-virtualhookhelper.qdocinc
*/ */
QList<QSize> QIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state) QList<QSize> QIconEngine::availableSizes(QIcon::Mode /*mode*/, QIcon::State /*state*/)
{ {
AvailableSizesArgument arg; return {};
arg.mode = mode;
arg.state = state;
this->virtual_hook(QIconEngine::AvailableSizesHook, reinterpret_cast<void*>(&arg));
return arg.sizes;
} }
/*! /*!
\since 4.7 \since 4.7
Returns the name used to create the engine, if available. Returns the name used to create the engine, if available.
\include qiconengine-virtualhookhelper.qdocinc
*/ */
QString QIconEngine::iconName() QString QIconEngine::iconName()
{ {
QString name; return QString();
virtual_hook(QIconEngine::IconNameHook, reinterpret_cast<void*>(&name));
return name;
} }
/*! /*!

View File

@ -64,15 +64,6 @@ public:
virtual bool read(QDataStream &in); virtual bool read(QDataStream &in);
virtual bool write(QDataStream &out) const; virtual bool write(QDataStream &out) const;
enum IconEngineHook { AvailableSizesHook = 1, IconNameHook, IsNullHook, ScaledPixmapHook };
struct AvailableSizesArgument
{
QIcon::Mode mode;
QIcon::State state;
QList<QSize> sizes;
};
virtual QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal, virtual QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal,
QIcon::State state = QIcon::Off); QIcon::State state = QIcon::Off);
@ -80,6 +71,8 @@ public:
virtual bool isNull(); virtual bool isNull();
virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale); virtual QPixmap scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale);
enum IconEngineHook { IsNullHook = 3, ScaledPixmapHook };
struct ScaledPixmapArgument struct ScaledPixmapArgument
{ {
QSize size; QSize size;