Merge pull request #3778 from nirvn/style_manager_ui_imp

[style manager] improve UI
This commit is contained in:
Nyall Dawson 2016-11-18 17:46:22 +10:00 committed by GitHub
commit fc18fd98cc
13 changed files with 951 additions and 217 deletions

View File

@ -492,7 +492,7 @@
<file>themes/default/scale_bar.png</file>
<file>themes/default/stars_empty.png</file>
<file>themes/default/stars_full.png</file>
<file>themes/default/styleicons/color.png</file>
<file>themes/default/styleicons/color.svg</file>
<file>themes/default/styleicons/style-line.png</file>
<file>themes/default/styleicons/style-point.png</file>
<file>themes/default/styleicons/style-polygon.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,608 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16"
height="16"
id="svg5692"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="mIconColorramp.svg"
inkscape:export-filename="/media/home1/robert/svn/graphics/trunk/toolbar-icons/16x16/point-layer.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
style="display:inline">
<title
id="title4018">point layer</title>
<defs
id="defs5694">
<linearGradient
id="linearGradient3657">
<stop
style="stop-color:#fce94f;stop-opacity:1;"
offset="0"
id="stop3659" />
<stop
style="stop-color:#e7ce04;stop-opacity:1;"
offset="1"
id="stop3661" />
</linearGradient>
<linearGradient
id="linearGradient2877">
<stop
style="stop-color:#edd400;stop-opacity:1;"
offset="0"
id="stop2879" />
<stop
style="stop-color:#c2ad00;stop-opacity:1;"
offset="1"
id="stop2881" />
</linearGradient>
<linearGradient
id="linearGradient4042">
<stop
style="stop-color:#f2d6a9;stop-opacity:1;"
offset="0"
id="stop4044" />
<stop
style="stop-color:#e9b96e;stop-opacity:1;"
offset="1"
id="stop4046" />
</linearGradient>
<linearGradient
id="linearGradient2843">
<stop
style="stop-color:#eeeeec;stop-opacity:1;"
offset="0"
id="stop2845" />
<stop
style="stop-color:#c8c8c2;stop-opacity:1;"
offset="1"
id="stop2847" />
</linearGradient>
<linearGradient
id="linearGradient2835">
<stop
style="stop-color:#ccf2a6;stop-opacity:1;"
offset="0"
id="stop2837" />
<stop
style="stop-color:#8ae234;stop-opacity:1;"
offset="1"
id="stop2839" />
</linearGradient>
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 16 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="32 : 16 : 1"
inkscape:persp3d-origin="16 : 10.666667 : 1"
id="perspective3257" />
<inkscape:perspective
id="perspective6979"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective7934"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective8023"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective8057"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective8095"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective8219"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective8279"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3803"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3869"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3929"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3968"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4002"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4032"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective4053"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2905"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2979"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2842"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective2978"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3238"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042"
id="radialGradient4048"
cx="0.5"
cy="17.838446"
fx="0.5"
fy="17.838446"
r="6.1587391"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-0.4170292)"
gradientUnits="userSpaceOnUse" />
<inkscape:perspective
id="perspective4058"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042-2"
id="radialGradient4048-2"
cx="8.5770311"
cy="3.8663561"
fx="8.5770311"
fy="3.8663561"
r="6.1587391"
gradientTransform="matrix(0.81185454,1.1365964,-1.1707271,0.83623306,20.063146,-1.4817979)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient4042-2">
<stop
style="stop-color:#f2d6a9;stop-opacity:1;"
offset="0"
id="stop4044-8" />
<stop
style="stop-color:#e9b96e;stop-opacity:1;"
offset="1"
id="stop4046-4" />
</linearGradient>
<radialGradient
r="6.1587391"
fy="17.838446"
fx="0.5"
cy="17.838446"
cx="0.5"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-8.4170292)"
gradientUnits="userSpaceOnUse"
id="radialGradient4067"
xlink:href="#linearGradient4042-2"
inkscape:collect="always" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042-2"
id="radialGradient4094"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.81185454,1.1365964,-1.1707271,0.83623306,20.063146,-1.4817979)"
cx="8.5770311"
cy="3.8663561"
fx="8.5770311"
fy="3.8663561"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042-2"
id="radialGradient4097"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.81185454,1.1365964,-1.1707271,0.83623306,20.063146,-1.4817979)"
cx="8.5770311"
cy="3.8663561"
fx="8.5770311"
fy="3.8663561"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042-2"
id="radialGradient4100"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.81185454,1.1365964,-1.1707271,0.83623306,20.063146,-1.4817979)"
cx="8.5770311"
cy="3.8663561"
fx="8.5770311"
fy="3.8663561"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042-2"
id="radialGradient4103"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.81185454,1.1365964,-1.1707271,0.83623306,20.063146,-1.4817979)"
cx="8.5770311"
cy="3.8663561"
fx="8.5770311"
fy="3.8663561"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042"
id="radialGradient4106"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-0.4170292)"
cx="0.5"
cy="17.838446"
fx="0.5"
fy="17.838446"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042"
id="radialGradient4109"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-0.4170292)"
cx="0.5"
cy="17.838446"
fx="0.5"
fy="17.838446"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042"
id="radialGradient4112"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-0.4170292)"
cx="0.5"
cy="17.838446"
fx="0.5"
fy="17.838446"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042"
id="radialGradient4115"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-0.4170292)"
cx="0.5"
cy="17.838446"
fx="0.5"
fy="17.838446"
r="6.1587391" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient4042"
id="radialGradient4118"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.8118545,0.97422537,-1.1052481,0.9210397,19.809981,-0.4170292)"
cx="0.5"
cy="17.838446"
fx="0.5"
fy="17.838446"
r="6.1587391" />
<inkscape:perspective
id="perspective8198"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3657"
id="linearGradient3669"
gradientUnits="userSpaceOnUse"
x1="10.5"
y1="10.5"
x2="13.5"
y2="18.5"
gradientTransform="translate(0,-3)" />
<inkscape:perspective
id="perspective2937"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3736"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<inkscape:perspective
id="perspective3790"
inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
inkscape:vp_z="1 : 0.5 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_x="0 : 0.5 : 1"
sodipodi:type="inkscape:persp3d" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient3657"
id="linearGradient3902"
gradientUnits="userSpaceOnUse"
x1="10.5"
y1="10.5"
x2="13.5"
y2="18.5"
gradientTransform="translate(0,8)" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2"
inkscape:cx="101.94003"
inkscape:cy="57.241714"
inkscape:current-layer="layer4"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
borderlayer="false"
inkscape:window-width="1865"
inkscape:window-height="1056"
inkscape:window-x="55"
inkscape:window-y="24"
inkscape:window-maximized="1"
showguides="false"
inkscape:guide-bbox="true"
inkscape:snap-bbox="true">
<inkscape:grid
type="xygrid"
id="grid5700"
empspacing="5"
visible="true"
enabled="true"
snapvisiblegridlinesonly="true"
dotted="true"
originx="2.5px"
originy="2.5px" />
</sodipodi:namedview>
<metadata
id="metadata5697">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>point layer</dc:title>
<dc:date>2011-03-11</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Robert Szczepanek</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Robert Szczepanek</dc:title>
</cc:Agent>
</dc:rights>
<dc:subject>
<rdf:Bag>
<rdf:li>icon</rdf:li>
<rdf:li>gis</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:coverage>GIS icons 0.2</dc:coverage>
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/3.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/3.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="1"
style="display:inline"
transform="translate(0,-16)">
<g
id="g3374"
transform="translate(14.519729,40.850891)">
<path
d="m 0.48027086,-16.850891 a 7,7 0 0 1 -2.05025256,4.949747 l -4.9497474,-4.949747 z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="-16.850891"
sodipodi:cx="-6.5197291"
sodipodi:type="arc"
id="path3267"
style="opacity:1;fill:#eb3131;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="matrix(0.70710678,0.70710678,-0.70710678,0.70710678,0,0)"
d="m -9.5255241,-7.3052349 a 7,7 0 0 1 -2.0502529,4.9497474 l -4.949747,-4.9497474 z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="-7.3052349"
sodipodi:cx="-16.525524"
sodipodi:type="arc"
id="path3267-3"
style="display:inline;opacity:1;fill:#b11c2d;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="matrix(0,1,-1,0,0,0)"
d="M -9.8508911,6.5197291 A 7,7 0 0 1 -11.901144,11.469477 L -16.850891,6.5197291 Z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="6.5197291"
sodipodi:cx="-16.850891"
sodipodi:type="arc"
id="path3267-3-6"
style="display:inline;opacity:1;fill:#e47acd;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="matrix(-0.70710678,0.70710678,-0.70710678,-0.70710678,0,0)"
d="M -0.30523491,16.525524 A 7,7 0 0 1 -2.3554874,21.475272 L -7.3052349,16.525524 Z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="16.525524"
sodipodi:cx="-7.3052349"
sodipodi:type="arc"
id="path3267-3-6-7"
style="display:inline;opacity:1;fill:#6994d3;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="scale(-1,-1)"
d="m 13.519729,16.850891 a 7,7 0 0 1 -2.050252,4.949748 L 6.5197291,16.850891 Z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="16.850891"
sodipodi:cx="6.5197291"
sodipodi:type="arc"
id="path3267-3-6-7-5"
style="display:inline;opacity:1;fill:#3eae35;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="matrix(-0.70710678,-0.70710678,0.70710678,-0.70710678,0,0)"
d="M 23.525524,7.3052349 A 7,7 0 0 1 21.475272,12.254982 L 16.525524,7.3052349 Z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="7.3052349"
sodipodi:cx="16.525524"
sodipodi:type="arc"
id="path3267-3-6-7-5-3"
style="display:inline;opacity:1;fill:#89df34;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="matrix(0,-1,1,0,0,0)"
d="m 23.850891,-6.5197291 a 7,7 0 0 1 -2.050252,4.9497474 l -4.949748,-4.9497474 z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="-6.5197291"
sodipodi:cx="16.850891"
sodipodi:type="arc"
id="path3267-3-6-7-5-3-5"
style="display:inline;opacity:1;fill:#fce94f;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<path
transform="matrix(0.70710678,-0.70710678,0.70710678,0.70710678,0,0)"
d="m 14.305235,-16.525524 a 7,7 0 0 1 -2.050253,4.949747 l -4.9497471,-4.949747 z"
sodipodi:end="0.78539816"
sodipodi:start="0"
sodipodi:ry="7"
sodipodi:rx="7"
sodipodi:cy="-16.525524"
sodipodi:cx="7.3052349"
sodipodi:type="arc"
id="path3267-3-6-7-5-3-5-6"
style="display:inline;opacity:1;fill:#e4972d;fill-opacity:1;stroke:none;stroke-width:0.30000001;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -236,6 +236,18 @@ class QgsStyle : QObject
*/
QStringList tagsOfSymbol( StyleEntity type, const QString& symbol );
/** Returns wheter a given tag is associated with the symbol
*
* \param type is either SymbolEntity or ColorrampEntity
* \param symbol is the name of the symbol or color ramp
* \param tag the name of the tag to look for
* \return A boolean value identicating whether a tag was found attached to the symbol
*/
bool symbolHasTag( StyleEntity type, const QString& symbol, const QString& tag );
//! Returns the tag name for the given id
QString tag( int id ) const;
//! Returns the smart groups map with id as key and name as value
QMap<int, QString> smartgroupsListMap();

View File

@ -34,7 +34,11 @@ class QgsStyleManagerDialog : QDialog
void groupChanged( const QModelIndex& );
void groupRenamed( QStandardItem * );
void addGroup();
//! add a tag
int addTag();
//! add a smartgroup
int addSmartgroup();
//! remove a tag or smartgroup
void removeGroup();
//! carry out symbol tagging using check boxes
@ -68,7 +72,7 @@ class QgsStyleManagerDialog : QDialog
//! Remove selected symbols from favorites
void removeFavoriteSelectedSymbols();
//! Tag selected symbols using menu item selection
void tagSelectedSymbols();
void tagSelectedSymbols( bool newTag = false );
//! Remove all tags from selected symbols
void detagSelectedSymbols();

View File

@ -842,16 +842,19 @@ bool QgsStyle::tagSymbol( StyleEntity type, const QString& symbol, const QString
sqlite3_finalize( ppStmt );
// Now map the tag to the symbol
query = type == SymbolEntity
? sqlite3_mprintf( "INSERT INTO tagmap VALUES (%d,%d)", tagid, symbolid )
: sqlite3_mprintf( "INSERT INTO ctagmap VALUES (%d,%d)", tagid, symbolid );
char *zErr = nullptr;
nErr = sqlite3_exec( mCurrentDB, query, nullptr, nullptr, &zErr );
if ( nErr )
// Now map the tag to the symbol if it's not already tagged
if ( !symbolHasTag( type, symbol, tag ) )
{
QgsDebugMsg( zErr );
query = type == SymbolEntity
? sqlite3_mprintf( "INSERT INTO tagmap VALUES (%d,%d)", tagid, symbolid )
: sqlite3_mprintf( "INSERT INTO ctagmap VALUES (%d,%d)", tagid, symbolid );
char *zErr = nullptr;
nErr = sqlite3_exec( mCurrentDB, query, nullptr, nullptr, &zErr );
if ( nErr )
{
QgsDebugMsg( zErr );
}
}
}
}
@ -995,6 +998,64 @@ QStringList QgsStyle::tagsOfSymbol( StyleEntity type, const QString& symbol )
return tagList;
}
bool QgsStyle::symbolHasTag( StyleEntity type, const QString& symbol, const QString& tag )
{
if ( !mCurrentDB )
{
QgsDebugMsg( "Sorry! Cannot open database for getting the tags." );
return false;
}
int symbolid = type == SymbolEntity ? symbolId( symbol ) : colorrampId( symbol );
if ( !symbolid )
{
return false;
}
int tagid = tagId( tag );
if ( !tagid )
{
return false;
}
// get the ids of tags for the symbol
char *query = type == SymbolEntity
? sqlite3_mprintf( "SELECT tag_id FROM tagmap WHERE tag_id=%d AND symbol_id=%d", tagid, symbolid )
: sqlite3_mprintf( "SELECT tag_id FROM ctagmap WHERE tag_id=%d AND colorramp_id=%d", tagid, symbolid );
sqlite3_stmt *ppStmt;
int nErr = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr );
if ( nErr == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
{
return true;
}
else
{
return false;
}
}
QString QgsStyle::tag( int id ) const
{
if ( !mCurrentDB )
return QString();
sqlite3_stmt *ppStmt;
char *query = sqlite3_mprintf( "SELECT name FROM tag WHERE id=%d", id );
int nError = sqlite3_prepare_v2( mCurrentDB, query, -1, &ppStmt, nullptr );
QString tag;
if ( nError == SQLITE_OK && sqlite3_step( ppStmt ) == SQLITE_ROW )
{
tag = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( ppStmt, 0 ) ) );
}
sqlite3_finalize( ppStmt );
return tag;
}
int QgsStyle::getId( const QString& table, const QString& name )
{
char *query = sqlite3_mprintf( "SELECT id FROM %q WHERE LOWER(name)='%q'", table.toUtf8().constData(), name.toUtf8().toLower().constData() );

View File

@ -301,6 +301,18 @@ class CORE_EXPORT QgsStyle : public QObject
*/
QStringList tagsOfSymbol( StyleEntity type, const QString& symbol );
/** Returns wheter a given tag is associated with the symbol
*
* \param type is either SymbolEntity or ColorrampEntity
* \param symbol is the name of the symbol or color ramp
* \param tag the name of the tag to look for
* \return A boolean value identicating whether a tag was found attached to the symbol
*/
bool symbolHasTag( StyleEntity type, const QString& symbol, const QString& tag );
//! Returns the tag name for the given id
QString tag( int id ) const;
//! Returns the smart groups map with id as key and name as value
QgsSymbolGroupMap smartgroupsListMap();

View File

@ -30,13 +30,14 @@
#include "qgsstyleexportimportdialog.h"
#include "qgssmartgroupeditordialog.h"
#include <QAction>
#include <QFile>
#include <QFileDialog>
#include <QInputDialog>
#include <QMessageBox>
#include <QPushButton>
#include <QSettings>
#include <QStandardItemModel>
#include <QAction>
#include <QMenu>
#include "qgsapplication.h"
@ -59,28 +60,33 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle* style, QWidget* parent )
mSplitter->restoreState( settings.value( QStringLiteral( "/Windows/StyleV2Manager/splitter" ) ).toByteArray() );
tabItemType->setDocumentMode( true );
searchBox->setPlaceholderText( tr( "Type here to filter symbols..." ) );
searchBox->setPlaceholderText( tr( "Filter symbols…" ) );
connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) );
connect( listItems, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( editItem() ) );
connect( btnAddItem, SIGNAL( clicked() ), this, SLOT( addItem() ) );
connect( actnEditItem, SIGNAL( triggered( bool ) ), this, SLOT( editItem() ) );
connect( actnRemoveItem, SIGNAL( triggered( bool ) ), this, SLOT( removeItem() ) );
btnRemoveItem->setDefaultAction( actnRemoveItem );
btnEditItem->setDefaultAction( actnEditItem );
connect( btnAddItem, &QPushButton::clicked, [=]( bool ) { addItem(); }
);
connect( btnEditItem, &QPushButton::clicked, [=]( bool ) { editItem(); }
);
connect( actnEditItem, &QAction::triggered, [=]( bool ) { editItem(); }
);
connect( btnRemoveItem, &QPushButton::clicked, [=]( bool ) { removeItem(); }
);
connect( actnRemoveItem, &QAction::triggered, [=]( bool ) { removeItem(); }
);
QMenu *shareMenu = new QMenu( tr( "Share menu" ), this );
QAction *exportAction = new QAction( tr( "Export symbol(s)…" ), this );
exportAction->setIcon( QIcon( QgsApplication::iconPath( "mActionFileSave.svg" ) ) );
shareMenu->addAction( exportAction );
QAction *importAction = new QAction( tr( "Import symbol(s)…" ), this );
importAction->setIcon( QIcon( QgsApplication::iconPath( "mActionFileOpen.svg" ) ) );
shareMenu->addAction( importAction );
shareMenu->addSeparator();
shareMenu->addAction( actnExportAsPNG );
shareMenu->addAction( actnExportAsSVG );
QAction *exportAction = new QAction( tr( "Export..." ), this );
shareMenu->addAction( exportAction );
QAction *importAction = new QAction( tr( "Import..." ), this );
shareMenu->addAction( importAction );
exportAction->setIcon( QIcon( QgsApplication::iconPath( "mActionFileSave.svg" ) ) );
importAction->setIcon( QIcon( QgsApplication::iconPath( "mActionFileOpen.svg" ) ) );
connect( actnExportAsPNG, SIGNAL( triggered() ), this, SLOT( exportItemsPNG() ) );
connect( actnExportAsSVG, SIGNAL( triggered() ), this, SLOT( exportItemsSVG() ) );
connect( exportAction, SIGNAL( triggered() ), this, SLOT( exportItems() ) );
@ -106,6 +112,8 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle* style, QWidget* parent )
groupTree->setModel( groupModel );
groupTree->setHeaderHidden( true );
populateGroups();
groupTree->setCurrentIndex( groupTree->model()->index( 0, 0 ) );
connect( groupTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
this, SLOT( groupChanged( const QModelIndex& ) ) );
connect( groupModel, SIGNAL( itemChanged( QStandardItem* ) ),
@ -167,8 +175,12 @@ QgsStyleManagerDialog::QgsStyleManagerDialog( QgsStyle* style, QWidget* parent )
mGroupTreeContextMenu = new QMenu( this );
connect( actnEditSmartGroup, SIGNAL( triggered( bool ) ), this, SLOT( editSmartgroupAction() ) );
mGroupTreeContextMenu->addAction( actnEditSmartGroup );
connect( actnAddGroup, SIGNAL( triggered( bool ) ), this, SLOT( addGroup() ) );
mGroupTreeContextMenu->addAction( actnAddGroup );
connect( actnAddTag, &QAction::triggered, [=]( bool ) { addTag(); }
);
mGroupTreeContextMenu->addAction( actnAddTag );
connect( actnAddSmartgroup, &QAction::triggered, [=]( bool ) { addSmartgroup(); }
);
mGroupTreeContextMenu->addAction( actnAddSmartgroup );
connect( actnRemoveGroup, SIGNAL( triggered( bool ) ), this, SLOT( removeGroup() ) );
mGroupTreeContextMenu->addAction( actnRemoveGroup );
@ -232,6 +244,7 @@ void QgsStyleManagerDialog::on_tabItemType_currentChanged( int )
{
// when in Color Ramp tab, add menu to add item button and hide "Export symbols as PNG/SVG"
bool flag = currentItemType() != 3;
searchBox->setPlaceholderText( flag ? tr( "Filter symbols…" ) : tr( "Filter color ramps…" ) );
btnAddItem->setMenu( flag ? nullptr : mMenuBtnAddItemColorRamp );
actnExportAsPNG->setVisible( flag );
actnExportAsSVG->setVisible( flag );
@ -258,19 +271,19 @@ void QgsStyleManagerDialog::populateSymbols( const QStringList& symbolNames, boo
model->clear();
int type = currentItemType();
for ( int i = 0; i < symbolNames.count(); ++i )
{
QString name = symbolNames[i];
QgsSymbol* symbol = mStyle->symbol( name );
if ( symbol && symbol->type() == type )
{
QStringList tags = mStyle->tagsOfSymbol( QgsStyle::SymbolEntity, name );
QStandardItem* item = new QStandardItem( name );
QIcon icon = QgsSymbolLayerUtils::symbolPreviewIcon( symbol, listItems->iconSize(), 18 );
item->setIcon( icon );
item->setData( name ); // used to find out original name when user edited the name
item->setCheckable( check );
item->setToolTip( name );
item->setToolTip( QString( "<b>%1</b><br><i>%2</i>" ).arg( name ).arg( tags.count() > 0 ? tags.join( ", " ) : tr( "Not tagged" ) ) );
// add to model
model->appendRow( item );
}
@ -945,24 +958,25 @@ void QgsStyleManagerDialog::groupChanged( const QModelIndex& index )
if ( category == QLatin1String( "all" ) || category == QLatin1String( "tags" ) || category == QLatin1String( "smartgroups" ) )
{
enableGroupInputs( false );
if ( category == QLatin1String( "tags" ) || category == QLatin1String( "smartgroups" ) )
if ( category == QLatin1String( "tags" ) )
{
btnAddGroup->setEnabled( true );
actnAddGroup->setEnabled( true );
actnAddTag->setEnabled( true );
actnAddSmartgroup->setEnabled( false );
}
else if ( category == QLatin1String( "smartgroups" ) )
{
actnAddTag->setEnabled( false );
actnAddSmartgroup->setEnabled( true );
}
symbolNames = currentItemType() < 3 ? mStyle->symbolNames() : mStyle->colorRampNames();
}
else if ( category == QLatin1String( "favorite" ) )
{
btnAddGroup->setEnabled( true );
actnAddGroup->setEnabled( true );
enableGroupInputs( false );
symbolNames = mStyle->symbolsOfFavorite( type );
}
else if ( index.parent().data( Qt::UserRole + 1 ) == "smartgroups" )
{
btnRemoveGroup->setEnabled( true );
actnRemoveGroup->setEnabled( true );
btnManageGroups->setEnabled( true );
int groupId = index.data( Qt::UserRole + 1 ).toInt();
@ -980,6 +994,7 @@ void QgsStyleManagerDialog::groupChanged( const QModelIndex& index )
}
}
symbolNames.sort();
if ( currentItemType() < 3 )
{
populateSymbols( symbolNames, mGrouppingMode );
@ -995,7 +1010,8 @@ void QgsStyleManagerDialog::groupChanged( const QModelIndex& index )
}
actnEditSmartGroup->setVisible( false );
actnAddGroup->setVisible( false );
actnAddTag->setVisible( false );
actnAddSmartgroup->setVisible( false );
actnRemoveGroup->setVisible( false );
actnTagSymbols->setVisible( false );
actnFinishTagging->setVisible( false );
@ -1006,81 +1022,60 @@ void QgsStyleManagerDialog::groupChanged( const QModelIndex& index )
{
actnEditSmartGroup->setVisible( !mGrouppingMode );
}
else
else if ( index.parent().data( Qt::UserRole + 1 ).toString() == QLatin1String( "tags" ) )
{
actnAddGroup->setVisible( !mGrouppingMode );
actnAddTag->setVisible( !mGrouppingMode );
actnTagSymbols->setVisible( !mGrouppingMode );
actnFinishTagging->setVisible( mGrouppingMode );
}
actnRemoveGroup->setVisible( true );
}
else if ( index.data( Qt::UserRole + 1 ) == "tags" || index.data( Qt::UserRole + 1 ) == "smartgroups" )
else if ( index.data( Qt::UserRole + 1 ) == "smartgroups" )
{
actnAddGroup->setVisible( !mGrouppingMode );
actnAddSmartgroup->setVisible( !mGrouppingMode );
}
else if ( index.data( Qt::UserRole + 1 ) == "tags" )
{
actnAddTag->setVisible( !mGrouppingMode );
}
}
void QgsStyleManagerDialog::addGroup()
int QgsStyleManagerDialog::addTag()
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>( groupTree->model() );
QModelIndex index = groupTree->currentIndex();
// don't allow creation of tag/smartgroup against system-defined groupings
QString data = index.data( Qt::UserRole + 1 ).toString();
if ( data == QLatin1String( "all" ) || data == "favorite" )
QModelIndex index;
for ( int i = 0; i < groupTree->model()->rowCount(); i++ )
{
int err = QMessageBox::critical( this, tr( "Invalid Selection" ),
tr( "The parent group you have selected is not user editable.\n"
"Kindly select a user defined group." ) );
if ( err )
return;
index = groupTree->model()->index( i, 0 );
QString data = index.data( Qt::UserRole + 1 ).toString();
if ( data == QLatin1String( "tags" ) )
{
break;
}
}
QString itemName;
int id;
bool ok;
itemName = QInputDialog::getText( this, tr( "Tag name" ),
tr( "Please enter name for the new tag:" ), QLineEdit::Normal, tr( "New tag" ), &ok ).trimmed();
if ( !ok || itemName.isEmpty() )
return 0;
//
if ( index.parent() != QModelIndex() )
int check = mStyle->tagId( itemName );
if ( check > 0 )
{
index = index.parent();
data = index.data( Qt::UserRole + 1 ).toString();
QMessageBox::critical( this, tr( "Error!" ),
tr( "Tag name already exists in your symbol database." ) );
return 0;
}
if ( data == QLatin1String( "smartgroups" ) )
id = mStyle->addTag( itemName );
if ( !id )
{
// create a smartgroup
QgsSmartGroupEditorDialog dlg( mStyle, this );
if ( dlg.exec() == QDialog::Rejected )
return;
id = mStyle->addSmartgroup( dlg.smartgroupName(), dlg.conditionOperator(), dlg.conditionMap() );
if ( !id )
return;
itemName = dlg.smartgroupName();
}
else
{
// create a tag
bool ok;
itemName = QInputDialog::getText( this, tr( "Tag name" ),
tr( "Please enter name for the new tag:" ), QLineEdit::Normal, tr( "New tag" ), &ok ).trimmed();
if ( !ok || itemName.isEmpty() )
return;
int check = mStyle->tagId( itemName );
if ( check > 0 )
{
QMessageBox::critical( this, tr( "Error!" ),
tr( "Tag name already exists in your symbol database." ) );
return;
}
id = mStyle->addTag( itemName );
if ( !id )
{
QMessageBox::critical( this, tr( "Error!" ),
tr( "New tag could not be created.\n"
"There was a problem with your symbol database." ) );
return;
}
QMessageBox::critical( this, tr( "Error!" ),
tr( "New tag could not be created.\n"
"There was a problem with your symbol database." ) );
return 0;
}
QStandardItem *parentItem = model->itemFromIndex( index );
@ -1088,7 +1083,39 @@ void QgsStyleManagerDialog::addGroup()
childItem->setData( id );
parentItem->appendRow( childItem );
groupTree->setCurrentIndex( childItem->index() );
return id;
}
int QgsStyleManagerDialog::addSmartgroup()
{
QStandardItemModel *model = qobject_cast<QStandardItemModel*>( groupTree->model() );
QModelIndex index;
for ( int i = 0; i < groupTree->model()->rowCount(); i++ )
{
index = groupTree->model()->index( i, 0 );
QString data = index.data( Qt::UserRole + 1 ).toString();
if ( data == QLatin1String( "smartgroups" ) )
{
break;
}
}
QString itemName;
int id;
QgsSmartGroupEditorDialog dlg( mStyle, this );
if ( dlg.exec() == QDialog::Rejected )
return 0;
id = mStyle->addSmartgroup( dlg.smartgroupName(), dlg.conditionOperator(), dlg.conditionMap() );
if ( !id )
return 0;
itemName = dlg.smartgroupName();
QStandardItem *parentItem = model->itemFromIndex( index );
QStandardItem *childItem = new QStandardItem( itemName );
childItem->setData( id );
parentItem->appendRow( childItem );
return id;
}
void QgsStyleManagerDialog::removeGroup()
@ -1245,14 +1272,14 @@ void QgsStyleManagerDialog::setSymbolsChecked( const QStringList& symbols )
void QgsStyleManagerDialog::filterSymbols( const QString& qword )
{
QStringList items;
items = mStyle->findSymbols( currentItemType() < 3 ? QgsStyle::SymbolEntity : QgsStyle::ColorrampEntity, qword );
items.sort();
if ( currentItemType() == 3 )
{
items = mStyle->findSymbols( QgsStyle::ColorrampEntity, qword );
populateColorRamps( items );
}
else
{
items = mStyle->findSymbols( QgsStyle::SymbolEntity, qword );
populateSymbols( items );
}
}
@ -1280,9 +1307,10 @@ void QgsStyleManagerDialog::selectedSymbolsChanged( const QItemSelection& select
void QgsStyleManagerDialog::enableSymbolInputs( bool enable )
{
groupTree->setEnabled( enable );
btnAddGroup->setEnabled( enable );
actnAddGroup->setEnabled( enable );
btnRemoveGroup->setEnabled( enable );
btnAddTag->setEnabled( enable );
btnAddSmartgroup->setEnabled( enable );
actnAddTag->setEnabled( enable );
actnAddSmartgroup->setEnabled( enable );
actnRemoveGroup->setEnabled( enable );
btnManageGroups->setEnabled( enable || mGrouppingMode ); // always enabled in grouping mode, as it is the only way to leave grouping mode
searchBox->setEnabled( enable );
@ -1290,8 +1318,6 @@ void QgsStyleManagerDialog::enableSymbolInputs( bool enable )
void QgsStyleManagerDialog::enableGroupInputs( bool enable )
{
btnAddGroup->setEnabled( enable );
btnRemoveGroup->setEnabled( enable );
actnRemoveGroup->setEnabled( enable );
btnManageGroups->setEnabled( enable || mGrouppingMode ); // always enabled in grouping mode, as it is the only way to leave grouping mode
}
@ -1351,10 +1377,20 @@ void QgsStyleManagerDialog::listitemsContextMenu( QPoint point )
{
a = new QAction( tag, mGroupListMenu );
a->setData( tag );
connect( a, SIGNAL( triggered( bool ) ), this, SLOT( tagSelectedSymbols() ) );
connect( a, &QAction::triggered, this, [=]( bool ) { tagSelectedSymbols(); }
);
mGroupListMenu->addAction( a );
}
if ( tags.count() > 0 )
{
mGroupListMenu->addSeparator();
}
a = new QAction( "Create new tag... ", mGroupListMenu );
connect( a, &QAction::triggered, this, [=]( bool ) { tagSelectedSymbols( true ); }
);
mGroupListMenu->addAction( a );
mGroupMenu->popup( globalPos );
}
@ -1392,10 +1428,9 @@ void QgsStyleManagerDialog::removeFavoriteSelectedSymbols()
populateList();
}
void QgsStyleManagerDialog::tagSelectedSymbols()
void QgsStyleManagerDialog::tagSelectedSymbols( bool newTag )
{
QAction* selectedItem = qobject_cast<QAction*>( sender() );
if ( selectedItem )
{
QgsStyle::StyleEntity type = ( currentItemType() < 3 ) ? QgsStyle::SymbolEntity : QgsStyle::ColorrampEntity;
@ -1404,7 +1439,23 @@ void QgsStyleManagerDialog::tagSelectedSymbols()
QgsDebugMsg( "unknown entity type" );
return;
}
QString tag = selectedItem->data().toString();
QString tag;
if ( newTag )
{
int id = addTag();
if ( id == 0 )
{
return;
}
tag = mStyle->tag( id );
}
else
{
tag = selectedItem->data().toString();
}
QModelIndexList indexes = listItems->selectionModel()->selectedIndexes();
Q_FOREACH ( const QModelIndex& index, indexes )
{

View File

@ -63,7 +63,11 @@ class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleMan
void groupChanged( const QModelIndex& );
void groupRenamed( QStandardItem * );
void addGroup();
//! add a tag
int addTag();
//! add a smartgroup
int addSmartgroup();
//! remove a tag or smartgroup
void removeGroup();
//! carry out symbol tagging using check boxes
@ -97,7 +101,7 @@ class GUI_EXPORT QgsStyleManagerDialog : public QDialog, private Ui::QgsStyleMan
//! Remove selected symbols from favorites
void removeFavoriteSelectedSymbols();
//! Tag selected symbols using menu item selection
void tagSelectedSymbols();
void tagSelectedSymbols( bool newTag = false );
//! Remove all tags from selected symbols
void detagSelectedSymbols();

View File

@ -211,6 +211,7 @@ void QgsSymbolsListWidget::populateSymbolView()
symbols = mStyle->symbolsWithTag( QgsStyle::SymbolEntity, id );
}
symbols.sort();
populateSymbols( symbols );
}
@ -233,10 +234,11 @@ void QgsSymbolsListWidget::populateSymbols( const QStringList& names )
delete s;
continue;
}
QStringList tags = mStyle->tagsOfSymbol( QgsStyle::SymbolEntity, names[i] );
QStandardItem* item = new QStandardItem( names[i] );
item->setData( names[i], Qt::UserRole ); //so we can load symbol with that name
item->setText( names[i] );
item->setToolTip( names[i] );
item->setToolTip( QString( "<b>%1</b><br><i>%2</i>" ).arg( names[i] ).arg( tags.count() > 0 ? tags.join( ", " ) : tr( "Not tagged" ) ) );
item->setFlags( Qt::ItemIsEnabled | Qt::ItemIsSelectable );
// Set font to 10points to show reasonable text
QFont itemFont = item->font();

View File

@ -887,7 +887,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images/images.qrc">:/images/themes/default/styleicons/color.png</pixmap>
<pixmap resource="../../images/images.qrc">:/images/themes/default/styleicons/color.svg</pixmap>
</property>
</widget>
</item>
@ -903,7 +903,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images/images.qrc">:/images/themes/default/styleicons/style-polygon.png</pixmap>
<pixmap resource="../../images/images.qrc">:/images/themes/default/mIconPolygonLayer.svg</pixmap>
</property>
</widget>
</item>
@ -930,7 +930,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images/images.qrc">:/images/themes/default/styleicons/style-line.png</pixmap>
<pixmap resource="../../images/images.qrc">:/images/themes/default/mIconLineLayer.svg</pixmap>
</property>
</widget>
</item>
@ -982,7 +982,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../images/images.qrc">:/images/themes/default/styleicons/style-point.png</pixmap>
<pixmap resource="../../images/images.qrc">:/images/themes/default/mIconPointLayer.svg</pixmap>
</property>
</widget>
</item>

View File

@ -13,12 +13,6 @@
<property name="windowTitle">
<string>Style Manager</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton { padding-left: 3px; padding-right: 3px; }
/* QMenu::item { padding: 2px 10px 2px 20px; }
QMenu::item:selected { background-color: gray; } */
</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
@ -63,7 +57,7 @@ QMenu::item:selected { background-color: gray; } */
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0" colspan="3">
<item row="0" column="0">
<widget class="QTreeView" name="groupTree">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
@ -83,41 +77,46 @@ QMenu::item:selected { background-color: gray; } */
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="btnAddGroup">
<widget class="QPushButton" name="btnAddTag">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
<string>Add tag…</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="btnRemoveGroup">
<item row="2" column="0">
<widget class="QPushButton" name="btnAddSmartgroup">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
<string>Add smart group…</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<item row="3" column="0">
<widget class="QPushButton" name="btnManageGroups">
<property name="text">
<string/>
<string>Modify group</string>
</property>
<property name="toolTip">
<string>Modify selected tag or smart group</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="btnShare">
<property name="text">
<string>Import / export</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionChangeLabelProperties.svg</normaloff>:/images/themes/default/mActionChangeLabelProperties.svg</iconset>
<normaloff>:/images/themes/default/mActionSharing.svg</normaloff>:/images/themes/default/mActionSharing.svg</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
@ -172,7 +171,7 @@ QMenu::item:selected { background-color: gray; } */
</property>
<attribute name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/styleicons/style-point.png</normaloff>:/images/themes/default/styleicons/style-point.png</iconset>
<normaloff>:/images/themes/default/mIconPointLayer.svg</normaloff>:/images/themes/default/mIconPointLayer.svg</iconset>
</attribute>
<attribute name="title">
<string>Marker</string>
@ -187,7 +186,7 @@ QMenu::item:selected { background-color: gray; } */
</property>
<attribute name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/styleicons/style-line.png</normaloff>:/images/themes/default/styleicons/style-line.png</iconset>
<normaloff>:/images/themes/default/mIconLineLayer.svg</normaloff>:/images/themes/default/mIconLineLayer.svg</iconset>
</attribute>
<attribute name="title">
<string>Line</string>
@ -202,7 +201,7 @@ QMenu::item:selected { background-color: gray; } */
</property>
<attribute name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/styleicons/style-polygon.png</normaloff>:/images/themes/default/styleicons/style-polygon.png</iconset>
<normaloff>:/images/themes/default/mIconPolygonLayer.svg</normaloff>:/images/themes/default/mIconPolygonLayer.svg</iconset>
</attribute>
<attribute name="title">
<string>Fill</string>
@ -217,7 +216,7 @@ QMenu::item:selected { background-color: gray; } */
</property>
<attribute name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/styleicons/color.png</normaloff>:/images/themes/default/styleicons/color.png</iconset>
<normaloff>:/images/themes/default/styleicons/color.svg</normaloff>:/images/themes/default/styleicons/color.svg</iconset>
</attribute>
<attribute name="title">
<string>Color ramp</string>
@ -265,16 +264,10 @@ QMenu::item:selected { background-color: gray; } */
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout" name="symbolBtnsLayout">
<item row="3" column="0">
<layout class="QHBoxLayout" name="symbolBtnsLayout">
<item>
<widget class="QToolButton" name="btnAddItem">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<widget class="QPushButton" name="btnAddItem">
<property name="toolTip">
<string>Add item</string>
</property>
@ -285,16 +278,10 @@ QMenu::item:selected { background-color: gray; } */
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnRemoveItem">
<widget class="QPushButton" name="btnRemoveItem">
<property name="toolTip">
<string>Remove item</string>
</property>
@ -305,26 +292,10 @@ QMenu::item:selected { background-color: gray; } */
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="btnEditItem">
<widget class="QPushButton" name="btnEditItem">
<property name="toolTip">
<string>Edit item</string>
</property>
@ -335,44 +306,21 @@ QMenu::item:selected { background-color: gray; } */
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionProjectProperties.png</normaloff>:/images/themes/default/mActionProjectProperties.png</iconset>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btnShare">
<property name="minimumSize">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>16</height>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionSharing.svg</normaloff>:/images/themes/default/mActionSharing.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::InstantPopup</enum>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QgsFilterLineEdit" name="searchBox">
<property name="text">
@ -391,9 +339,6 @@ QMenu::item:selected { background-color: gray; } */
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
@ -468,13 +413,22 @@ QMenu::item:selected { background-color: gray; } */
<string>Edit smart group...</string>
</property>
</action>
<action name="actnAddGroup">
<action name="actnAddTag">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
<property name="text">
<string>Add group</string>
<string>Add tag…</string>
</property>
</action>
<action name="actnAddSmartgroup">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/symbologyAdd.svg</normaloff>:/images/themes/default/symbologyAdd.svg</iconset>
</property>
<property name="text">
<string>Add smart group…</string>
</property>
</action>
<action name="actnRemoveGroup">
@ -483,7 +437,7 @@ QMenu::item:selected { background-color: gray; } */
<normaloff>:/images/themes/default/symbologyRemove.svg</normaloff>:/images/themes/default/symbologyRemove.svg</iconset>
</property>
<property name="text">
<string>Remove group</string>
<string>Remove</string>
</property>
</action>
<action name="actnTagSymbols">
@ -508,10 +462,10 @@ QMenu::item:selected { background-color: gray; } */
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFileSave.svg</normaloff>:/images/themes/default/mActionFileSave.svg</iconset>
<normaloff>:/images/themes/default/mActionSaveMapAsImage.svg</normaloff>:/images/themes/default/mActionSaveMapAsImage.svg</iconset>
</property>
<property name="text">
<string>Export selected symbol(s) as PNG...</string>
<string>Export selected symbol(s) as PNG</string>
</property>
<property name="toolTip">
<string>Export selected symbo(s) as PNG</string>
@ -523,10 +477,10 @@ QMenu::item:selected { background-color: gray; } */
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionFileSave.svg</normaloff>:/images/themes/default/mActionFileSave.svg</iconset>
<normaloff>:/images/themes/default/mActionSaveAsSVG.svg</normaloff>:/images/themes/default/mActionSaveAsSVG.svg</iconset>
</property>
<property name="text">
<string>Export selected symbol(s) as SVG...</string>
<string>Export selected symbol(s) as SVG</string>
</property>
<property name="toolTip">
<string>Export selected symbol(s) as SVG</string>
@ -542,16 +496,17 @@ QMenu::item:selected { background-color: gray; } */
</customwidgets>
<tabstops>
<tabstop>groupTree</tabstop>
<tabstop>btnAddGroup</tabstop>
<tabstop>btnRemoveGroup</tabstop>
<tabstop>btnManageGroups</tabstop>
<tabstop>searchBox</tabstop>
<tabstop>btnRemoveGroup</tabstop>
<tabstop>btnAddTag</tabstop>
<tabstop>btnAddSmartgroup</tabstop>
<tabstop>btnShare</tabstop>
<tabstop>tabItemType</tabstop>
<tabstop>listItems</tabstop>
<tabstop>btnAddItem</tabstop>
<tabstop>btnRemoveItem</tabstop>
<tabstop>btnEditItem</tabstop>
<tabstop>btnShare</tabstop>
<tabstop>searchBox</tabstop>
</tabstops>
<resources>
<include location="../../images/images.qrc"/>
@ -574,9 +529,25 @@ QMenu::item:selected { background-color: gray; } */
</hints>
</connection>
<connection>
<sender>btnAddGroup</sender>
<sender>btnAddTag</sender>
<signal>clicked()</signal>
<receiver>actnAddGroup</receiver>
<receiver>actnAddTag</receiver>
<slot>trigger()</slot>
<hints>
<hint type="sourcelabel">
<x>46</x>
<y>362</y>
</hint>
<hint type="destinationlabel">
<x>-1</x>
<y>-1</y>
</hint>
</hints>
</connection>
<connection>
<sender>btnAddSmartgroup</sender>
<signal>clicked()</signal>
<receiver>actnAddSmartgroup</receiver>
<slot>trigger()</slot>
<hints>
<hint type="sourcelabel">

View File

@ -301,7 +301,10 @@ void TestStyle::testTags()
id = mStyle->addTag( QStringLiteral( "blue" ) );
QCOMPARE( id, mStyle->tagId( "blue" ) );
id = mStyle->addTag( QStringLiteral( "purple" ) );
//check tagid and tag return values
QCOMPARE( id, mStyle->tagId( "purple" ) );
QCOMPARE( QStringLiteral( "purple" ), mStyle->tag( id ) );
QStringList tags = mStyle->tags();
QCOMPARE( tags.count(), 5 );
@ -348,6 +351,12 @@ void TestStyle::testTags()
QVERIFY( tags.contains( "red" ) );
QVERIFY( tags.contains( "starry" ) );
//check that a given tag is attached to a symbol
QVERIFY( mStyle->symbolHasTag( QgsStyle::SymbolEntity, QStringLiteral( "blue starry" ), QStringLiteral( "blue" ) ) );
//check that a given tag is not attached to a symbol
QCOMPARE( false, mStyle->symbolHasTag( QgsStyle::SymbolEntity, QStringLiteral( "blue starry" ), QStringLiteral( "notblue" ) ) );
//remove a tag, including a non-present tag
QVERIFY( mStyle->detagSymbol( QgsStyle::SymbolEntity, "blue starry", QStringList() << "bad" << "blue" ) );
tags = mStyle->tagsOfSymbol( QgsStyle::SymbolEntity, QStringLiteral( "blue starry" ) );