From: Simjees Abraham Date: Tue, 17 Apr 2012 13:28:23 +0000 (+0200) Subject: Debugger: Changes made for selection using Inspect Tool X-Git-Tag: 071012131707~598 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2e6718f219fcd8c272f3638f2cf135cf5c425824;p=profile%2Fivi%2Fqtdeclarative.git Debugger: Changes made for selection using Inspect Tool The selected item is shown in black transparent background. Change-Id: Ifc9d2892cc000041df6d9585f5c5adcca07abfb5 Reviewed-by: Aurindam Jana Reviewed-by: Kai Koehne --- diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp index d014dd4..f886978 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.cpp @@ -47,12 +47,24 @@ namespace QmlJSDebugger { namespace QtQuick2 { +Highlight::Highlight(QQuickItem *parent) : QQuickPaintedItem(parent) +{ + initRenderDetails(); +} + Highlight::Highlight(QQuickItem *item, QQuickItem *parent) : QQuickPaintedItem(parent) { + initRenderDetails(); setItem(item); } +void Highlight::initRenderDetails() +{ + setRenderTarget(QQuickPaintedItem::FramebufferObject); + setPerformanceHint(QQuickPaintedItem::FastFBOResizing, true); +} + void Highlight::setItem(QQuickItem *item) { if (m_item) @@ -79,6 +91,7 @@ void Highlight::setItem(QQuickItem *item) SLOT(adjust())); } m_item = item; + setContentsSize(view->size()); adjust(); } @@ -105,7 +118,6 @@ void Highlight::adjust() // takes care of it. parentItem()->setScale(1/scaleFactor); setPos(originOffset); - setContentsSize(view->size()); update(); } @@ -127,20 +139,14 @@ void SelectionHighlight::paint(QPainter *painter) { if (!item()) return; - painter->save(); + painter->fillRect(QRectF(0,0,contentsSize().width(), contentsSize().height()), + QColor(0,0,0,127)); painter->setTransform(transform()); - if (item()->height() >= 10 && item()->width() >= 10) { - QColor colorHighlight = Qt::green; - painter->fillRect(QRectF(0, 0, item()->width(), 5), colorHighlight); - painter->fillRect(QRectF(0, item()->height()-5, item()->width(), 5), colorHighlight); - painter->fillRect(QRectF(0, 5, 5, item()->height() - 10), colorHighlight); - painter->fillRect(QRectF(item()->width()-5, 5, 5, item()->height() - 10), colorHighlight); - } - painter->setPen(QPen(QColor(0, 22, 159))); - painter->drawRect(QRect(1, 1, item()->width() - 3, item()->height() - 3)); - painter->setPen(QColor(158, 199, 255)); - painter->drawRect(QRect(0, 0, item()->width() - 1, item()->height() - 1)); + // Setting the composition mode such that the transparency will + // be erased as per the selected item. + painter->setCompositionMode(QPainter::CompositionMode_Clear); + painter->fillRect(0, 0, item()->width(), item()->height(), Qt::black); painter->restore(); } diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h index 3dbd109..2900b9c 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h +++ b/src/plugins/qmltooling/qmldbg_qtquick2/highlight.h @@ -55,7 +55,7 @@ class Highlight : public QQuickPaintedItem Q_OBJECT public: - Highlight(QQuickItem *parent) : QQuickPaintedItem(parent) {} + Highlight(QQuickItem *parent); Highlight(QQuickItem *item, QQuickItem *parent); void setItem(QQuickItem *item); @@ -64,6 +64,9 @@ public: protected: QTransform transform() {return m_transform;} +private: + void initRenderDetails(); + private slots: void adjust();