GraphicsView: Fix resolvePalette() for QGraphicsItem's children
Use a proper function for that. Change-Id: I166ce44b8987d522cb01bae57009b2b862851b92 Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
This commit is contained in:
parent
863f598b65
commit
9c4c044338
@ -318,7 +318,7 @@ public:
|
||||
virtual void resolvePalette(uint inheritedMask)
|
||||
{
|
||||
for (int i = 0; i < children.size(); ++i)
|
||||
children.at(i)->d_ptr->resolveFont(inheritedMask);
|
||||
children.at(i)->d_ptr->resolvePalette(inheritedMask);
|
||||
}
|
||||
|
||||
virtual bool isProxyWidget() const;
|
||||
|
@ -1608,9 +1608,9 @@ void QGraphicsScenePrivate::updatePalette(const QPalette &palette)
|
||||
// whose parent is not a widget.
|
||||
foreach (QGraphicsItem *item, q->items()) {
|
||||
if (!item->parentItem()) {
|
||||
// Resolvefont for an item is a noop operation, but
|
||||
// ResolvePalette for an item is a noop operation, but
|
||||
// every item can be a widget, or can have a widget
|
||||
// childre.
|
||||
// children.
|
||||
item->d_ptr->resolvePalette(palette.resolve());
|
||||
}
|
||||
}
|
||||
|
@ -461,6 +461,7 @@ private slots:
|
||||
void touchEventPropagation_data();
|
||||
void touchEventPropagation();
|
||||
void deviceCoordinateCache_simpleRotations();
|
||||
void resolvePaletteForItemChildren();
|
||||
|
||||
// task specific tests below me
|
||||
void task141694_textItemEnsureVisible();
|
||||
@ -11695,5 +11696,21 @@ void tst_QGraphicsItem::QTBUG_21618_untransformable_sceneTransform()
|
||||
QCOMPARE(item2_bottomright->deviceTransform(tx).map(QPointF()), QPointF(100, 300));
|
||||
}
|
||||
|
||||
void tst_QGraphicsItem::resolvePaletteForItemChildren()
|
||||
{
|
||||
QGraphicsScene scene;
|
||||
QGraphicsRectItem item(0, 0, 50, -150);
|
||||
scene.addItem(&item);
|
||||
QGraphicsWidget widget;
|
||||
widget.setParentItem(&item);
|
||||
|
||||
QColor green(Qt::green);
|
||||
QPalette paletteForScene = scene.palette();
|
||||
paletteForScene.setColor(QPalette::Active, QPalette::Window, green);
|
||||
scene.setPalette(paletteForScene);
|
||||
|
||||
QCOMPARE(widget.palette().color(QPalette::Active, QPalette::Window), green);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QGraphicsItem)
|
||||
#include "tst_qgraphicsitem.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user