Revert "SCXMLEditor: Apply theming to the all items"

This reverts commit 1e410e2c4d as
it completely breaks the internal coloring of elements.

Fixes: QTCREATORBUG-32477
Change-Id: Ie7fcae8c22be52de732f8d08c39585c99c51a33a
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Christian Stenger
2025-02-11 11:15:09 +01:00
parent 10fc0ef430
commit 409d556d13
15 changed files with 55 additions and 69 deletions

View File

@@ -31,7 +31,9 @@ ConnectableItem::ConnectableItem(const QPointF &p, BaseItem *parent)
setAcceptDrops(true); setAcceptDrops(true);
m_selectedPen.setStyle(Qt::DotLine); m_selectedPen.setStyle(Qt::DotLine);
m_selectedPen.setColor(QColor(0x44, 0x44, 0xed));
m_selectedPen.setCosmetic(true); m_selectedPen.setCosmetic(true);
m_releasedFromParentBrush = QBrush(QColor(0x98, 0x98, 0x98));
setPos(p); setPos(p);
connect(this, &ConnectableItem::geometryChanged, this, &ConnectableItem::updateCornerPositions); connect(this, &ConnectableItem::geometryChanged, this, &ConnectableItem::updateCornerPositions);
@@ -528,7 +530,7 @@ void ConnectableItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
if (m_releasedFromParent) { if (m_releasedFromParent) {
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(scene()->palette().brush(QPalette::ColorGroup::Current, QPalette::Window)); painter->setBrush(m_releasedFromParentBrush);
painter->setClipping(true); painter->setClipping(true);
painter->setClipPath(m_shadowClipPath); painter->setClipPath(m_shadowClipPath);
//Since the form is already cliped just draw a rectangle //Since the form is already cliped just draw a rectangle
@@ -537,7 +539,6 @@ void ConnectableItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
} }
if (isSelected()) { if (isSelected()) {
m_selectedPen.setColor(painter->pen().color());
painter->setPen(m_selectedPen); painter->setPen(m_selectedPen);
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
painter->drawRect(boundingRect()); painter->drawRect(boundingRect());

View File

@@ -108,6 +108,7 @@ private:
HighlightItem *m_highlighItem = nullptr; HighlightItem *m_highlighItem = nullptr;
TransitionItem *m_newTransition = nullptr; TransitionItem *m_newTransition = nullptr;
QPen m_selectedPen; QPen m_selectedPen;
QBrush m_releasedFromParentBrush;
int m_minimumWidth = 120; int m_minimumWidth = 120;
int m_minimumHeight = 100; int m_minimumHeight = 100;
bool m_releasedFromParent = false; bool m_releasedFromParent = false;

View File

@@ -4,7 +4,6 @@
#include "cornergrabberitem.h" #include "cornergrabberitem.h"
#include <QCursor> #include <QCursor>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QPainter> #include <QPainter>
#include <QPalette> #include <QPalette>
@@ -62,8 +61,7 @@ void CornerGrabberItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->save(); painter->save();
painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::Antialiasing, true);
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
QPalette::ColorGroup group = isEnabled() ? QPalette::Inactive : QPalette::Disabled; painter->setBrush(isEnabled() ? QColor(0x62, 0x62, 0xf9) : QColor(0x12, 0x12, 0x12));
painter->setBrush(scene()->palette().brush(group, QPalette::Highlight));
if (m_grabberType == Square) if (m_grabberType == Square)
painter->drawRect(m_drawingRect); painter->drawRect(m_drawingRect);

View File

@@ -22,8 +22,7 @@ EventItem::EventItem(const QPointF &pos, BaseItem *parent)
m_eventNameItem->setFont(serifFont); m_eventNameItem->setFont(serifFont);
QString color = editorInfo("fontColor"); QString color = editorInfo("fontColor");
if (!color.isEmpty()) m_eventNameItem->setDefaultTextColor(color.isEmpty() ? QColor(Qt::black) : QColor(color));
m_eventNameItem->setDefaultTextColor(QColor(color));
setPos(pos); setPos(pos);
m_eventNameItem->setTextInteractionFlags(Qt::NoTextInteraction); m_eventNameItem->setTextInteractionFlags(Qt::NoTextInteraction);
@@ -52,6 +51,7 @@ OnEntryExitItem::OnEntryExitItem(BaseItem *parent)
m_eventNameItem->setParentItem(this); m_eventNameItem->setParentItem(this);
QFont serifFont("Times", 10, QFont::Normal); QFont serifFont("Times", 10, QFont::Normal);
m_eventNameItem->setFont(serifFont); m_eventNameItem->setFont(serifFont);
m_eventNameItem->setDefaultTextColor(Qt::black);
m_eventNameItem->setTextInteractionFlags(Qt::NoTextInteraction); m_eventNameItem->setTextInteractionFlags(Qt::NoTextInteraction);
} }

View File

@@ -2,8 +2,6 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "finalstateitem.h" #include "finalstateitem.h"
#include <QGraphicsScene>
#include <QPainter> #include <QPainter>
#include <QPalette> #include <QPalette>
@@ -42,13 +40,13 @@ void FinalStateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::Antialiasing, true);
painter->setOpacity(getOpacity()); painter->setOpacity(getOpacity());
QPalette::ColorGroup group = overlapping() ? QPalette::Active : QPalette::Inactive; painter->setBrush(QColor(0xff, 0xff, 0xff));
m_pen.setColor(scene()->palette().color(group, QPalette::WindowText)); m_pen.setColor(overlapping() ? qRgb(0xff, 0x00, 0x60) : qRgb(0x45, 0x45, 0x45));
painter->setPen(m_pen); painter->setPen(m_pen);
painter->drawEllipse(boundingRect().center(), m_size, m_size); painter->drawEllipse(boundingRect().center(), m_size, m_size);
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(scene()->palette().color(QPalette::WindowText)); painter->setBrush(QColor(0x4d, 0x4d, 0x4d));
painter->drawEllipse(boundingRect().center(), m_size * 0.8, m_size * 0.8); painter->drawEllipse(boundingRect().center(), m_size * 0.8, m_size * 0.8);
painter->restore(); painter->restore();

View File

@@ -21,7 +21,6 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/stringutils.h> #include <utils/stringutils.h>
#include <utils/theme/theme.h>
#include <QAction> #include <QAction>
#include <QGuiApplication> #include <QGuiApplication>
@@ -37,8 +36,6 @@ GraphicsScene::GraphicsScene(QObject *parent)
{ {
//setMinimumRenderSize(5); //setMinimumRenderSize(5);
setItemIndexMethod(QGraphicsScene::NoIndex); setItemIndexMethod(QGraphicsScene::NoIndex);
setPalette(Utils::creatorTheme()->palette());
} }
GraphicsScene::~GraphicsScene() GraphicsScene::~GraphicsScene()

View File

@@ -10,6 +10,11 @@ HighlightItem::HighlightItem(BaseItem *baseItem)
: QGraphicsObject(nullptr) : QGraphicsObject(nullptr)
, m_baseItem(baseItem) , m_baseItem(baseItem)
{ {
m_pen = QPen(QColor(0xff, 0x00, 0x60));
m_pen.setWidth(2);
m_pen.setStyle(Qt::DashLine);
m_pen.setCosmetic(true);
setZValue(1000); setZValue(1000);
} }
@@ -42,17 +47,12 @@ void HighlightItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
QRectF br = m_baseItem->polygonShape().boundingRect(); QRectF br = m_baseItem->polygonShape().boundingRect();
QPen pen = painter->pen();
pen.setWidth(2);
pen.setStyle(Qt::DashLine);
pen.setCosmetic(true);
painter->setPen(pen);
painter->setBrush(Qt::NoBrush);
switch (m_baseItem->type()) { switch (m_baseItem->type()) {
case StateType: case StateType:
case ParallelType: { case ParallelType: {
painter->setOpacity(1.0); painter->setOpacity(1.0);
painter->setPen(m_pen);
painter->setBrush(Qt::NoBrush);
painter->drawRoundedRect(br, 10, 10); painter->drawRoundedRect(br, 10, 10);
break; break;
} }
@@ -60,6 +60,8 @@ void HighlightItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
case HistoryType: case HistoryType:
case FinalStateType: { case FinalStateType: {
painter->setOpacity(1.0); painter->setOpacity(1.0);
painter->setPen(m_pen);
painter->setBrush(Qt::NoBrush);
painter->drawEllipse(br); painter->drawEllipse(br);
break; break;
} }

View File

@@ -31,6 +31,8 @@ public:
private: private:
QPointer<BaseItem> m_baseItem; QPointer<BaseItem> m_baseItem;
QRectF m_boundingRect; QRectF m_boundingRect;
QBrush m_brush;
QPen m_pen;
}; };
} // namespace PluginInterface } // namespace PluginInterface

View File

@@ -2,8 +2,6 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "historyitem.h" #include "historyitem.h"
#include <QGraphicsScene>
#include <QPainter> #include <QPainter>
#include <QPalette> #include <QPalette>
@@ -42,8 +40,8 @@ void HistoryItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::Antialiasing, true);
painter->setOpacity(getOpacity()); painter->setOpacity(getOpacity());
QPalette::ColorGroup group = overlapping() ? QPalette::Active : QPalette::Inactive; painter->setBrush(QColor(0xff, 0xff, 0xff));
m_pen.setColor(scene()->palette().color(group, QPalette::WindowText)); m_pen.setColor(overlapping() ? qRgb(0xff, 0x00, 0x60) : qRgb(0x45, 0x45, 0x45));
painter->setPen(m_pen); painter->setPen(m_pen);
painter->drawEllipse(boundingRect().center(), m_size, m_size); painter->drawEllipse(boundingRect().center(), m_size, m_size);

View File

@@ -9,7 +9,6 @@
#include <QByteArray> #include <QByteArray>
#include <QDataStream> #include <QDataStream>
#include <QGraphicsScene>
#include <QPainter> #include <QPainter>
#include <QPalette> #include <QPalette>
@@ -79,9 +78,9 @@ void InitialStateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *
painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::Antialiasing, true);
painter->setOpacity(getOpacity()); painter->setOpacity(getOpacity());
QPalette::ColorGroup group = overlapping() ? QPalette::Active : QPalette::Inactive; m_pen.setColor(overlapping() ? qRgb(0xff, 0x00, 0x60) : qRgb(0x45, 0x45, 0x45));
m_pen.setColor(scene()->palette().color(group, QPalette::WindowText));
painter->setPen(m_pen); painter->setPen(m_pen);
painter->setBrush(QColor(0x4d, 0x4d, 0x4d));
painter->drawEllipse(boundingRect().center(), m_size, m_size); painter->drawEllipse(boundingRect().center(), m_size, m_size);
painter->restore(); painter->restore();

View File

@@ -4,7 +4,6 @@
#include "quicktransitionitem.h" #include "quicktransitionitem.h"
#include "scxmleditortr.h" #include "scxmleditortr.h"
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QPainter> #include <QPainter>
#include <QPalette> #include <QPalette>
@@ -26,8 +25,9 @@ QuickTransitionItem::QuickTransitionItem(int index, ItemType connectionType, QGr
m_drawingRect = m_rect.adjusted(4, 4, -4, -4); m_drawingRect = m_rect.adjusted(4, 4, -4, -4);
m_stateRect = m_rect.adjusted(3, 4, -3, -4); m_stateRect = m_rect.adjusted(3, 4, -3, -4);
m_brush.setStyle(Qt::SolidPattern); m_brush.setStyle(Qt::SolidPattern);
m_brush.setColor(scene()->palette().color(QPalette::Window)); m_brush.setColor(QColor(0xe8, 0xe8, 0xe8));
m_pen.setColor(QColor(0x12, 0x12, 0x12));
m_pen.setCapStyle(Qt::RoundCap); m_pen.setCapStyle(Qt::RoundCap);
setAcceptHoverEvents(true); setAcceptHoverEvents(true);
} }
@@ -40,14 +40,14 @@ void QuickTransitionItem::setConnectionType(ItemType connectionType)
void QuickTransitionItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e) void QuickTransitionItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *e)
{ {
Q_UNUSED(e) Q_UNUSED(e)
m_brush.setColor(scene()->palette().color(QPalette::Inactive, QPalette::Window)); m_brush.setColor(QColor(0xe8, 0xe8, 0xe8));
update(); update();
} }
void QuickTransitionItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e) void QuickTransitionItem::hoverEnterEvent(QGraphicsSceneHoverEvent *e)
{ {
Q_UNUSED(e) Q_UNUSED(e)
m_brush.setColor(scene()->palette().color(QPalette::Active, QPalette::Window)); m_brush.setColor(QColor(0xff, 0xc4, 0xff));
update(); update();
} }
@@ -59,7 +59,6 @@ void QuickTransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
painter->save(); painter->save();
painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::Antialiasing, true);
m_pen.setColor(painter->pen().color());
painter->setPen(m_pen); painter->setPen(m_pen);
painter->setBrush(m_brush); painter->setBrush(m_brush);
painter->drawRect(m_rect); painter->drawRect(m_rect);
@@ -73,13 +72,13 @@ void QuickTransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
switch (m_connectionType) { switch (m_connectionType) {
case StateType: case StateType:
painter->setPen(m_pen); painter->setPen(m_pen);
painter->setBrush(scene()->palette().brush(QPalette::Window)); painter->setBrush(Qt::white);
painter->drawRoundedRect(m_stateRect, 2, 2); painter->drawRoundedRect(m_stateRect, 2, 2);
break; break;
case ParallelType: case ParallelType:
painter->setPen(m_pen); painter->setPen(m_pen);
painter->setBrush(scene()->palette().brush(QPalette::Window)); painter->setBrush(Qt::white);
painter->drawRoundedRect(m_stateRect, 2, 2); painter->drawRoundedRect(m_stateRect, 2, 2);
painter->setPen(m_pen); painter->setPen(m_pen);
@@ -91,18 +90,18 @@ void QuickTransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
case FinalStateType: case FinalStateType:
painter->setPen(m_pen); painter->setPen(m_pen);
painter->setBrush(scene()->palette().brush(QPalette::Window)); painter->setBrush(Qt::white);
painter->drawEllipse(m_stateRect.center(), 7, 7); painter->drawEllipse(m_stateRect.center(), 7, 7);
painter->setPen(Qt::NoPen); painter->setPen(Qt::NoPen);
painter->setBrush(painter->pen().color()); painter->setBrush(Qt::black);
painter->drawEllipse(m_stateRect.center(), 5, 5); painter->drawEllipse(m_stateRect.center(), 5, 5);
break; break;
case HistoryType: case HistoryType:
painter->setFont(QFont("Arial", 6)); painter->setFont(QFont("Arial", 6));
painter->setPen(m_pen); painter->setPen(m_pen);
painter->setBrush(scene()->palette().brush(QPalette::Window)); painter->setBrush(Qt::white);
painter->drawEllipse(m_stateRect.center(), 7, 7); painter->drawEllipse(m_stateRect.center(), 7, 7);
painter->drawText(m_stateRect, Qt::AlignCenter, Tr::tr("H")); painter->drawText(m_stateRect, Qt::AlignCenter, Tr::tr("H"));
break; break;

View File

@@ -2,9 +2,6 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "snapline.h" #include "snapline.h"
#include "utils/theme/theme.h"
#include <QPen> #include <QPen>
using namespace ScxmlEditor::PluginInterface; using namespace ScxmlEditor::PluginInterface;
@@ -13,7 +10,7 @@ SnapLine::SnapLine(QGraphicsItem *parent)
: QGraphicsLineItem(parent) : QGraphicsLineItem(parent)
{ {
QPen pen; QPen pen;
pen.setBrush(Utils::creatorColor(Utils::Theme::Token_Accent_Default)); pen.setBrush(QColor(0x22, 0xcc, 0x22));
pen.setStyle(Qt::DashLine); pen.setStyle(Qt::DashLine);
setPen(pen); setPen(pen);
setZValue(502); setZValue(502);

View File

@@ -16,8 +16,6 @@
#include "statewarningitem.h" #include "statewarningitem.h"
#include "textitem.h" #include "textitem.h"
#include "transitionitem.h" #include "transitionitem.h"
#include "utils/stylehelper.h"
#include "utils/theme/theme.h"
#include "utilsprovider.h" #include "utilsprovider.h"
#include <utils/stringutils.h> #include <utils/stringutils.h>
@@ -51,6 +49,8 @@ StateItem::StateItem(const QPointF &pos, BaseItem *parent)
connect(m_stateNameItem, &TextItem::textChanged, this, &StateItem::updateTextPositions); connect(m_stateNameItem, &TextItem::textChanged, this, &StateItem::updateTextPositions);
connect(m_stateNameItem, &TextItem::textReady, this, &StateItem::titleHasChanged); connect(m_stateNameItem, &TextItem::textReady, this, &StateItem::titleHasChanged);
m_pen = QPen(QColor(0x45, 0x45, 0x45));
updateColors(); updateColors();
updatePolygon(); updatePolygon();
} }
@@ -127,8 +127,7 @@ void StateItem::updateEditorInfo(bool allChildren)
ConnectableItem::updateEditorInfo(allChildren); ConnectableItem::updateEditorInfo(allChildren);
QString color = editorInfo(Constants::C_SCXML_EDITORINFO_FONTCOLOR); QString color = editorInfo(Constants::C_SCXML_EDITORINFO_FONTCOLOR);
if (!color.isEmpty()) m_stateNameItem->setDefaultTextColor(color.isEmpty() ? QColor(Qt::black) : QColor(color));
m_stateNameItem->setDefaultTextColor(QColor(color));
// Update child too if necessary // Update child too if necessary
if (allChildren) { if (allChildren) {
@@ -468,18 +467,17 @@ void StateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
// Set opacity and color // Set opacity and color
painter->setOpacity(getOpacity()); painter->setOpacity(getOpacity());
QPalette::ColorGroup group = overlapping() ? QPalette::Active : QPalette::Inactive; m_pen.setColor(overlapping() ? qRgb(0xff, 0x00, 0x60) : qRgb(0x45, 0x45, 0x45));
m_pen.setColor(scene()->palette().color(group, QPalette::WindowText));
painter->setPen(m_pen); painter->setPen(m_pen);
QColor stateColor(editorInfo(Constants::C_SCXML_EDITORINFO_STATECOLOR)); QColor stateColor(editorInfo(Constants::C_SCXML_EDITORINFO_STATECOLOR));
if (!stateColor.isValid()) if (!stateColor.isValid())
stateColor = scene()->palette().color(QPalette::Window); stateColor = tag() ? tag()->document()->getColor(depth()) : QColor(0x12, 0x34, 0x56);
// Draw basic frame // Draw basic frame
QRectF r = boundingRect(); QRectF r = boundingRect();
QLinearGradient grad(r.topLeft(), r.bottomLeft()); QLinearGradient grad(r.topLeft(), r.bottomLeft());
grad.setColorAt(0, stateColor); grad.setColorAt(0, stateColor.lighter(115));
grad.setColorAt(1, Utils::StyleHelper::mergedColors(painter->pen().color(), stateColor, 8)); grad.setColorAt(1, stateColor);
painter->setBrush(QBrush(grad)); painter->setBrush(QBrush(grad));
painter->drawRoundedRect(m_drawingRect, STATE_RADIUS, STATE_RADIUS); painter->drawRoundedRect(m_drawingRect, STATE_RADIUS, STATE_RADIUS);
@@ -513,7 +511,7 @@ void StateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
if (m_initial) { if (m_initial) {
double size = m_titleRect.height() * 0.3; double size = m_titleRect.height() * 0.3;
painter->setBrush(scene()->palette().brush(QPalette::Window)); painter->setBrush(QColor(0x4d, 0x4d, 0x4d));
painter->drawEllipse(QPointF(m_titleRect.left() + 2 * size, m_titleRect.center().y()), size, size); painter->drawEllipse(QPointF(m_titleRect.left() + 2 * size, m_titleRect.center().y()), size, size);
} }
} }

View File

@@ -57,6 +57,11 @@ TransitionItem::TransitionItem(BaseItem *parent)
{ {
setFlag(ItemIsSelectable, true); setFlag(ItemIsSelectable, true);
m_highlightPen = QPen(QColor(0xff, 0x00, 0x60));
m_highlightPen.setWidth(8);
m_highlightPen.setJoinStyle(Qt::MiterJoin);
m_pen = QPen(QColor(0x12, 0x12, 0x12));
m_pen.setWidth(2); m_pen.setWidth(2);
m_arrow << QPointF(0, 0) m_arrow << QPointF(0, 0)
@@ -948,16 +953,10 @@ void TransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
Q_UNUSED(widget) Q_UNUSED(widget)
painter->save(); painter->save();
painter->setRenderHint(QPainter::Antialiasing, true); painter->setRenderHint(QPainter::Antialiasing, true);
m_pen.setColor(painter->pen().color());
painter->setPen(m_pen); painter->setPen(m_pen);
QPen highlightPen;
highlightPen.setWidth(8);
highlightPen.setJoinStyle(Qt::MiterJoin);
highlightPen.setColor(scene()->palette().color(QPalette::HighlightedText));
if (m_cornerPoints.count() >= 2) { if (m_cornerPoints.count() >= 2) {
if (m_targetType == InternalSameTarget) { if (m_targetType == InternalSameTarget) {
QRectF rect(m_cornerPoints[0].x(), m_cornerPoints[0].y() - SELECTION_DISTANCE, QRectF rect(m_cornerPoints[0].x(), m_cornerPoints[0].y() - SELECTION_DISTANCE,
@@ -966,7 +965,7 @@ void TransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->drawArc(rect, 0, 180 * 16); painter->drawArc(rect, 0, 180 * 16);
} else { } else {
if (highlight()) { if (highlight()) {
painter->setPen(highlightPen); painter->setPen(m_highlightPen);
painter->drawPolyline(m_cornerPoints); painter->drawPolyline(m_cornerPoints);
} }
painter->setPen(m_pen); painter->setPen(m_pen);
@@ -978,7 +977,7 @@ void TransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->drawEllipse(m_cornerPoints[i], 2, 2); painter->drawEllipse(m_cornerPoints[i], 2, 2);
if (highlight()) { if (highlight()) {
painter->setPen(highlightPen); painter->setPen(m_highlightPen);
painter->drawPolyline(m_arrow); painter->drawPolyline(m_arrow);
} }
@@ -993,15 +992,11 @@ void TransitionItem::updateEditorInfo(bool allChilds)
BaseItem::updateEditorInfo(allChilds); BaseItem::updateEditorInfo(allChilds);
const QColor fontColor = editorInfo(Constants::C_SCXML_EDITORINFO_FONTCOLOR); const QColor fontColor = editorInfo(Constants::C_SCXML_EDITORINFO_FONTCOLOR);
m_eventTagItem->setDefaultTextColor(fontColor.isValid() ? fontColor : Qt::black);
if (fontColor.isValid()) { m_condTagItem->setDefaultTextColor(fontColor.isValid() ? fontColor : Qt::black);
m_eventTagItem->setDefaultTextColor(fontColor);
m_condTagItem->setDefaultTextColor(fontColor);
}
const QColor stateColor = editorInfo(Constants::C_SCXML_EDITORINFO_STATECOLOR); const QColor stateColor = editorInfo(Constants::C_SCXML_EDITORINFO_STATECOLOR);
if (stateColor.isValid()) m_pen.setColor(stateColor.isValid() ? stateColor : qRgb(0x12, 0x12, 0x12));
m_pen.setColor(stateColor);
} }
void TransitionItem::updateTarget(bool fixValue) void TransitionItem::updateTarget(bool fixValue)

View File

@@ -139,6 +139,7 @@ private:
qreal m_arrowSize = 10; qreal m_arrowSize = 10;
qreal m_arrowAngle; qreal m_arrowAngle;
QPen m_pen; QPen m_pen;
QPen m_highlightPen;
bool m_lineSelected = false; bool m_lineSelected = false;
TagTextItem *m_eventTagItem; TagTextItem *m_eventTagItem;