From c44945032d33919e7233f55a4bc5970f42d06b3b Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 13 Jul 2016 16:50:31 +0200 Subject: [PATCH] QmlDesigner: Adding icons for property editor to icon provider Change-Id: I0869138783230fe3ff54e59e4d9094d23f5d42cc Reviewed-by: Alessandro Portale --- .../HelperWidgets/CustomComboBoxStyle.qml | 10 +-- .../HelperWidgets/CustomSpinBoxStyle.qml | 8 ++- .../HelperWidgets/ExtendedFunctionButton.qml | 15 ++--- .../HelperWidgets/Section.qml | 5 +- .../HelperWidgets/images/down-arrow.png | Bin 113 -> 112 bytes .../HelperWidgets/images/down-arrow@2x.png | Bin 142 -> 129 bytes .../HelperWidgets/images/expression.png | Bin 265 -> 398 bytes .../HelperWidgets/images/expression@2x.png | Bin 910 -> 798 bytes .../HelperWidgets/images/placeholder.png | Bin 194 -> 107 bytes .../HelperWidgets/images/placeholder@2x.png | Bin 282 -> 167 bytes .../HelperWidgets/images/submenu.png | Bin 240 -> 148 bytes .../HelperWidgets/images/submenu@2x.png | Bin 354 -> 218 bytes .../HelperWidgets/images/up-arrow.png | Bin 105 -> 101 bytes .../HelperWidgets/images/up-arrow@2x.png | Bin 133 -> 121 bytes .../componentcore/qmldesignericonprovider.cpp | 37 +++++++++++ src/tools/icons/qtcreatoricons.svg | 59 ++++++++++-------- 16 files changed, 94 insertions(+), 40 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml index 6be6b7d4652..4f5600a0101 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml @@ -54,7 +54,7 @@ ComboBoxStyle { } Rectangle { - color: "#333" + color: creatorTheme.IconsBaseColor width: 1 anchors.right: imageItem.left anchors.topMargin: 4 @@ -66,11 +66,13 @@ ComboBoxStyle { Image { id: imageItem - source: "images/down-arrow.png" + width: 8 + height: 4 + source: "image://icons/down-arrow" anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right - anchors.rightMargin: 10 - opacity: control.enabled ? 0.7 : 0.5 + anchors.rightMargin: 8 + opacity: control.enabled ? 1 : 0.5 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml index 0130b4ca5aa..82adcd00e4d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml @@ -43,7 +43,9 @@ SpinBoxStyle { implicitHeight: parent.height/2 opacity: styleData.upEnabled ? styleData.upPressed ? 0.5 : 1 : 0.5 Image { - source: "images/up-arrow.png" + width: 8 + height: 4 + source: "image://icons/up-arrow" x: 1 y: 5 } @@ -54,7 +56,9 @@ SpinBoxStyle { implicitHeight: parent.height/2 opacity: styleData.downEnabled ? styleData.downPressed ? 0.5 : 1 : 0.5 Image { - source: "images/down-arrow.png" + width: 8 + height: 4 + source: "image://icons/down-arrow" x: 1 y: 2.5 // Hack! Spinbox sets an non-int offset, somewhere } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml index 687d4d69231..0e795d190b4 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml @@ -37,26 +37,25 @@ Item { property variant backendValue - property string icon: "images/placeholder.png" - property string hoverIcon: "images/submenu.png"; + property string icon: "image://icons/placeholder" + property string hoverIcon: "image://icons/submenu" property bool active: true function setIcon() { if (backendValue == null) { - extendedFunctionButton.icon = "images/placeholder.png" + extendedFunctionButton.icon = "image://icons/placeholder" } else if (backendValue.isBound ) { if (backendValue.isTranslated) { //translations are a special case - extendedFunctionButton.icon = "images/placeholder.png" + extendedFunctionButton.icon = "image://icons/placeholder" } else { - extendedFunctionButton.icon = "images/expression.png" + extendedFunctionButton.icon = "image://icons/expression" } } else { if (backendValue.complexNode != null && backendValue.complexNode.exists) { - //extendedFunctionButton.icon = "images/behaivour.png" } else { - extendedFunctionButton.icon = "images/placeholder.png" + extendedFunctionButton.icon = "image://icons/placeholder" } } } @@ -86,6 +85,8 @@ Item { } Image { + width: 14 + height: 14 source: extendedFunctionButton.icon anchors.centerIn: parent } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml index 4d38c857f2a..3d185399956 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml @@ -55,12 +55,15 @@ Item { Image { id: arrow - source: "images/down-arrow.png" + width: 8 + height: 4 + source: "image://icons/down-arrow" anchors.left: parent.left anchors.leftMargin: 4 anchors.verticalCenter: parent.verticalCenter Behavior on rotation { NumberAnimation { + easing.type: Easing.OutCubic duration: animationDuration } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/down-arrow.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/down-arrow.png index 5780560f7d2c1019e63a69608499eccf7ebb035e..a28f1e3713c5880c5fab69f33bb7da61a009c882 100644 GIT binary patch delta 93 zcmXRcm>?0s!py+H;P^QCFarYve}GSjD+2>VeSLjHLqkVL$N&HTr;1tUGcYj7c)B=- xaL6VbBqSsx6{IBuBo-JZ6eSiEiWD+32pncI+)z8spMima!PC{xWt~$(697pI9RdIV delta 94 zcmXRYoFEa&!N$PAu=#A=2L=WP3r`ov5RRFpJsWu$6nG9_O0G(FKXk0$j!mpZLLrFF zJ&Z}i)A_xH%1dQSzM-L^qod>h|Nm3Ptn(Qd7<4^d z978x{Sr0M_9x&iw+3|>lDQO3c>z`*dKtbRHJ14F2%i(`n!#JOh<@-{edxLjN)k#%SBo3nEDhE;)! z*D3CpT+m=}zCkVXYRn;(Od-zl_hotZ6AQlUd6w-Lo4DGBf%Qq?KNg`Bjpd9|8)P?6 g>DE_iI8j$7cgmo!CdN0Kfq{X+)78&qol`;+0I*Xp$N&HU diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/expression.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/expression.png index 93754ed8e250b4d7c2bf62472ec176d8e978ed1a..d13cf9fad9f26a2270e51280742c9f70e62d9cce 100644 GIT binary patch delta 382 zcmeBV>SLZDSdH#ZLt4=*n-KR>^K zfPk>Du$Y*bxVX54goLD|q?DADw6wI5k&&61nZ3QegM)*kqob3Ple4q4i;Ih!o1444 zyN{2LzrTM#KtOPCa7ai@bKZoM~@yodGh4x)2A<9y!iR^=kMRY z|Ni~^@87@w|NlGq2W)0wU|=o@@(cd;```PFt6Lcu7@9p@978x{RS$MbH9CkiT+HSV zOqudV$$F;7$Nm3{e@ZXymK;~_d{1WwB}UztUIgyLqBTX_Yp0AE}~etIlAX8XYAEKdcmD{ z{APSS7uoyWMFi%edXSH~7rEkCAGtcKF`Aa>OQORZCB+ z?Uhwer7T%vx1XJ%=pOYnIPY(RWc;@MG1vcBe6jBO!?;|w=xXYMb@vz;7#KWV{an^L HB{Ts5J2`cv diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/expression@2x.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/expression@2x.png index 560c7e2d5a91d58ff0fdeba2c07bbf4c57dd32f7..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h2G`5_%NQ6Kn*)48Tp1V`{=>lj{rk_H zIdl8=?fdudKYRA<;>C+suU@@znckbMQGa$O)vJf-jra`z66Cf(#BKWxwWe|%XY&ePR z0AxXklOT4%#gQ2h(;Tm#Q)OUaXebHt3ua(sVrF4w=iuVz;pO8O5EK>>6%&_`QP9*i zuyk;8c5!v{^z!lb^A89N3JwVikB&`BO-s+p$;&S&EG#N1uWjh;?3ple(&Q=Arp=nO zcI)=N`wtvCeDv7ylc!FfJAdKgrOQ{YUb}wd=B?Xz?%un9|G|^zuik(B^yTZ~P2 z`u+FczZ1`{6*4d|T6wxShDb=39%MInN@QSrFn!0Ql#~=`w8 zm+yWqom0I3_RC6z)ltRDi^YB|JoQat;<-QPTpndq%!~F2ewgmHNv!IWrT*<+x8tIV zxl;Uoi|BJN+!RyHu_<~IABU_>i%NFh?{+ng)*eTFKVuf|`fuW!6)YDBJE@-(NXcvK zTByZWyyzYyFY|&s#&<%q-u8X45SLol&bmPHq)5EvmRUR4bBfXmzW;136yDNv`OjaQ zxia}*W;FG>&h5+6P2PD2EnK*Cwz+3hEP0Iz}dp(ZN(sr<{y2KH`ldChabriZ6D zA35AF(8{d+WlHa?Id<j@pOsZMJh0kYpIPcyP-*x7 s|B>zoySCKjmAMwk@A$OCcF7G%hHQ@QY#t{h7lTakboFyt=akR{0HF*bJpcdz delta 176 zcmc~k#5h5+o{fQlLEc06A_D_Mr>Bc!h{nXXy^4HHh9WNi|Cq%;+_*%11v3w4d*oR; zwkJixLMqjb%cPESuE@AlcV-pS$*PJxwa-Q__4}H(br`PeF=TGgZICuDKew}b_v39F zuFYeN3G(s|-Fq#n-M>FyNpNlPIraB{H%}=Fxq4Pd@PLL=yOzMArkT}BQt6#%?g(Ct hbCF{x3;yRBcT-PQbldTWXABGs44$rjF6*2UngHtGNB95$ diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/placeholder@2x.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/placeholder@2x.png index abe5d8aa9a6512fd7fb94071a8575c998c580e0b..305619812d9f248f1f73acf9765a4e3da781fd20 100644 GIT binary patch delta 150 zcmbQmw48B*WIY1|14DRPg9ifxL!PILV~EE2T*cvg0&BX-lwPDYkj z8$92oC%v!wU#Db!*->ZGH=bC9Rm}$lyH)rPR||Zd)+pYsqVF?_zk3PuVV91Lei16> zMjOiaRo^~%tb}8B_^ShPiCIVGIN0Y_RLte;Ju-!XVXyz~S-Sl0Z-hWj@O1TaS?83{ F1OO2`J!b#_ literal 282 zcmeAS@N?(olHy`uVBq!ia0y~yV2}Y}4rT@h2G`5_%NQ6K0t0+PTp1V`?%%)v@ZrO& zSFhf@dGpq-TerdB77T!Sx8dRtE*>)c-Su}23=C2wL4Lsu0)j%eb`E}drDf$+HH~}s z?LYAG)8{Wge*X1xeK?tcfg#S*#W6%e^6f!Srb7w>ECJ`L#K{;ADel{&Hb*^?1>*EId&T|eh~=h lkvewCa{BDF_ca&4PS!WdnPL_k9mxZ-&ePS;Wt~$(699_VH#7hM literal 240 zcmeAS@N?(olHy`uVBq!ia0y~yVBiB`4rT@h290TVA2Tp8*a!H8xH2#>JbwK6*|TTY zuV2571nz(Vk^q8v=gu8Cr*P+qRSXOaA|*k7!3>;S3ikC4jZM4v9zAya*6lm@fBaVDRyDaSY**oqDiSut9-`+0a24D+8o%(%#mxzv;>)!PTD_aB zMJB&1I4sg|i}`vcm+8HNnOn}D;834>Su;Xq>%~P6E^`NdVlJF>+~1Ocfq}u()z4*} HQ$iB}mqT-! diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/submenu@2x.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/submenu@2x.png index 49d77d15f38216eeb4aa2c69ac01af0ce1132676..58d6320b77d1cf948ea02d1d73d153ec63bf3b09 100644 GIT binary patch delta 201 zcmaFFbc=CgTe~ HDWM4f#V=P! literal 354 zcmeAS@N?(olHy`uVBq!ia0y~yV2}Y}4rT@h2G`5_%NQ6K5(0ceTp1V`Zrr$W=gytG zU~u#1&0Du_LAbZT;5HcCxpU{%ty^FwcH+*RJ6I(awp8t7U|^6h3GxeOP*hP>v$b<_ zc5!X!m@#wK>^b}PA2@jJ`i<9b-+lc2#cIh#Lk0$hNuDl_Arg{T4{{1M83?c(nCRTs z+i@b*;LQJe&LtX?4lwKN{9)tu)KBOhqJ+>xC;=Z?DEGLgoVMegn&OnFK^OtCrn zaE}O6&_PMf4;<_kZ6OvMnGYl;aak+=Y&9-Y-O#dH&hKpRA+H^k2Q)J{6}A{vL`5lW zk@}G*UsclLu&VNcrr#s;a^IHKdtUXvT+Oq8D?{x@F^Oc^i!BTc3=E#GelF{r5}E)H CWVONo diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/up-arrow.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/up-arrow.png index 42934bfad0f8e2579dc7a6a90094ca116fb3906e..13792106852292464069be8a16abbc585521d674 100644 GIT binary patch delta 82 zcmc~yogm@M#LU3JaBlImWCjKXo&cW^R|W=#^78Wf`uhL>|IbO?Si-=-AmZub7{Vc& n{3HDQ2j_VY8Lgd}l^NuinE#&Ny#6Eu0|SGntDnm{r-UW|OBfrt delta 86 zcmYezoFEa%!N$PAu=#A=2L=WP15X#n5RRG22@Xu#^Y7>FsQq2W&TPgo^$-8i0@oe` sPd2u;Dihnet5&TN?XggK*u~JiL1x0F#TN}27#J8lUHx3vIVCg!01Y-Cy8r+H diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/up-arrow@2x.png b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/up-arrow@2x.png index 455c36f2f5b831343bafd7af51ce0ad80b9e6594..2f2fc059557d3b875633da9ec04dcf238387277c 100644 GIT binary patch delta 103 zcmZo=tehZ`$i&RRz|bo(orQscfhWKx#Fc@8p}f4jzP|qd|NnDRHzopr05(@4N&o-= delta 115 zcmbbZgTBMhlb2CM-u8m}YI1Vlr>=I4jX+FlnLWQ2{q2)5E-s4C!AD Wrd&$gdW(U9fx*+&&t;ucLK6V(&?~+G diff --git a/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp b/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp index dccde246337..04db689f4c1 100644 --- a/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp +++ b/src/plugins/qmldesigner/components/componentcore/qmldesignericonprovider.cpp @@ -26,6 +26,9 @@ #include "qmldesignericonprovider.h" #include +#include + +#include namespace QmlDesigner { @@ -35,10 +38,30 @@ QmlDesignerIconProvider::QmlDesignerIconProvider() } +static QString iconPath() +{ + return Core::ICore::resourcePath() + QLatin1String("/qmldesigner/propertyEditorQmlSources/HelperWidgets/images/"); +} + QPixmap QmlDesignerIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) { Q_UNUSED(requestedSize) + static Utils::Icon UP_ARROW({ + { iconPath() + QLatin1String("up-arrow.png"), Utils::Theme::IconsBaseColor}}); + + static Utils::Icon DOWN_ARROW({ + { iconPath() + QLatin1String("down-arrow.png"), Utils::Theme::IconsBaseColor}}); + + static Utils::Icon PLACEHOLDER({ + { iconPath() + QLatin1String("placeholder.png"), Utils::Theme::IconsBaseColor}}); + + static Utils::Icon EXPRESSION({ + { iconPath() + QLatin1String("expression.png"), Utils::Theme::IconsBaseColor}}); + + static Utils::Icon SUBMENU({ + { iconPath() + QLatin1String("submenu.png"), Utils::Theme::IconsBaseColor}}); + QPixmap result; if (id == "close") @@ -46,6 +69,20 @@ QPixmap QmlDesignerIconProvider::requestPixmap(const QString &id, QSize *size, c else if (id == "plus") result = Core::Icons::PLUS.pixmap(); + else if (id == "expression") + result = EXPRESSION.pixmap(); + else if (id == "placeholder") + result = PLACEHOLDER.pixmap(); + else if (id == "expression") + result = EXPRESSION.pixmap(); + else if (id == "submenu") + result = SUBMENU.pixmap(); + else if (id == "up-arrow") + result = UP_ARROW.pixmap(); + else if (id == "down-arrow") + result = DOWN_ARROW.pixmap(); + else + qWarning() << Q_FUNC_INFO << "Image not found."; if (size) *size = result.size(); diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 74c58ce6e25..ef2b3bbce2b 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -1482,18 +1482,25 @@ + + style="fill:#000000;fill-opacity:1.0;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - + style="fill:#ffffff" /> + - + style="fill:#ffffff" /> + + -