Sankore-861 using recolorAllItemsFunction

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

@ -1543,28 +1543,12 @@ void UBBoardController::changeBackground(bool isDark, bool 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();
emit backgroundChanged();
}
}
void UBBoardController::boardViewResized(QResizeEvent* event)
{
Q_UNUSED(event);

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

Loading…
Cancel
Save