forked from qt-creator/qt-creator
QmlDesigner: Add adjustable frame color
Task-number: QDS-2238 Change-Id: I6f43a7c87ae4c8daaf41c08ad2960502770fba58 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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();
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user