QStyleOptionGraphicsItem: remove deprecated member matrix/levelOfDetail
QStyleOptionGraphicsItem::matrix and levelOfDetail are deprecated and not used anywhere anymore. Change-Id: Id4b0fa8ac3ac53d771e858ecda5524a5e690342d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
68198de4db
commit
4e2656a6d2
@ -429,16 +429,12 @@
|
|||||||
in Qt 4.5.
|
in Qt 4.5.
|
||||||
|
|
||||||
\value ItemUsesExtendedStyleOption The item makes use of either
|
\value ItemUsesExtendedStyleOption The item makes use of either
|
||||||
\l{QStyleOptionGraphicsItem::} {exposedRect} or
|
\l{QStyleOptionGraphicsItem::} {exposedRect} in
|
||||||
\l{QStyleOptionGraphicsItem::} {matrix} in
|
|
||||||
QStyleOptionGraphicsItem. By default, the
|
QStyleOptionGraphicsItem. By default, the
|
||||||
\l{QStyleOptionGraphicsItem::} {exposedRect} is initialized to the
|
\l{QStyleOptionGraphicsItem::} {exposedRect} is initialized to the
|
||||||
item's boundingRect() and the
|
item's boundingRect(). You can
|
||||||
\l{QStyleOptionGraphicsItem::}{matrix} is untransformed. You can
|
|
||||||
enable this flag for the style options to be set up with more
|
enable this flag for the style options to be set up with more
|
||||||
fine-grained values. Note that
|
fine-grained values. Use
|
||||||
QStyleOptionGraphicsItem::levelOfDetail is unaffected by this flag
|
|
||||||
and always initialized to 1. Use
|
|
||||||
QStyleOptionGraphicsItem::levelOfDetailFromTransform() if you need
|
QStyleOptionGraphicsItem::levelOfDetailFromTransform() if you need
|
||||||
a higher value. This flag was introduced in Qt 4.6.
|
a higher value. This flag was introduced in Qt 4.6.
|
||||||
|
|
||||||
@ -1476,7 +1472,6 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con
|
|||||||
const QRectF brect = q->boundingRect();
|
const QRectF brect = q->boundingRect();
|
||||||
option->state = QStyle::State_None;
|
option->state = QStyle::State_None;
|
||||||
option->rect = brect.toRect();
|
option->rect = brect.toRect();
|
||||||
option->levelOfDetail = 1;
|
|
||||||
option->exposedRect = brect;
|
option->exposedRect = brect;
|
||||||
|
|
||||||
// Style animations require a QObject-based animation target.
|
// Style animations require a QObject-based animation target.
|
||||||
@ -1502,9 +1497,6 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con
|
|||||||
if (!(flags & QGraphicsItem::ItemUsesExtendedStyleOption))
|
if (!(flags & QGraphicsItem::ItemUsesExtendedStyleOption))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Initialize QStyleOptionGraphicsItem specific values (matrix, exposedRect).
|
|
||||||
option->matrix = worldTransform; //### discards perspective
|
|
||||||
|
|
||||||
if (!allItems) {
|
if (!allItems) {
|
||||||
// Determine the item's exposed area
|
// Determine the item's exposed area
|
||||||
option->exposedRect = QRectF();
|
option->exposedRect = QRectF();
|
||||||
|
@ -3630,7 +3630,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
|
|||||||
Constructs a QStyleOptionGraphicsItem.
|
Constructs a QStyleOptionGraphicsItem.
|
||||||
*/
|
*/
|
||||||
QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
|
QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
|
||||||
: QStyleOption(Version, Type), levelOfDetail(1)
|
: QStyleOption(Version, Type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3638,7 +3638,7 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
|
|||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
|
QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
|
||||||
: QStyleOption(version, Type), levelOfDetail(1)
|
: QStyleOption(version, Type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3685,38 +3685,6 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
|
|||||||
QGraphicsItem::ItemUsesExtendedStyleOption flag set.
|
QGraphicsItem::ItemUsesExtendedStyleOption flag set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
|
||||||
\variable QStyleOptionGraphicsItem::matrix
|
|
||||||
\brief the complete transformation matrix for the item
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
The QTransform provided through this member does include information about
|
|
||||||
any perspective transformations applied to the view or item. To get the
|
|
||||||
correct transformation matrix, use QPainter::transform() on the painter
|
|
||||||
passed into the QGraphicsItem::paint() implementation.
|
|
||||||
|
|
||||||
This matrix is the combination of the item's scene matrix and the matrix
|
|
||||||
of the painter used for drawing the item. It is provided for convenience,
|
|
||||||
allowing anvanced level-of-detail metrics that can be used to speed up
|
|
||||||
item drawing.
|
|
||||||
|
|
||||||
To find the dimensions of an item in screen coordinates (i.e., pixels),
|
|
||||||
you can use the mapping functions of QTransform, such as QTransform::map().
|
|
||||||
|
|
||||||
This member is only initialized for items that have the
|
|
||||||
QGraphicsItem::ItemUsesExtendedStyleOption flag set.
|
|
||||||
|
|
||||||
\sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\variable QStyleOptionGraphicsItem::levelOfDetail
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Use QStyleOptionGraphicsItem::levelOfDetailFromTransform()
|
|
||||||
together with QPainter::worldTransform() instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QStyleHintReturn
|
\class QStyleHintReturn
|
||||||
\brief The QStyleHintReturn class provides style hints that return more
|
\brief The QStyleHintReturn class provides style hints that return more
|
||||||
|
@ -669,8 +669,6 @@ public:
|
|||||||
enum StyleOptionVersion { Version = 1 };
|
enum StyleOptionVersion { Version = 1 };
|
||||||
|
|
||||||
QRectF exposedRect;
|
QRectF exposedRect;
|
||||||
QTransform matrix;
|
|
||||||
qreal levelOfDetail;
|
|
||||||
|
|
||||||
QStyleOptionGraphicsItem();
|
QStyleOptionGraphicsItem();
|
||||||
QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
|
QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other) : QStyleOption(Version, Type) { *this = other; }
|
||||||
|
@ -7968,7 +7968,6 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
QVERIFY(option->exposedRect != QRect());
|
QVERIFY(option->exposedRect != QRect());
|
||||||
QVERIFY(option->exposedRect != boundingRect());
|
QVERIFY(option->exposedRect != boundingRect());
|
||||||
QCOMPARE(option->matrix, sceneTransform());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QGraphicsRectItem::paint(painter, option, widget);
|
QGraphicsRectItem::paint(painter, option, widget);
|
||||||
|
@ -61,8 +61,9 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
if (option->state & QStyle::State_MouseOver)
|
if (option->state & QStyle::State_MouseOver)
|
||||||
fillColor = fillColor.light(125);
|
fillColor = fillColor.light(125);
|
||||||
|
|
||||||
if (option->levelOfDetail < 0.2) {
|
const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform());
|
||||||
if (option->levelOfDetail < 0.125) {
|
if (lod < 0.2) {
|
||||||
|
if (lod < 0.125) {
|
||||||
painter->fillRect(QRectF(0, 0, 110, 70), fillColor);
|
painter->fillRect(QRectF(0, 0, 110, 70), fillColor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -83,7 +84,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100)));
|
painter->setBrush(QBrush(fillColor.dark(option->state & QStyle::State_Sunken ? 120 : 100)));
|
||||||
|
|
||||||
painter->drawRect(QRect(14, 14, 79, 39));
|
painter->drawRect(QRect(14, 14, 79, 39));
|
||||||
if (option->levelOfDetail >= 1) {
|
if (lod >= 1) {
|
||||||
painter->setPen(QPen(Qt::gray, 1));
|
painter->setPen(QPen(Qt::gray, 1));
|
||||||
painter->drawLine(15, 54, 94, 54);
|
painter->drawLine(15, 54, 94, 54);
|
||||||
painter->drawLine(94, 53, 94, 15);
|
painter->drawLine(94, 53, 94, 15);
|
||||||
@ -91,7 +92,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw text
|
// Draw text
|
||||||
if (option->levelOfDetail >= 2) {
|
if (lod >= 2) {
|
||||||
QFont font("Times", 10);
|
QFont font("Times", 10);
|
||||||
font.setStyleStrategy(QFont::ForceOutline);
|
font.setStyleStrategy(QFont::ForceOutline);
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
@ -105,17 +106,17 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
|
|
||||||
// Draw lines
|
// Draw lines
|
||||||
QVarLengthArray<QLineF, 36> lines;
|
QVarLengthArray<QLineF, 36> lines;
|
||||||
if (option->levelOfDetail >= 0.5) {
|
if (lod >= 0.5) {
|
||||||
for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) {
|
for (int i = 0; i <= 10; i += (lod > 0.5 ? 1 : 2)) {
|
||||||
lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5));
|
lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5));
|
||||||
lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62));
|
lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62));
|
||||||
}
|
}
|
||||||
for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) {
|
for (int i = 0; i <= 6; i += (lod > 0.5 ? 1 : 2)) {
|
||||||
lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5));
|
lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5));
|
||||||
lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5));
|
lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (option->levelOfDetail >= 0.4) {
|
if (lod >= 0.4) {
|
||||||
const QLineF lineData[] = {
|
const QLineF lineData[] = {
|
||||||
QLineF(25, 35, 35, 35),
|
QLineF(25, 35, 35, 35),
|
||||||
QLineF(35, 30, 35, 40),
|
QLineF(35, 30, 35, 40),
|
||||||
|
@ -61,8 +61,9 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
if (option->state & QStyle::State_MouseOver)
|
if (option->state & QStyle::State_MouseOver)
|
||||||
fillColor = fillColor.lighter(125);
|
fillColor = fillColor.lighter(125);
|
||||||
|
|
||||||
if (option->levelOfDetail < 0.2) {
|
const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform());
|
||||||
if (option->levelOfDetail < 0.125) {
|
if (lod < 0.2) {
|
||||||
|
if (lod < 0.125) {
|
||||||
painter->fillRect(QRectF(0, 0, 110, 70), fillColor);
|
painter->fillRect(QRectF(0, 0, 110, 70), fillColor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -87,7 +88,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
painter->drawRect(QRect(14, 14, 79, 39));
|
painter->drawRect(QRect(14, 14, 79, 39));
|
||||||
painter->setBrush(b);
|
painter->setBrush(b);
|
||||||
|
|
||||||
if (option->levelOfDetail >= 1) {
|
if (lod >= 1) {
|
||||||
painter->setPen(QPen(Qt::gray, 1));
|
painter->setPen(QPen(Qt::gray, 1));
|
||||||
painter->drawLine(15, 54, 94, 54);
|
painter->drawLine(15, 54, 94, 54);
|
||||||
painter->drawLine(94, 53, 94, 15);
|
painter->drawLine(94, 53, 94, 15);
|
||||||
@ -95,7 +96,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw text
|
// Draw text
|
||||||
if (option->levelOfDetail >= 2) {
|
if (lod >= 2) {
|
||||||
QFont font("Times", 10);
|
QFont font("Times", 10);
|
||||||
font.setStyleStrategy(QFont::ForceOutline);
|
font.setStyleStrategy(QFont::ForceOutline);
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
@ -109,17 +110,17 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||||||
|
|
||||||
// Draw lines
|
// Draw lines
|
||||||
QVarLengthArray<QLineF, 36> lines;
|
QVarLengthArray<QLineF, 36> lines;
|
||||||
if (option->levelOfDetail >= 0.5) {
|
if (lod >= 0.5) {
|
||||||
for (int i = 0; i <= 10; i += (option->levelOfDetail > 0.5 ? 1 : 2)) {
|
for (int i = 0; i <= 10; i += (lod > 0.5 ? 1 : 2)) {
|
||||||
lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5));
|
lines.append(QLineF(18 + 7 * i, 13, 18 + 7 * i, 5));
|
||||||
lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62));
|
lines.append(QLineF(18 + 7 * i, 54, 18 + 7 * i, 62));
|
||||||
}
|
}
|
||||||
for (int i = 0; i <= 6; i += (option->levelOfDetail > 0.5 ? 1 : 2)) {
|
for (int i = 0; i <= 6; i += (lod > 0.5 ? 1 : 2)) {
|
||||||
lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5));
|
lines.append(QLineF(5, 18 + i * 5, 13, 18 + i * 5));
|
||||||
lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5));
|
lines.append(QLineF(94, 18 + i * 5, 102, 18 + i * 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (option->levelOfDetail >= 0.4) {
|
if (lod >= 0.4) {
|
||||||
const QLineF lineData[] = {
|
const QLineF lineData[] = {
|
||||||
QLineF(25, 35, 35, 35),
|
QLineF(25, 35, 35, 35),
|
||||||
QLineF(35, 30, 35, 40),
|
QLineF(35, 30, 35, 40),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user