Change return type of imagePosition to QPoint
QAccessibleImageInterface already has an API to return the size of the image. This function ensures that their API's are not overlapping. Alternatively, we could merge both functions into QAccessibleImageInterface::imageRect(), but the assumption is that images change position more often than their size. Change-Id: I55c25cdff187b9f497828f04cfd5f969cfbc451f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>bb10
parent
23833629fa
commit
4684f2179b
|
|
@ -589,7 +589,7 @@ public:
|
|||
|
||||
virtual QString imageDescription() const = 0;
|
||||
virtual QSize imageSize() const = 0;
|
||||
virtual QRect imagePosition() const = 0;
|
||||
virtual QPoint imagePosition() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -474,16 +474,16 @@ QSize QAccessibleDisplay::imageSize() const
|
|||
}
|
||||
|
||||
/*! \internal */
|
||||
QRect QAccessibleDisplay::imagePosition() const
|
||||
QPoint QAccessibleDisplay::imagePosition() const
|
||||
{
|
||||
QLabel *label = qobject_cast<QLabel *>(widget());
|
||||
if (!label)
|
||||
return QRect();
|
||||
return QPoint();
|
||||
const QPixmap *pixmap = label->pixmap();
|
||||
if (!pixmap)
|
||||
return QRect();
|
||||
return QPoint();
|
||||
|
||||
return QRect(label->mapToGlobal(label->pos()), label->size());
|
||||
return QPoint(label->mapToGlobal(label->pos()));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_GROUPBOX
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ public:
|
|||
// QAccessibleImageInterface
|
||||
QString imageDescription() const Q_DECL_OVERRIDE;
|
||||
QSize imageSize() const Q_DECL_OVERRIDE;
|
||||
QRect imagePosition() const Q_DECL_OVERRIDE;
|
||||
QPoint imagePosition() const Q_DECL_OVERRIDE;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_GROUPBOX
|
||||
|
|
|
|||
|
|
@ -3295,7 +3295,7 @@ void tst_QAccessibility::labelTest()
|
|||
QCOMPARE(imageInterface->imageSize(), testPixmap.size());
|
||||
QCOMPARE(imageInterface->imageDescription(), QString::fromLatin1("Test Description"));
|
||||
const QPoint labelPos = imageLabel.mapToGlobal(QPoint(0,0));
|
||||
QCOMPARE(imageInterface->imagePosition().topLeft(), labelPos);
|
||||
QCOMPARE(imageInterface->imagePosition(), labelPos);
|
||||
|
||||
QTestAccessibility::clearEvents();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue