Remove unnecessary code in QCursor
Dont't checks before call QCursorData::initialize(). The inside of QCursorData::initialize() already checks initialized. Change-Id: I4b34218132df9decf7d04dcc31e873daf300ffe6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
parent
c94bed69b7
commit
518c98cea4
@ -439,8 +439,7 @@ QCursor::QCursor()
|
|||||||
QCursor::QCursor(Qt::CursorShape shape)
|
QCursor::QCursor(Qt::CursorShape shape)
|
||||||
: d(nullptr)
|
: d(nullptr)
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
setShape(shape);
|
setShape(shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,8 +497,7 @@ bool operator==(const QCursor &lhs, const QCursor &rhs) noexcept
|
|||||||
*/
|
*/
|
||||||
Qt::CursorShape QCursor::shape() const
|
Qt::CursorShape QCursor::shape() const
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
return d->cshape;
|
return d->cshape;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -512,8 +510,7 @@ Qt::CursorShape QCursor::shape() const
|
|||||||
*/
|
*/
|
||||||
void QCursor::setShape(Qt::CursorShape shape)
|
void QCursor::setShape(Qt::CursorShape shape)
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : nullptr;
|
QCursorData *c = uint(shape) <= Qt::LastCursor ? qt_cursorTable[shape] : nullptr;
|
||||||
if (!c)
|
if (!c)
|
||||||
c = qt_cursorTable[0];
|
c = qt_cursorTable[0];
|
||||||
@ -547,8 +544,7 @@ void QCursor::setShape(Qt::CursorShape shape)
|
|||||||
*/
|
*/
|
||||||
QBitmap QCursor::bitmap() const
|
QBitmap QCursor::bitmap() const
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
if (d->bm)
|
if (d->bm)
|
||||||
return *(d->bm);
|
return *(d->bm);
|
||||||
return QBitmap();
|
return QBitmap();
|
||||||
@ -574,8 +570,7 @@ QBitmap QCursor::bitmap() const
|
|||||||
*/
|
*/
|
||||||
QBitmap QCursor::mask() const
|
QBitmap QCursor::mask() const
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
if (d->bmm)
|
if (d->bmm)
|
||||||
return *(d->bmm);
|
return *(d->bmm);
|
||||||
return QBitmap();
|
return QBitmap();
|
||||||
@ -588,8 +583,7 @@ QBitmap QCursor::mask() const
|
|||||||
|
|
||||||
QPixmap QCursor::pixmap() const
|
QPixmap QCursor::pixmap() const
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
return d->pixmap;
|
return d->pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,8 +594,7 @@ QPixmap QCursor::pixmap() const
|
|||||||
|
|
||||||
QPoint QCursor::hotSpot() const
|
QPoint QCursor::hotSpot() const
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
return QPoint(d->hx, d->hy);
|
return QPoint(d->hx, d->hy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,8 +604,7 @@ QPoint QCursor::hotSpot() const
|
|||||||
|
|
||||||
QCursor::QCursor(const QCursor &c)
|
QCursor::QCursor(const QCursor &c)
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
d = c.d;
|
d = c.d;
|
||||||
d->ref.ref();
|
d->ref.ref();
|
||||||
}
|
}
|
||||||
@ -635,8 +627,7 @@ QCursor::~QCursor()
|
|||||||
|
|
||||||
QCursor &QCursor::operator=(const QCursor &c)
|
QCursor &QCursor::operator=(const QCursor &c)
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
if (c.d)
|
if (c.d)
|
||||||
c.d->ref.ref();
|
c.d->ref.ref();
|
||||||
if (d && !d->ref.deref())
|
if (d && !d->ref.deref())
|
||||||
@ -707,8 +698,7 @@ void QCursorData::initialize()
|
|||||||
|
|
||||||
QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY, qreal devicePixelRatio)
|
QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY, qreal devicePixelRatio)
|
||||||
{
|
{
|
||||||
if (!QCursorData::initialized)
|
QCursorData::initialize();
|
||||||
QCursorData::initialize();
|
|
||||||
if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {
|
if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {
|
||||||
qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
|
qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");
|
||||||
QCursorData *c = qt_cursorTable[0];
|
QCursorData *c = qt_cursorTable[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user