Sankore-861 using recolorAllItemsFunction

preferencesAboutTextFull
Ilia Ryabokon 12 years ago
parent 687b65658c
commit 678633094d
  1. 16
      src/board/UBBoardController.cpp
  2. 29
      src/domain/UBGraphicsScene.cpp

@ -1543,28 +1543,12 @@ void UBBoardController::changeBackground(bool isDark, bool isCrossed)
mActiveScene->setBackground(isDark, isCrossed); mActiveScene->setBackground(isDark, isCrossed);
foreach (QGraphicsItem *item, mActiveScene->items()) {
if (item->type() == UBGraphicsStrokesGroup::Type) {
UBGraphicsStrokesGroup *curGroup = static_cast<UBGraphicsStrokesGroup*>(item);
QColor compareColor = curGroup->color(currentIsDark ? UBGraphicsStrokesGroup::colorOnDarkBackground
: UBGraphicsStrokesGroup::colorOnLightBackground);
if (curGroup->color() == compareColor) {
QColor newColor = curGroup->color(!currentIsDark ? UBGraphicsStrokesGroup::colorOnDarkBackground
: UBGraphicsStrokesGroup::colorOnLightBackground);
curGroup->setColor(newColor);
}
}
}
updateBackgroundState(); updateBackgroundState();
emit backgroundChanged(); emit backgroundChanged();
} }
} }
void UBBoardController::boardViewResized(QResizeEvent* event) void UBBoardController::boardViewResized(QResizeEvent* event)
{ {
Q_UNUSED(event); Q_UNUSED(event);

@ -891,25 +891,18 @@ void UBGraphicsScene::recolorAllItems()
view->setViewportUpdateMode(QGraphicsView::NoViewportUpdate); view->setViewportUpdateMode(QGraphicsView::NoViewportUpdate);
} }
for(int i = 0; i < mFastAccessItems.size(); i++) bool currentIslight = isLightBackground();
{ foreach (QGraphicsItem *item, items()) {
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (mFastAccessItems.at(i)); if (item->type() == UBGraphicsStrokesGroup::Type) {
UBGraphicsStrokesGroup *curGroup = static_cast<UBGraphicsStrokesGroup*>(item);
if (polygonItem) QColor compareColor = curGroup->color(currentIslight ? UBGraphicsStrokesGroup::colorOnDarkBackground
{ : UBGraphicsStrokesGroup::colorOnLightBackground);
QColor color;
if (curGroup->color() == compareColor) {
if (mDarkBackground) QColor newColor = curGroup->color(!currentIslight ? UBGraphicsStrokesGroup::colorOnDarkBackground
{ : UBGraphicsStrokesGroup::colorOnLightBackground);
color = polygonItem->colorOnDarkBackground(); curGroup->setColor(newColor);
}
else
{
color = polygonItem->colorOnLightBackground();
} }
polygonItem->setColor(color);
continue;
} }
} }

Loading…
Cancel
Save