mirror of https://github.com/qt/qtbase.git
Remove private classes in QEvent-derived classes.
QEventPrivate doesn't exist, so these classes were technically abusing the d pointer. Move the contents of the private classes into the main event classes. Change-Id: If2e894c1fa05f468221a0b43f3ebdf90769298eb Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
275945f144
commit
a3f90fd44f
|
@ -2787,19 +2787,14 @@ QShowEvent::~QShowEvent()
|
|||
\note This class is currently supported for Mac OS X only.
|
||||
*/
|
||||
|
||||
QFileOpenEventPrivate::~QFileOpenEventPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
|
||||
Constructs a file open event for the given \a file.
|
||||
*/
|
||||
QFileOpenEvent::QFileOpenEvent(const QString &file)
|
||||
: QEvent(FileOpen), f(file)
|
||||
: QEvent(FileOpen), f(file), m_url(QUrl::fromLocalFile(file))
|
||||
{
|
||||
d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(QUrl::fromLocalFile(file)));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2808,10 +2803,8 @@ QFileOpenEvent::QFileOpenEvent(const QString &file)
|
|||
Constructs a file open event for the given \a url.
|
||||
*/
|
||||
QFileOpenEvent::QFileOpenEvent(const QUrl &url)
|
||||
: QEvent(FileOpen)
|
||||
: QEvent(FileOpen), f(url.toLocalFile()), m_url(url)
|
||||
{
|
||||
d = reinterpret_cast<QEventPrivate *>(new QFileOpenEventPrivate(url));
|
||||
f = url.toLocalFile();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2819,7 +2812,6 @@ QFileOpenEvent::QFileOpenEvent(const QUrl &url)
|
|||
*/
|
||||
QFileOpenEvent::~QFileOpenEvent()
|
||||
{
|
||||
delete reinterpret_cast<QFileOpenEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -2835,10 +2827,6 @@ QFileOpenEvent::~QFileOpenEvent()
|
|||
|
||||
\since 4.6
|
||||
*/
|
||||
QUrl QFileOpenEvent::url() const
|
||||
{
|
||||
return reinterpret_cast<const QFileOpenEventPrivate *>(d)->url;
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
|
||||
|
@ -4065,10 +4053,8 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
|
|||
The \a startPos is the position of a touch or mouse event that started the scrolling.
|
||||
*/
|
||||
QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos)
|
||||
: QEvent(QEvent::ScrollPrepare)
|
||||
: QEvent(QEvent::ScrollPrepare), m_target(0), m_startPos(startPos)
|
||||
{
|
||||
d = reinterpret_cast<QEventPrivate *>(new QScrollPrepareEventPrivate());
|
||||
d_func()->startPos = startPos;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4076,7 +4062,6 @@ QScrollPrepareEvent::QScrollPrepareEvent(const QPointF &startPos)
|
|||
*/
|
||||
QScrollPrepareEvent::~QScrollPrepareEvent()
|
||||
{
|
||||
delete reinterpret_cast<QScrollPrepareEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4084,7 +4069,7 @@ QScrollPrepareEvent::~QScrollPrepareEvent()
|
|||
*/
|
||||
QPointF QScrollPrepareEvent::startPos() const
|
||||
{
|
||||
return d_func()->startPos;
|
||||
return m_startPos;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4094,7 +4079,7 @@ QPointF QScrollPrepareEvent::startPos() const
|
|||
*/
|
||||
QSizeF QScrollPrepareEvent::viewportSize() const
|
||||
{
|
||||
return d_func()->viewportSize;
|
||||
return m_viewportSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4102,7 +4087,7 @@ QSizeF QScrollPrepareEvent::viewportSize() const
|
|||
*/
|
||||
QRectF QScrollPrepareEvent::contentPosRange() const
|
||||
{
|
||||
return d_func()->contentPosRange;
|
||||
return m_contentPosRange;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4110,7 +4095,7 @@ QRectF QScrollPrepareEvent::contentPosRange() const
|
|||
*/
|
||||
QPointF QScrollPrepareEvent::contentPos() const
|
||||
{
|
||||
return d_func()->contentPos;
|
||||
return m_contentPos;
|
||||
}
|
||||
|
||||
|
||||
|
@ -4121,7 +4106,7 @@ QPointF QScrollPrepareEvent::contentPos() const
|
|||
*/
|
||||
void QScrollPrepareEvent::setViewportSize(const QSizeF &size)
|
||||
{
|
||||
d_func()->viewportSize = size;
|
||||
m_viewportSize = size;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4131,7 +4116,7 @@ void QScrollPrepareEvent::setViewportSize(const QSizeF &size)
|
|||
*/
|
||||
void QScrollPrepareEvent::setContentPosRange(const QRectF &rect)
|
||||
{
|
||||
d_func()->contentPosRange = rect;
|
||||
m_contentPosRange = rect;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4141,26 +4126,10 @@ void QScrollPrepareEvent::setContentPosRange(const QRectF &rect)
|
|||
*/
|
||||
void QScrollPrepareEvent::setContentPos(const QPointF &pos)
|
||||
{
|
||||
d_func()->contentPos = pos;
|
||||
m_contentPos = pos;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QScrollPrepareEventPrivate *QScrollPrepareEvent::d_func()
|
||||
{
|
||||
return reinterpret_cast<QScrollPrepareEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
const QScrollPrepareEventPrivate *QScrollPrepareEvent::d_func() const
|
||||
{
|
||||
return reinterpret_cast<const QScrollPrepareEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
\class QScrollEvent
|
||||
\since 4.8
|
||||
|
@ -4198,12 +4167,8 @@ const QScrollPrepareEventPrivate *QScrollPrepareEvent::d_func() const
|
|||
event is the first one, the last one or some event in between.
|
||||
*/
|
||||
QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDistance, ScrollState scrollState)
|
||||
: QEvent(QEvent::Scroll)
|
||||
: QEvent(QEvent::Scroll), m_contentPos(contentPos), m_overshoot(overshootDistance), m_state(scrollState)
|
||||
{
|
||||
d = reinterpret_cast<QEventPrivate *>(new QScrollEventPrivate());
|
||||
d_func()->contentPos = contentPos;
|
||||
d_func()->overshoot= overshootDistance;
|
||||
d_func()->state = scrollState;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4211,7 +4176,6 @@ QScrollEvent::QScrollEvent(const QPointF &contentPos, const QPointF &overshootDi
|
|||
*/
|
||||
QScrollEvent::~QScrollEvent()
|
||||
{
|
||||
delete reinterpret_cast<QScrollEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4219,7 +4183,7 @@ QScrollEvent::~QScrollEvent()
|
|||
*/
|
||||
QPointF QScrollEvent::contentPos() const
|
||||
{
|
||||
return d_func()->contentPos;
|
||||
return m_contentPos;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4230,7 +4194,7 @@ QPointF QScrollEvent::contentPos() const
|
|||
*/
|
||||
QPointF QScrollEvent::overshootDistance() const
|
||||
{
|
||||
return d_func()->overshoot;
|
||||
return m_overshoot;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4243,23 +4207,7 @@ QPointF QScrollEvent::overshootDistance() const
|
|||
*/
|
||||
QScrollEvent::ScrollState QScrollEvent::scrollState() const
|
||||
{
|
||||
return d_func()->state;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QScrollEventPrivate *QScrollEvent::d_func()
|
||||
{
|
||||
return reinterpret_cast<QScrollEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
const QScrollEventPrivate *QScrollEvent::d_func() const
|
||||
{
|
||||
return reinterpret_cast<const QScrollEventPrivate *>(d);
|
||||
return m_state;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4267,11 +4215,8 @@ const QScrollEventPrivate *QScrollEvent::d_func() const
|
|||
\a orientation is the new orientation of the screen.
|
||||
*/
|
||||
QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt::ScreenOrientation screenOrientation)
|
||||
: QEvent(QEvent::OrientationChange)
|
||||
: QEvent(QEvent::OrientationChange), m_screen(screen), m_orientation(screenOrientation)
|
||||
{
|
||||
d = reinterpret_cast<QEventPrivate *>(new QScreenOrientationChangeEventPrivate());
|
||||
d_func()->screen = screen;
|
||||
d_func()->orientation = screenOrientation;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4279,7 +4224,6 @@ QScreenOrientationChangeEvent::QScreenOrientationChangeEvent(QScreen *screen, Qt
|
|||
*/
|
||||
QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent()
|
||||
{
|
||||
delete reinterpret_cast<QScrollEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4287,7 +4231,7 @@ QScreenOrientationChangeEvent::~QScreenOrientationChangeEvent()
|
|||
*/
|
||||
QScreen *QScreenOrientationChangeEvent::screen() const
|
||||
{
|
||||
return d_func()->screen;
|
||||
return m_screen;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -4295,23 +4239,7 @@ QScreen *QScreenOrientationChangeEvent::screen() const
|
|||
*/
|
||||
Qt::ScreenOrientation QScreenOrientationChangeEvent::orientation() const
|
||||
{
|
||||
return d_func()->orientation;
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
QScreenOrientationChangeEventPrivate *QScreenOrientationChangeEvent::d_func()
|
||||
{
|
||||
return reinterpret_cast<QScreenOrientationChangeEventPrivate *>(d);
|
||||
}
|
||||
|
||||
/*!
|
||||
\internal
|
||||
*/
|
||||
const QScreenOrientationChangeEventPrivate *QScreenOrientationChangeEvent::d_func() const
|
||||
{
|
||||
return reinterpret_cast<const QScreenOrientationChangeEventPrivate *>(d);
|
||||
return m_orientation;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qvector.h>
|
||||
#include <QtCore/qset.h>
|
||||
#include <QtCore/qurl.h>
|
||||
#include <QtCore/qfile.h>
|
||||
#include <QtGui/qvector2d.h>
|
||||
#include <QtGui/qtouchdevice.h>
|
||||
|
@ -646,10 +647,11 @@ public:
|
|||
~QFileOpenEvent();
|
||||
|
||||
inline QString file() const { return f; }
|
||||
QUrl url() const;
|
||||
QUrl url() const { return m_url; }
|
||||
bool openFile(QFile &file, QIODevice::OpenMode flags) const;
|
||||
private:
|
||||
QString f;
|
||||
QUrl m_url;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_TOOLBAR
|
||||
|
@ -847,7 +849,6 @@ protected:
|
|||
Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
|
||||
|
||||
class QScrollPrepareEventPrivate;
|
||||
class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
|
@ -865,12 +866,14 @@ public:
|
|||
void setContentPos(const QPointF &pos);
|
||||
|
||||
private:
|
||||
QScrollPrepareEventPrivate *d_func();
|
||||
const QScrollPrepareEventPrivate *d_func() const;
|
||||
QObject* m_target;
|
||||
QPointF m_startPos;
|
||||
QSizeF m_viewportSize;
|
||||
QRectF m_contentPosRange;
|
||||
QPointF m_contentPos;
|
||||
};
|
||||
|
||||
|
||||
class QScrollEventPrivate;
|
||||
class Q_GUI_EXPORT QScrollEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
|
@ -889,11 +892,11 @@ public:
|
|||
ScrollState scrollState() const;
|
||||
|
||||
private:
|
||||
QScrollEventPrivate *d_func();
|
||||
const QScrollEventPrivate *d_func() const;
|
||||
QPointF m_contentPos;
|
||||
QPointF m_overshoot;
|
||||
QScrollEvent::ScrollState m_state;
|
||||
};
|
||||
|
||||
class QScreenOrientationChangeEventPrivate;
|
||||
class Q_GUI_EXPORT QScreenOrientationChangeEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
|
@ -904,8 +907,8 @@ public:
|
|||
Qt::ScreenOrientation orientation() const;
|
||||
|
||||
private:
|
||||
QScreenOrientationChangeEventPrivate *d_func();
|
||||
const QScreenOrientationChangeEventPrivate *d_func() const;
|
||||
QScreen *m_screen;
|
||||
Qt::ScreenOrientation m_orientation;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -92,57 +92,6 @@ public:
|
|||
QVector<QPointF> rawScreenPositions;
|
||||
};
|
||||
|
||||
class QFileOpenEventPrivate
|
||||
{
|
||||
public:
|
||||
inline QFileOpenEventPrivate(const QUrl &url)
|
||||
: url(url)
|
||||
{
|
||||
}
|
||||
~QFileOpenEventPrivate();
|
||||
|
||||
QUrl url;
|
||||
};
|
||||
|
||||
|
||||
class QScrollPrepareEventPrivate
|
||||
{
|
||||
public:
|
||||
inline QScrollPrepareEventPrivate()
|
||||
: target(0)
|
||||
{
|
||||
}
|
||||
|
||||
QObject* target;
|
||||
QPointF startPos;
|
||||
QSizeF viewportSize;
|
||||
QRectF contentPosRange;
|
||||
QPointF contentPos;
|
||||
};
|
||||
|
||||
class QScrollEventPrivate
|
||||
{
|
||||
public:
|
||||
inline QScrollEventPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
QPointF contentPos;
|
||||
QPointF overshoot;
|
||||
QScrollEvent::ScrollState state;
|
||||
};
|
||||
|
||||
class QScreenOrientationChangeEventPrivate
|
||||
{
|
||||
public:
|
||||
inline QScreenOrientationChangeEventPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
QScreen *screen;
|
||||
Qt::ScreenOrientation orientation;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QEVENT_P_H
|
||||
|
|
Loading…
Reference in New Issue