本文整理汇总了C++中CustomItem::setBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ CustomItem::setBrush方法的具体用法?C++ CustomItem::setBrush怎么用?C++ CustomItem::setBrush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomItem
的用法示例。
在下文中一共展示了CustomItem::setBrush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: inheritOpacity
void tst_QGraphicsEffect::inheritOpacity()
{
QGraphicsScene scene;
QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 10, 10);
CustomItem *item = new CustomItem(0, 0, 10, 10, rectItem);
scene.addItem(rectItem);
item->setGraphicsEffect(new DeviceEffect);
item->setPen(Qt::NoPen);
item->setBrush(Qt::red);
rectItem->setOpacity(0.5);
QGraphicsView view(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(item->numRepaints >= 1);
int numRepaints = item->numRepaints;
rectItem->setOpacity(1);
// item should have been rerendered due to opacity changing
QTRY_VERIFY(item->numRepaints > numRepaints);
}
示例2: deviceCoordinateTranslateCaching
void tst_QGraphicsEffect::deviceCoordinateTranslateCaching()
{
QGraphicsScene scene;
CustomItem *item = new CustomItem(0, 0, 10, 10);
scene.addItem(item);
scene.setSceneRect(0, 0, 50, 0);
item->setGraphicsEffect(new DeviceEffect);
item->setPen(Qt::NoPen);
item->setBrush(Qt::red);
QGraphicsView view(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(item->numRepaints >= 1);
int numRepaints = item->numRepaints;
item->translate(10, 0);
QTRY_VERIFY(item->numRepaints == numRepaints);
}