diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.cpp index e62a496280490f0b01fbfc474aca347bf999b688..cd4f18231291e6b6169326331060b57b0a881f95 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrary.cpp @@ -141,6 +141,11 @@ ItemLibrary::ItemLibrary(QWidget *parent) : rootContext->setContextProperty(QLatin1String("itemLibraryIconWidth"), m_d->m_itemIconSize.width()); rootContext->setContextProperty(QLatin1String("itemLibraryIconHeight"), m_d->m_itemIconSize.height()); + QColor highlightColor = palette().highlight().color(); + if (0.5*highlightColor.saturationF()+0.75-highlightColor.valueF() < 0) + highlightColor.setHsvF(highlightColor.hsvHueF(),0.1 + highlightColor.saturationF()*2.0, highlightColor.valueF()); + m_d->m_itemsView->rootContext()->setContextProperty(QLatin1String("highlightColor"), highlightColor); + QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(m_d->m_itemsView->rootObject()); connect(rootItem, SIGNAL(itemSelected(int)), this, SLOT(showItemInfo(int))); connect(rootItem, SIGNAL(itemDragged(int)), this, SLOT(startDragAndDrop(int))); diff --git a/src/plugins/qmldesigner/components/itemlibrary/qml/Selector.qml b/src/plugins/qmldesigner/components/itemlibrary/qml/Selector.qml index badb21fa31a4ac570168ea9ed34f1eee634b9f2f..6234d631c04fc589f056bec08a112e90bfbc5348 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/qml/Selector.qml +++ b/src/plugins/qmldesigner/components/itemlibrary/qml/Selector.qml @@ -35,11 +35,10 @@ Item { id: selector ItemsViewStyle { id: style } - SystemPalette { id:systemPalette } Rectangle { anchors.fill: parent - color: systemPalette.highlight + color: highlightColor clip:true Rectangle { width:parent.width-1 @@ -47,8 +46,8 @@ Item { y:-parent.height/2 height:parent.height gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(systemPalette.highlight) } - GradientStop { position: 1.0; color: systemPalette.highlight } + GradientStop { position: 0.0; color: Qt.lighter(highlightColor) } + GradientStop { position: 1.0; color: highlightColor } } } @@ -58,8 +57,8 @@ Item { y:parent.height/2 height:parent.height gradient: Gradient { - GradientStop { position: 0.0; color: systemPalette.highlight } - GradientStop { position: 1.0; color: Qt.darker(systemPalette.highlight) } + GradientStop { position: 0.0; color: highlightColor } + GradientStop { position: 1.0; color: Qt.darker(highlightColor) } } } } @@ -70,7 +69,7 @@ Item { anchors.topMargin:1 anchors.rightMargin:2 height:1 - color:Qt.lighter(systemPalette.highlight) + color:Qt.lighter(highlightColor) } Rectangle { anchors.right:parent.right @@ -79,7 +78,7 @@ Item { anchors.bottomMargin:1 anchors.leftMargin:2 height:1 - color:Qt.darker(systemPalette.highlight) + color:Qt.darker(highlightColor) } Rectangle { anchors.left:parent.left @@ -88,10 +87,9 @@ Item { anchors.leftMargin:1 anchors.bottomMargin:2 width:1 - //color:Qt.lighter(systemPalette.highlight) gradient: Gradient { - GradientStop { position: 0.0; color: Qt.lighter(systemPalette.highlight) } - GradientStop { position: 1.0; color: systemPalette.highlight } + GradientStop { position: 0.0; color: Qt.lighter(highlightColor) } + GradientStop { position: 1.0; color: highlightColor } } } Rectangle { @@ -101,10 +99,9 @@ Item { anchors.rightMargin:1 anchors.topMargin:2 width:1 - //color:Qt.darker(systemPalette.highlight) gradient: Gradient { - GradientStop { position: 0.0; color: systemPalette.highlight } - GradientStop { position: 1.0; color: Qt.darker(systemPalette.highlight) } + GradientStop { position: 0.0; color: highlightColor } + GradientStop { position: 1.0; color: Qt.darker(highlightColor) } } } } diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp index 2763092165af6f7952ef94c8a4c8902d25d8cc55..2408609145de7c0059bd1b07a16294e4dd8646a3 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreeview.cpp @@ -42,17 +42,21 @@ namespace QmlDesigner { static void drawSelectionBackground(QPainter *painter, const QStyleOption &option) { + QWidget colorReference; + painter->save(); QLinearGradient gradient; - QColor highlight = option.palette.highlight().color(); - gradient.setColorAt(0, highlight.lighter(130)); - gradient.setColorAt(1, highlight.darker(130)); + QColor highlightColor = colorReference.palette().highlight().color(); + if (0.5*highlightColor.saturationF()+0.75-highlightColor.valueF() < 0) + highlightColor.setHsvF(highlightColor.hsvHueF(),0.1 + highlightColor.saturationF()*2.0, highlightColor.valueF()); + gradient.setColorAt(0, highlightColor.lighter(130)); + gradient.setColorAt(1, highlightColor.darker(130)); gradient.setStart(option.rect.topLeft()); gradient.setFinalStop(option.rect.bottomLeft()); painter->fillRect(option.rect, gradient); - painter->setPen(highlight.lighter()); + painter->setPen(highlightColor.lighter()); painter->drawLine(option.rect.topLeft(),option.rect.topRight()); - painter->setPen(highlight.darker()); + painter->setPen(highlightColor.darker()); painter->drawLine(option.rect.bottomLeft(),option.rect.bottomRight()); painter->restore(); } @@ -94,6 +98,8 @@ public: painter->drawRect(rect.adjusted(0, 0, -1, -1)); } painter->restore(); + } else if (element == PE_FrameFocusRect) { + // don't draw } else { QProxyStyle::drawPrimitive(element, option, painter, widget); } @@ -217,6 +223,7 @@ void IdItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, co void IdItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const { + Q_UNUSED(index); QLineEdit *lineEdit = static_cast<QLineEdit*>(editor); lineEdit->setGeometry(option.rect); } diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 284e2b88618521aee45e63c49a7b805e8fc1f77d..b4af32522366433fd91798037941b4f748bc859d 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -165,6 +165,10 @@ StatesEditorWidget::StatesEditorWidget(QWidget *parent): m_d->listView->setResizeMode(QDeclarativeView::SizeRootObjectToView); m_d->listView->rootContext()->setContextProperty(QLatin1String("statesEditorModel"), m_d->statesEditorModel.data()); + QColor highlightColor = palette().highlight().color(); + if (0.5*highlightColor.saturationF()+0.75-highlightColor.valueF() < 0) + highlightColor.setHsvF(highlightColor.hsvHueF(),0.1 + highlightColor.saturationF()*2.0, highlightColor.valueF()); + m_d->listView->rootContext()->setContextProperty(QLatin1String("highlightColor"), highlightColor); // Work around ASSERT in the internal QGraphicsScene that happens when // the scene is created + items set dirty in one event loop run (BAUHAUS-459) diff --git a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml index af892cb491602fdfeebf8513dbfcb1fd2ea76c1d..43d1172621fee41dc3785d05215ef7df0cbc8fef 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml +++ b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml @@ -37,9 +37,6 @@ Rectangle { if (currentStateIndex<0) currentStateIndex=0; else unFocus(); } - // Colors - SystemPalette { id:systemPalette; } - Flickable { id: listView @@ -117,7 +114,7 @@ Rectangle { Rectangle { id: highlight anchors.fill: parent - color:parent.isCurrentState?systemPalette.highlight:"#4F4F4F"; + color:parent.isCurrentState?highlightColor:"#4F4F4F"; clip:true Rectangle { width:parent.width