summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2020-07-06 12:51:22 +0200
committerMarco Bubke <marco.bubke@qt.io>2020-07-08 09:17:08 +0000
commit9bfb608986f332aaeb9cfae88d5f66c451dd2002 (patch)
treead0fac9ff5023c9311e8d285ead24ecc09541e05
parent33671897bdb508fd46ac9e2e48b67d000f3e15bd (diff)
downloadqt-creator-9bfb608986f332aaeb9cfae88d5f66c451dd2002.tar.gz
QmlDesigner: Add adjustable frame color
Task-number: QDS-2238 Change-Id: I6f43a7c87ae4c8daaf41c08ad2960502770fba58 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp14
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditoritem.h3
-rw-r--r--src/plugins/qmldesigner/components/formeditor/formeditorview.cpp5
3 files changed, 21 insertions, 1 deletions
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
index 3fc654ce86..63205e0303 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.cpp
@@ -283,6 +283,11 @@ bool FormEditorItem::flowHitTest(const QPointF & ) const
return false;
}
+void FormEditorItem::setFrameColor(const QColor &color)
+{
+ m_frameColor = color;
+}
+
FormEditorItem::~FormEditorItem()
{
scene()->removeItemFromHash(this);
@@ -313,14 +318,21 @@ void FormEditorItem::paintBoundingRect(QPainter *painter) const
pen.setJoinStyle(Qt::MiterJoin);
const QColor frameColor(0xaa, 0xaa, 0xaa);
- static const QColor selectionColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_FormEditorSelectionColor);
+ static const QColor selectionColor = Utils::creatorTheme()->color(
+ Utils::Theme::QmlDesigner_FormEditorSelectionColor);
if (scene()->showBoundingRects()) {
pen.setColor(frameColor.darker(150));
pen.setStyle(Qt::DotLine);
painter->setPen(pen);
painter->drawRect(m_boundingRect.adjusted(0., 0., -1., -1.));
+ }
+ if (m_frameColor.isValid()) {
+ pen.setColor(m_frameColor);
+ pen.setStyle(Qt::SolidLine);
+ painter->setPen(pen);
+ painter->drawRect(m_boundingRect.adjusted(0., 0., -1., -1.));
}
if (m_highlightBoundingRect) {
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditoritem.h b/src/plugins/qmldesigner/components/formeditor/formeditoritem.h
index 61ade49916..37e34fc4f7 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditoritem.h
+++ b/src/plugins/qmldesigner/components/formeditor/formeditoritem.h
@@ -117,6 +117,8 @@ public:
virtual bool flowHitTest(const QPointF &point) const;
+ void setFrameColor(const QColor &color);
+
protected:
AbstractFormEditorTool* tool() const;
void paintBoundingRect(QPainter *painter) const;
@@ -129,6 +131,7 @@ protected:
QRectF m_boundingRect;
QRectF m_paintedBoundingRect;
QRectF m_selectionBoundingRect;
+ QColor m_frameColor{0xaa, 0xaa, 0xaa};
private: // functions
void setup();
diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
index f64b45f351..da08887690 100644
--- a/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
+++ b/src/plugins/qmldesigner/components/formeditor/formeditorview.cpp
@@ -624,6 +624,11 @@ void FormEditorView::auxiliaryDataChanged(const ModelNode &node, const PropertyN
editorItem->update();
}
}
+
+ if (name == "FrameColor@Internal") {
+ if (FormEditorItem *editorItem = scene()->itemForQmlItemNode(item))
+ editorItem->setFrameColor(data.value<QColor>());
+ }
}
void FormEditorView::instancesCompleted(const QVector<ModelNode> &completedNodeList)