Merge pull request #5737 from elpaso/hidpi-cursors
[bugfix][hidpi] Scalable SVG theme cursors
@ -606,6 +606,13 @@
|
||||
<file>themes/default/mActionResizeSquare.svg</file>
|
||||
<file>themes/default/mSourceFields.svg</file>
|
||||
<file>flags/zh_Hant.svg</file>
|
||||
<file>themes/default/cursors/mCapturePoint.svg</file>
|
||||
<file>themes/default/cursors/mCrossHair.svg</file>
|
||||
<file>themes/default/cursors/mSampler.svg</file>
|
||||
<file>themes/default/cursors/mSelect.svg</file>
|
||||
<file>themes/default/cursors/mZoomIn.svg</file>
|
||||
<file>themes/default/cursors/mZoomOut.svg</file>
|
||||
<file>themes/default/cursors/mIdentify.svg</file>
|
||||
</qresource>
|
||||
<qresource prefix="/images/tips">
|
||||
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
|
||||
|
1
images/themes/default/cursors/mCapturePoint.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="24" viewBox="0 0 24.000001 24.000001" width="24" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1028.3622)"><path d="m11.999024 1031.2685c-5.0013627 0-9.0917967 4.0922-9.0917967 9.0938 0 5.0016 4.090434 9.0937 9.0917967 9.0937 5.001362 0 9.09375-4.0921 9.09375-9.0937 0-5.0016-4.092388-9.0938-9.09375-9.0938zm.002 1.7481a7.3431287 7.3438616 0 0 1 .732422.037 7.3431287 7.3438616 0 0 1 .724609.1093 7.3431287 7.3438616 0 0 1 .712891.1817 7.3431287 7.3438616 0 0 1 .689453.2519 7.3431287 7.3438616 0 0 1 .660156.3204 7.3431287 7.3438616 0 0 1 .625.3828 7.3431287 7.3438616 0 0 1 .585938.4453 7.3431287 7.3438616 0 0 1 .537109.5 7.3431287 7.3438616 0 0 1 .484375.5508 7.3431287 7.3438616 0 0 1 .425781.5976 7.3431287 7.3438616 0 0 1 .365235.6367 7.3431287 7.3438616 0 0 1 .300781.67 7.3431287 7.3438616 0 0 1 .230469.6972 7.3431287 7.3438616 0 0 1 .160156.7149 7.3431287 7.3438616 0 0 1 .08984.7304 7.3431287 7.3438616 0 0 1 .01758.5196 7.3431287 7.3438616 0 0 1 -.03711.7324 7.3431287 7.3438616 0 0 1 -.109375.7265 7.3431287 7.3438616 0 0 1 -.18164.711 7.3431287 7.3438616 0 0 1 -.251953.6894 7.3431287 7.3438616 0 0 1 -.31836.6602 7.3431287 7.3438616 0 0 1 -.384765.6269 7.3431287 7.3438616 0 0 1 -.44336.584 7.3431287 7.3438616 0 0 1 -.5.5371 7.3431287 7.3438616 0 0 1 -.550781.4844 7.3431287 7.3438616 0 0 1 -.597656.4278 7.3431287 7.3438616 0 0 1 -.636719.3652 7.3431287 7.3438616 0 0 1 -.669922.2988 7.3431287 7.3438616 0 0 1 -.697266.2324 7.3431287 7.3438616 0 0 1 -.714843.1602 7.3431287 7.3438616 0 0 1 -.730469.088 7.3431287 7.3438616 0 0 1 -.517578.019 7.3431287 7.3438616 0 0 1 -.734375-.037 7.3431287 7.3438616 0 0 1 -.724609-.1094 7.3431287 7.3438616 0 0 1 -.7128907-.1816 7.3431287 7.3438616 0 0 1 -.689453-.252 7.3431287 7.3438616 0 0 1 -.660156-.3203 7.3431287 7.3438616 0 0 1 -.625-.3828 7.3431287 7.3438616 0 0 1 -.585938-.4453 7.3431287 7.3438616 0 0 1 -.537109-.5 7.3431287 7.3438616 0 0 1 -.484375-.5508 7.3431287 7.3438616 0 0 1 -.425782-.5976 7.3431287 7.3438616 0 0 1 -.365234-.6368 7.3431287 7.3438616 0 0 1 -.300781-.6699 7.3431287 7.3438616 0 0 1 -.230469-.6972 7.3431287 7.3438616 0 0 1 -.160156-.7149 7.3431287 7.3438616 0 0 1 -.089844-.7285 7.3431287 7.3438616 0 0 1 -.017578-.5195 7.3431287 7.3438616 0 0 1 .037109-.7344 7.3431287 7.3438616 0 0 1 .109375-.7246 7.3431287 7.3438616 0 0 1 .181641-.7129 7.3431287 7.3438616 0 0 1 .251953-.6895 7.3431287 7.3438616 0 0 1 .318359-.6601 7.3431287 7.3438616 0 0 1 .384766-.627 7.3431287 7.3438616 0 0 1 .443359-.584 7.3431287 7.3438616 0 0 1 .5-.5371 7.3431287 7.3438616 0 0 1 .550782-.4843 7.3431287 7.3438616 0 0 1 .597656-.4258 7.3431287 7.3438616 0 0 1 .636719-.3653 7.3431287 7.3438616 0 0 1 .669921-.3007 7.3431287 7.3438616 0 0 1 .6972657-.2305 7.3431287 7.3438616 0 0 1 .714844-.1621 7.3431287 7.3438616 0 0 1 .730469-.088 7.3431287 7.3438616 0 0 1 .519531-.02z" fill="#fff" overflow="visible"/><path d="m7.0000003 1040.3622h10.0000007" fill="none" stroke="#000" stroke-width="1.50000009"/><path d="m12.000001 1035.3621v10.0001" fill="none" stroke="#000" stroke-width="1.50000009"/><ellipse cx="12.000001" cy="1040.3622" fill="#fff" rx="1.499993" ry="1.4999931"/><path d="m11.250001 1030.3622v1.9454c-3.8637771.3575-6.9473551 3.4415-7.3046881 7.3046h-1.945312v1.4981h1.945312c.356486 3.864 3.440264 6.9511 7.3046881 7.3086v1.9433h1.5v-1.9433c3.864427-.3575 6.948205-3.4446 7.304687-7.3086h1.945313v-1.4981h-1.945313c-.35733-3.8631-3.440907-6.9471-7.304687-7.3046v-1.9454zm.75 3.4063c.912362 0 1.781158.1826 2.570312.5156.789154.333 1.499679.816 2.095703 1.4121.596024.5962 1.077184 1.3063 1.410156 2.0957.332973.7894.517579 1.6575.517579 2.5703 0 .9129-.184606 1.7811-.517579 2.5704-.332972.7892-.814132 1.4997-1.410156 2.0957-.596024.5959-1.306549 1.0773-2.095703 1.4101-.789154.3328-1.65795.5176-2.570312.5176-.912362 0-1.781159-.1848-2.5703131-.5176-.789153-.3328-1.497726-.8142-2.09375-1.4101-.596024-.596-1.079137-1.3065-1.412109-2.0957-.332973-.7893-.515625-1.6575-.515625-2.5704 0-.9128.182652-1.7809.515625-2.5703.332972-.7894.816085-1.4995 1.412109-2.0957.596024-.5961 1.304597-1.0791 2.09375-1.4121.7891541-.333 1.6579511-.5156 2.5703131-.5156z" fill-rule="evenodd" overflow="visible"/></g></svg>
|
After Width: | Height: | Size: 4.1 KiB |
1
images/themes/default/cursors/mCrossHair.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="24" viewBox="0 0 24.000001 24.000001" width="24" xmlns="http://www.w3.org/2000/svg"><g fill="none" transform="translate(0 -1028.3622)"><path d="m2.0000001 1040.3622h7.0075899m5.994795 0h6.997617" stroke="#fff" stroke-width="4.00000024"/><path d="m2.0000001 1040.3622h7.0075899m5.994795 0h6.997617" stroke="#000" stroke-width="2.00000012"/><path d="m12.000001 1050.3622v-7.0076m0-5.9948v-6.9976" stroke="#fff" stroke-width="4.00000048"/><path d="m12.000001 1050.3622v-7.0076m0-5.9948v-6.9976" stroke="#000" stroke-width="2.00000024"/></g></svg>
|
After Width: | Height: | Size: 556 B |
1
images/themes/default/cursors/mIdentify.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="24" viewBox="0 0 24.000001 24.000001" width="24" xmlns="http://www.w3.org/2000/svg"><g fill-rule="evenodd" transform="translate(0 -1028.3622)"><path d="m1.5 1030.2852c-1.3663036 0-2.36077773 1.4769-1.85546875 2.7421a1.50015 1.50015 0 0 0 .001953 0l6.88867182 17.0938a1.50015 1.50015 0 0 0 .00195.01c.5822283 1.4296 2.7401585 1.6091 3.5527346.2968l1.351562-2.1875 3.634766 3.9688c.748547.8235 2.079397.86 2.875.086l2.050781-1.998c.770717-.7493.799189-2.0218.0625-2.8047a1.50015 1.50015 0 0 0 -.002 0l-3.583984-3.791 1.861328-.8067h-.0039c1.440714-.6208 1.542372-2.8405.166015-3.5918l-16.0429686-8.7695a1.50015 1.50015 0 0 0 -.00391 0c-.29764527-.1676-.62676307-.2483-.95503007-.2483z" fill="#fff" overflow="visible"/><path d="m1.5 1031.7852c-.3530058 0-.59380948.3577-.4628906.6855l6.8886718 17.0938c.1543448.379.6737665.4223.8886719.074l2.3945309-3.875 4.976563 5.4355c.19025.2093.516057.2192.71875.022l2.052734-2c .195733-.1903.20269-.5024.01563-.7012l-5.054687-5.3476 3.824219-1.6582c.383141-.1651.407522-.6992.04102-.8985l-16.0429786-8.7698c-.073736-.04-.1563493-.061-.2402344-.061z" overflow="visible"/><path d="m19.849609.51757812c-1.760247 0-3.173828 1.38844678-3.173828 3.15820308 0 .5941457.212401 1.1622226.521485 1.6738282-1.405122.7299557-2.357677 1.8584073-2.826172 2.4863281-.408514.4742198-.559553 1.1242578-.445313 1.6953125a1.50015 1.50015 0 0 0 0 .00195c.09218.4568816.323146.8214779.597657 1.0976559l.177734.179688a1.50015 1.50015 0 0 0 .0039.0039c.119867.120485.311329.102542.457031.189453l-.15039.44336c-.628376 1.822713-.949219 2.37686-.949219 3.380859 0 .567624.191074 1.23153.697266 1.75.506191.51847 1.267455.78125 2.011718.78125 3.516333 0 5.285152-2.574576 5.558594-3.013672a1.50015 1.50015 0 0 0 .01563-.02539c.418343-.703427.286154-1.944691-.302734-2.542968a1.50015 1.50015 0 0 0 -.01172-.01172l-.238281-.236328c-.134001-.134176-.307162-.08236-.455078-.173828l.597658-1.6992099a1.50015 1.50015 0 0 0 0-.00586c.299857-.8614512.5625-1.4669407.5625-2.3144531 0-.4736425-.318648-.8783406-.570313-1.2988281.103587-.085585.23957-.1422824.330078-.2363282.565527-.5876276.943361-1.3313619.94336-2.2246087.000328-.6963831-.237312-1.4788361-.837891-2.0957031-.600578-.61686705-1.522559-.96289067-2.513672-.96289068zm-5.511718 7.35351568c-.0031.0041-.01261.013526-.01563.017578a1.50015 1.50015 0 0 0 -.02149.03125l.03711-.048828z" fill="#fff" overflow="visible" transform="translate(1.1250001 1027.4872)"/><path d="m20.974609 1029.5048c-.89082 0-1.673828.7745-1.673828 1.6582 0 1.0074.672926 1.6601 1.712891 1.6601 1.02094 0 1.812501-.946 1.8125-1.7597.000338-.7182-.48374-1.5586-1.851563-1.5586zm-.160156 4.1621c-2.008926 0-3.582074 1.821-4.164062 2.6035-.0074.015-.01539.018-.02148.027-.100232.1147-.13869.2695-.107422.4258.02413.1196.09052.2364.191407.3379l.179687.1817c.108043.1086.249375.166.396484.166.109739 0 .271874-.034.433594-.1973l.03125-.033c.209624-.2802.600313-.7038.886719-.9648-.04927.1678-.119291.3723-.201172.6093l-.882812 2.5938c-.630912 1.8314-.869141 2.5166-.869141 2.8984 0 .499.317488 1.0313 1.208984 1.0313 2.770642 0 4.135326-2.0661 4.285157-2.3067.152189-.2559.124576-.5127-.08203-.7226l-.242187-.2403c-.219814-.2201-.640501-.1761-.814453.084-.109068.1641-.613978.6894-.931641.9356.03939-.1634.115796-.415.257813-.8203l1.27539-3.6309c.299317-.8599.478516-1.3793.478516-1.8223 0-.7007-.513246-1.1543-1.308594-1.1543l0 0z" overflow="visible"/><path d="m4.0164661 1034.9367l9.9835339 5.4255" fill="#ccc" stroke="#b3b3b3" stroke-linecap="round"/></g></svg>
|
After Width: | Height: | Size: 3.4 KiB |
1
images/themes/default/cursors/mSampler.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg enable-background="new" height="24" viewBox="0 0 23.999998 24" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><filter id="a" color-interpolation-filters="sRGB"><feBlend in2="BackgroundImage" mode="screen"/></filter><g fill-rule="evenodd" filter="url(#a)" transform="translate(-346.23242 -654.49916)"><path d="m1.6914062 0c-.9203699.00012-1.6913362.76650314-1.6914062 1.6894531v1.3789063c.00008.4505.17901375.8789925.49609375 1.1953125l2.26757815 2.2636719v.6796874c.00008.4505001.1790137.8790025.4960937 1.1953126l6.4140625 6.4023442v2.060546c.00007.92296.7709859 1.689353 1.6914059 1.689454h.681641l4.4375 4.429687a1.0001 1.0001 0 0 0 .001953.001953l.595703.59375a1.0001 1.0001 0 0 0 .527344.275391c2.20246.39553 4.043289-.066001 5.162109-1.300781 1.11881-1.23474 1.408937-3.02165 1.128907-4.94336a1.0001 1.0001 0 0 0 -.283203-.564453l-.703126-.699219-4.328124-4.322265v-.679688c-.0001-.92292-.770987-1.689353-1.691407-1.689453h-2.064453l-6.4140624-6.4023438c-.31838-.3181599-.7460356-.4960137-1.1972656-.4960937h-.6816406l-2.2675782-2.26367188c-.32191-.32168998-.7531756-.49407062-1.1972656-.49414062zm.7480469 2.0585938c.2873127-.058412.5683594.0996093.5683594.0996093l2.5625 2.5566407c.12964.1294.3050112.2030849.4882813.203125l.875.2207031 6.5058592 6.4941401c.06862.953761.069735 1.39991-.169922 1.607422-.239656.207513-.720182.175782-1.617187.175782l-6.5058596-6.494141-.265625-.8945312c-.00004-.1829401-.073455-.3589213-.203125-.4882813l-2.5605469-2.5566406c0 0-.0832531-.106785-.1191406-.2578125-.0358875-.1510275-.0256406-.3457544.1621093-.5214844.0869501-.0813825.183526-.1250606.2792969-.1445312z" fill="#fff" overflow="visible" transform="translate(346.23242 654.49916)"/><path d="m351.89648 662.97904l2.89851-2.59987 5.84473 5.74562-.26516 2.51907-2.3423.48613z" fill="#fff"/><path d="m350.74804 660.53041l1.46875-.0312 7.34375 7.46875-2.15625.4375-4.23437-4.07813-2.40625-2.28125z" fill="#8f8f8f" fill-opacity=".5"/><path d="m347.92347 655.49916c-.38164.00005-.69102.30886-.69105.68982v1.37962c.00003.18294.0728.35837.20245.48771l2.56175 2.55716v1.094c.00003.18294.0728.35837.20245.48771l6.70804 6.69604v2.47362c.00003.38096.30941.68977.69105.68981h1.09597l4.73052 4.72205.59541.59436c3.98133.71499 5.62957-1.64128 5.12348-5.11432l-.70339-.70213-4.62254-4.61427v-1.094c-.00004-.38095-.30941-.68977-.69105-.68981h-2.47806l-6.70805-6.69603c-.1295-.12941-.30532-.20206-.48858-.20209h-1.09597l-2.56175-2.55716c-.1295-.12941-.30531-.20206-.48858-.20209zm.47008 1.20285c.3478-.32553.84685-.0442.84685-.0442l2.56174 2.55715c.12964.1294.30533.20206.4886.2021l.87499.22097 6.50558 6.49393c.13724 1.90752.007 1.78381-1.78701 1.78381l-6.50558-6.49393-.26517-.89513c-.00004-.18294-.0728-.35837-.20247-.48773l-2.56173-2.55714c0 0-.3313-.42838.0442-.77984z" overflow="visible"/><path d="m363.56836 668.22266l-.70703.70703c1.5343 1.35775 4.39712 3.91196 4.29809 4.69486.099 1.21711-.94516 1.95194.40894 1.57031.61785-.61785.66326-1.6504.49609-2.15189-.16716-.50149-.49609-.82031-.49609-.82031z" fill="#fff" overflow="visible"/></g></svg>
|
After Width: | Height: | Size: 3.0 KiB |
1
images/themes/default/cursors/mSelect.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="24" viewBox="0 0 24.000001 24.000001" width="24" xmlns="http://www.w3.org/2000/svg"><g transform="translate(0 -1028.3622)"><path d="m2.0000002 1030.3622h20.000002v14.000018h-20.000002z" fill="none" stroke="#fff" stroke-linejoin="round" stroke-width="1.50000009"/><path d="m2 1030.8613h-.75v1.5h1.5v-1.25h.75v-1.5h-1.5zm3 .25h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm1.25 1.75h1.5v-1.5h-1.5zm-20 2.5h1.5v-1.5h-1.5zm20 .5h1.5v-1.5h-1.5zm-20 2.5h1.5v-1.5h-1.5zm20 .5h1.5v-1.5h-1.5zm-20 2.5h1.5v-1.5h-1.5zm20 .5h1.5v-1.5h-1.5zm-20 2.5h1.5v-1.5h-1.5zm19.986344.7444c.5078.011 1.015731.015 1.523606.021-.01201-.5884-.0099-1.177-.0099-1.7655h-1.5c.006.5816-.003 1.163-.01366 1.7444zm-17.736344.01h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5zm3 0h1.5v-1.5h-1.5z" overflow="visible"/><g fill-rule="evenodd" transform="translate(1.6470919 1.9701241)"><path d="m1.5 1030.7852c-1.02853767 0-1.77113729 1.1039-1.390625 2.0566a1.0001 1.0001 0 0 0 0 0l6.8886719 17.0937a1.0001 1.0001 0 0 0 .00195 0c .4398477 1.0801 2.0534622 1.2154 2.6660156.2227l1.6992184-2.7481 4.080078 4.4551c.562448.6188 1.558284.6482 2.15625.066l2.052735-2c .579056-.563.600354-1.5153.04687-2.1035a1.0001 1.0001 0 0 0 -.002 0l-4.074219-4.3105 2.513672-1.0899c1.087878-.4687 1.163804-2.1256.125-2.6933l-16.0429689-8.7695a1.0001 1.0001 0 0 0 -.00391 0c-.222982-.1187-.4699316-.1793-.716738-.1793z" fill="#fff" overflow="visible" transform="translate(.79549518 -1.8561554)"/><path d="m2.2954952 1029.929c-.3530058 0-.5938095.3577-.4628906.6855l6.8886718 17.0938c.1543448.379.6737665.4223.8886719.074l2.3945307-3.875 4.976563 5.4355c.19025.2093.516057.2192.71875.022l2.052734-2c .195733-.1903.20269-.5024.01563-.7012l-5.054687-5.3476 3.824219-1.6582c.383141-.1651.407522-.6992.04102-.8985l-16.0429784-8.7698c-.073736-.04-.1563493-.061-.2402344-.061z" overflow="visible"/><path d="m4.8119613 1033.0805l9.9835337 5.4255" fill="#ccc" stroke="#b3b3b3" stroke-linecap="round"/></g></g></svg>
|
After Width: | Height: | Size: 2.0 KiB |
1
images/themes/default/cursors/mZoomIn.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="24" viewBox="0 0 24.000001 24.000001" width="24" xmlns="http://www.w3.org/2000/svg"><g transform="matrix(.9565239 0 0 .95545692 .65024315 -981.790403)"><path d="m15.139163 1041.2225c-.392993 1.7467-2.217698 2.2202-2.217698 2.2202l7.392464 7.4007 2.217697-2.2201z" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linejoin="round" stroke-width="1.56905377"/><path d="m1.1597145 1037.5041c0 4.4746 3.6230358 8.1021 8.0922782 8.1021 4.4692413 0 8.0922783-3.6275 8.0922783-8.1021 0-4.4747-3.623037-8.1023-8.0922783-8.1023-4.4692424 0-8.0922782 3.6276-8.0922782 8.1023z" style="fill:#fff;stroke:#000;stroke-width:1.56905373;stroke-linecap:round;stroke-linejoin:round;stroke-dashoffset:7"/><g fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.9000001" transform="translate(.1018275 .3826)"><path d="m9.1501655 1032.8214v8.6" overflow="visible"/><path d="m13.450165 1037.1214h-8.5999995" overflow="visible"/></g><path d="m18.377087 1044.1893l-2-2-2.000001 2 2.000001 2z" fill-rule="evenodd"/></g></svg>
|
After Width: | Height: | Size: 1.0 KiB |
1
images/themes/default/cursors/mZoomOut.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg height="24" viewBox="0 0 24.000001 24.000001" width="24" xmlns="http://www.w3.org/2000/svg"><g transform="matrix(.9565239 0 0 .95545692 .65024315 -981.790403)"><path d="m15.139163 1041.2225c-.392993 1.7467-2.217698 2.2202-2.217698 2.2202l7.392464 7.4007 2.217697-2.2201z" fill="#fff" fill-rule="evenodd" stroke="#000" stroke-linejoin="round" stroke-width="1.56905377"/><path d="m1.1597145 1037.5041c0 4.4746 3.6230358 8.1021 8.0922782 8.1021 4.4692413 0 8.0922783-3.6275 8.0922783-8.1021 0-4.4747-3.623037-8.1023-8.0922783-8.1023-4.4692424 0-8.0922782 3.6276-8.0922782 8.1023z" style="fill:#fff;stroke:#000;stroke-width:1.56905373;stroke-linecap:round;stroke-linejoin:round;stroke-dashoffset:7"/><path d="m13.551993 1037.504h-8.6" style="overflow:visible;fill:none;stroke:#000;stroke-width:2.9000001;stroke-linecap:round;stroke-linejoin:round"/><path d="m18.377087 1044.1893l-2-2-2.000001 2 2.000001 2z" fill-rule="evenodd"/></g></svg>
|
After Width: | Height: | Size: 940 B |
@ -345,6 +345,26 @@ Returns the path to the default theme directory.
|
||||
:rtype: QIcon
|
||||
%End
|
||||
|
||||
enum Cursor
|
||||
{
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
Identify,
|
||||
CrossHair,
|
||||
CapturePoint,
|
||||
Select,
|
||||
Sampler,
|
||||
};
|
||||
|
||||
static QCursor getThemeCursor( const Cursor &cursor );
|
||||
%Docstring
|
||||
Helper to get a theme cursor. It will fall back to the
|
||||
default theme if the active theme does not have the required icon.
|
||||
Cursors are automatically scaled to look like a 16px cursor on 96dpi
|
||||
screens.
|
||||
:rtype: QCursor
|
||||
%End
|
||||
|
||||
static QPixmap getThemePixmap( const QString &name );
|
||||
%Docstring
|
||||
Helper to get a theme icon as a pixmap. It will fall back to the
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include "qgsproject.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmessageviewer.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmaplayeractionregistry.h"
|
||||
#include "qgsgeometry.h"
|
||||
#include "qgspaperitem.h"
|
||||
|
@ -161,7 +161,6 @@ Q_GUI_EXPORT extern int qt_defaultDpiX();
|
||||
#include "qgscoordinatetransform.h"
|
||||
#include "qgscoordinateutils.h"
|
||||
#include "qgscredentialdialog.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgscustomdrophandler.h"
|
||||
#include "qgscustomization.h"
|
||||
#include "qgscustomlayerorderwidget.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "qgsapplication.h"
|
||||
#include "qgisapp.h"
|
||||
#include "qgsattributetabledialog.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsdistancearea.h"
|
||||
#include "qgsfeature.h"
|
||||
#include "qgsfeaturestore.h"
|
||||
@ -50,14 +49,9 @@ QgsMapToolIdentifyAction::QgsMapToolIdentifyAction( QgsMapCanvas *canvas )
|
||||
: QgsMapToolIdentify( canvas )
|
||||
{
|
||||
mToolName = tr( "Identify" );
|
||||
// set cursor
|
||||
QPixmap myIdentifyQPixmap = QPixmap( ( const char ** ) identify_cursor );
|
||||
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );
|
||||
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify ) );
|
||||
connect( this, &QgsMapToolIdentify::changedRasterResults, this, &QgsMapToolIdentifyAction::handleChangedRasterResults );
|
||||
|
||||
mIdentifyMenu->setAllowMultipleReturn( true );
|
||||
|
||||
QgsMapLayerAction *attrTableAction = new QgsMapLayerAction( tr( "Show attribute table" ), mIdentifyMenu, QgsMapLayer::VectorLayer, QgsMapLayerAction::MultipleFeatures );
|
||||
connect( attrTableAction, &QgsMapLayerAction::triggeredForFeatures, this, &QgsMapToolIdentifyAction::showAttributeTable );
|
||||
identifyMenu()->addCustomAction( attrTableAction );
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmaptopixel.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsgeometry.h"
|
||||
#include "qgspointxy.h"
|
||||
#include "qgis.h"
|
||||
@ -34,8 +33,7 @@ QgsMapToolSelectFeatures::QgsMapToolSelectFeatures( QgsMapCanvas *canvas )
|
||||
, mDragging( false )
|
||||
{
|
||||
mToolName = tr( "Select features" );
|
||||
QPixmap mySelectQPixmap = QPixmap( ( const char ** ) select_cursor );
|
||||
mCursor = QCursor( mySelectQPixmap, 1, 1 );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Select ) );
|
||||
mRubberBand = nullptr;
|
||||
mFillColor = QColor( 254, 178, 76, 63 );
|
||||
mStrokeColor = QColor( 254, 58, 29, 100 );
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "qgsexception.h"
|
||||
#include "qgsmeasuredialog.h"
|
||||
#include "qgsmeasuretool.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmessagelog.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
@ -40,8 +39,7 @@ QgsMeasureTool::QgsMeasureTool( QgsMapCanvas *canvas, bool measureArea )
|
||||
mRubberBand = new QgsRubberBand( canvas, mMeasureArea ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry );
|
||||
mRubberBandPoints = new QgsRubberBand( canvas, QgsWkbTypes::PointGeometry );
|
||||
|
||||
QPixmap myCrossHairQPixmap = QPixmap( ( const char ** ) cross_hair_cursor );
|
||||
mCursor = QCursor( myCrossHairQPixmap, 8, 8 );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::CrossHair ) );
|
||||
|
||||
mDone = true;
|
||||
// Append point we will move
|
||||
|
@ -481,6 +481,70 @@ QIcon QgsApplication::getThemeIcon( const QString &name )
|
||||
return icon;
|
||||
}
|
||||
|
||||
QCursor QgsApplication::getThemeCursor( const Cursor &cursor )
|
||||
{
|
||||
QgsApplication *app = instance();
|
||||
if ( app && app->mCursorCache.contains( cursor ) )
|
||||
return app->mCursorCache.value( cursor );
|
||||
|
||||
// All calculations are done on 32x32 icons
|
||||
// Defaults to center, individual cursors may override
|
||||
int activeX = 16;
|
||||
int activeY = 16;
|
||||
|
||||
QString name;
|
||||
switch ( cursor )
|
||||
{
|
||||
case ZoomIn:
|
||||
name = QStringLiteral( "mZoomIn.svg" );
|
||||
activeX = 13;
|
||||
activeY = 13;
|
||||
break;
|
||||
case ZoomOut:
|
||||
name = QStringLiteral( "mZoomOut.svg" );
|
||||
activeX = 13;
|
||||
activeY = 13;
|
||||
break;
|
||||
case Identify:
|
||||
activeX = 3;
|
||||
activeY = 6;
|
||||
name = QStringLiteral( "mIdentify.svg" );
|
||||
break;
|
||||
case CrossHair:
|
||||
name = QStringLiteral( "mCrossHair.svg" );
|
||||
break;
|
||||
case CapturePoint:
|
||||
name = QStringLiteral( "mCapturePoint.svg" );
|
||||
break;
|
||||
case Select:
|
||||
name = QStringLiteral( "mSelect.svg" );
|
||||
activeX = 6;
|
||||
activeY = 6;
|
||||
break;
|
||||
case Sampler:
|
||||
activeX = 5;
|
||||
activeY = 5;
|
||||
name = QStringLiteral( "mSampler.svg" );
|
||||
break;
|
||||
// No default
|
||||
}
|
||||
// It should never get here!
|
||||
Q_ASSERT( ! name.isEmpty( ) );
|
||||
|
||||
QIcon icon = getThemeIcon( QStringLiteral( "cursors" ) + QDir::separator() + name );
|
||||
QCursor _cursor;
|
||||
// Check if an icon exists for this cursor (the O.S. default cursor will be used if it does not)
|
||||
if ( ! icon.isNull( ) )
|
||||
{
|
||||
// Apply scaling
|
||||
float scale( ( float ) app->fontMetrics().height() / 32 * 1.5 ) ; // Make them bigger to match 24x24
|
||||
_cursor = QCursor( icon.pixmap( std::ceil( scale * 32 ), std::ceil( scale * 32 ) ), std::ceil( scale * activeX ), std::ceil( scale * activeY ) );
|
||||
}
|
||||
if ( app )
|
||||
app->mCursorCache.insert( cursor, _cursor );
|
||||
return _cursor;
|
||||
}
|
||||
|
||||
// TODO: add some caching mechanism ?
|
||||
QPixmap QgsApplication::getThemePixmap( const QString &name )
|
||||
{
|
||||
|
@ -311,6 +311,29 @@ class CORE_EXPORT QgsApplication : public QApplication
|
||||
*/
|
||||
static QIcon getThemeIcon( const QString &name );
|
||||
|
||||
/**
|
||||
* \brief The Cursor enum defines constants for QGIS custom
|
||||
* cursors.
|
||||
*/
|
||||
enum Cursor
|
||||
{
|
||||
ZoomIn, //!< Zoom in
|
||||
ZoomOut, //!< Zoom out
|
||||
Identify, //!< Identify: obtain information about the object
|
||||
CrossHair, //!< Precisely identify a point on the canvas
|
||||
CapturePoint, //!< Select and capture a point or a feature
|
||||
Select, //!< Select a rectangle
|
||||
Sampler, //!< Color/Value picker
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to get a theme cursor. It will fall back to the
|
||||
* default theme if the active theme does not have the required icon.
|
||||
* Cursors are automatically scaled to look like a 16px cursor on 96dpi
|
||||
* screens.
|
||||
*/
|
||||
static QCursor getThemeCursor( const Cursor &cursor );
|
||||
|
||||
/**
|
||||
* Helper to get a theme icon as a pixmap. It will fall back to the
|
||||
* default theme if the active theme does not have the required icon.
|
||||
@ -747,6 +770,7 @@ class CORE_EXPORT QgsApplication : public QApplication
|
||||
static QString sPlatformName;
|
||||
|
||||
QMap<QString, QIcon> mIconCache;
|
||||
QMap<Cursor, QCursor> mCursorCache;
|
||||
|
||||
QgsDataItemProviderRegistry *mDataItemProviderRegistry = nullptr;
|
||||
QgsAuthManager *mAuthManager = nullptr;
|
||||
|
@ -229,7 +229,6 @@ SET(QGIS_GUI_SRCS
|
||||
qgscompoundcolorwidget.cpp
|
||||
qgsconfigureshortcutsdialog.cpp
|
||||
qgscredentialdialog.cpp
|
||||
qgscursors.cpp
|
||||
qgscustomdrophandler.cpp
|
||||
qgscurveeditorwidget.cpp
|
||||
qgsdatumtransformdialog.cpp
|
||||
@ -718,7 +717,6 @@ SET(QGIS_GUI_HDRS
|
||||
qgsattributeeditorcontext.h
|
||||
qgsattributeforminterface.h
|
||||
qgsattributeformlegacyinterface.h
|
||||
qgscursors.h
|
||||
qgsdetaileditemdata.h
|
||||
qgsexpressionbuilderdialog.h
|
||||
qgsgeometryrubberband.h
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "qgslayoutviewtooladditem.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgslayoutview.h"
|
||||
#include "qgslayout.h"
|
||||
#include "qgslayoutitemregistry.h"
|
||||
@ -35,8 +34,7 @@ QgsLayoutViewToolAddItem::QgsLayoutViewToolAddItem( QgsLayoutView *view )
|
||||
: QgsLayoutViewTool( view, tr( "Add item" ) )
|
||||
{
|
||||
setFlags( QgsLayoutViewTool::FlagSnaps );
|
||||
QPixmap crosshairQPixmap = QPixmap( ( const char ** )( cross_hair_cursor ) );
|
||||
setCursor( QCursor( crosshairQPixmap, 8, 8 ) );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::CrossHair ) );
|
||||
}
|
||||
|
||||
void QgsLayoutViewToolAddItem::setItemMetadataId( int metadataId )
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "qgslayoutviewtooladdnodeitem.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgslayoutview.h"
|
||||
#include "qgslayout.h"
|
||||
#include "qgslayoutitemregistry.h"
|
||||
@ -37,8 +36,7 @@ QgsLayoutViewToolAddNodeItem::QgsLayoutViewToolAddNodeItem( QgsLayoutView *view
|
||||
: QgsLayoutViewTool( view, tr( "Add item" ) )
|
||||
{
|
||||
setFlags( QgsLayoutViewTool::FlagSnaps );
|
||||
QPixmap crosshairQPixmap = QPixmap( ( const char ** )( cross_hair_cursor ) );
|
||||
setCursor( QCursor( crosshairQPixmap, 8, 8 ) );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::CrossHair ) );
|
||||
}
|
||||
|
||||
void QgsLayoutViewToolAddNodeItem::setItemMetadataId( int metadataId )
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "qgslayoutviewtooltemporarykeyzoom.h"
|
||||
#include "qgslayoutviewmouseevent.h"
|
||||
#include "qgslayoutview.h"
|
||||
#include "qgscursors.h"
|
||||
#include <QScrollBar>
|
||||
#include <QApplication>
|
||||
|
||||
@ -107,7 +106,7 @@ void QgsLayoutViewToolTemporaryKeyZoom::activate()
|
||||
|
||||
void QgsLayoutViewToolTemporaryKeyZoom::updateCursor( Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
QPixmap zoomQPixmap = QPixmap( ( const char ** )( ( modifiers & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( zoomQPixmap, 7, 7 );
|
||||
view()->viewport()->setCursor( zoomCursor );
|
||||
view()->viewport()->setCursor( ( modifiers & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
}
|
||||
|
@ -18,15 +18,12 @@
|
||||
#include "qgslayoutview.h"
|
||||
#include "qgslayoutviewrubberband.h"
|
||||
#include "qgsrectangle.h"
|
||||
#include "qgscursors.h"
|
||||
#include <QScrollBar>
|
||||
|
||||
QgsLayoutViewToolZoom::QgsLayoutViewToolZoom( QgsLayoutView *view )
|
||||
: QgsLayoutViewTool( view, tr( "Pan" ) )
|
||||
{
|
||||
QPixmap zoomQPixmap = QPixmap( ( const char ** )( zoom_in ) );
|
||||
setCursor( QCursor( zoomQPixmap, 7, 7 ) );
|
||||
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
mRubberBand.reset( new QgsLayoutViewRectangularRubberBand( view ) );
|
||||
mRubberBand->setBrush( QBrush( QColor( 70, 50, 255, 25 ) ) );
|
||||
mRubberBand->setPen( QPen( QBrush( QColor( 70, 50, 255, 100 ) ), 0 ) );
|
||||
@ -110,9 +107,10 @@ void QgsLayoutViewToolZoom::keyPressEvent( QKeyEvent *event )
|
||||
//respond to changes in the alt key status and update cursor accordingly
|
||||
if ( !event->isAutoRepeat() )
|
||||
{
|
||||
QPixmap zoomQPixmap = QPixmap( ( const char ** )( ( event->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( zoomQPixmap, 7, 7 );
|
||||
view()->viewport()->setCursor( zoomCursor );
|
||||
|
||||
view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
}
|
||||
event->ignore();
|
||||
}
|
||||
@ -122,9 +120,10 @@ void QgsLayoutViewToolZoom::keyReleaseEvent( QKeyEvent *event )
|
||||
//respond to changes in the alt key status and update cursor accordingly
|
||||
if ( !event->isAutoRepeat() )
|
||||
{
|
||||
QPixmap zoomQPixmap = QPixmap( ( const char ** )( ( event->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( zoomQPixmap, 7, 7 );
|
||||
view()->viewport()->setCursor( zoomCursor );
|
||||
|
||||
view()->viewport()->setCursor( ( event->modifiers() & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
}
|
||||
event->ignore();
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "qgsapplication.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgscolorswatchgrid.h"
|
||||
#include "qgscolorschemeregistry.h"
|
||||
#include "qgscolorwidgets.h"
|
||||
@ -34,6 +33,7 @@
|
||||
#include <QStyle>
|
||||
#include <QStyleOptionToolButton>
|
||||
#include <QWidgetAction>
|
||||
#include <QScreen>
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
#include <QPushButton>
|
||||
@ -246,10 +246,14 @@ void QgsColorButton::mouseMoveEvent( QMouseEvent *e )
|
||||
{
|
||||
//if left button depressed, sample color under cursor and temporarily update button color
|
||||
//to give feedback to user
|
||||
QPixmap snappedPixmap = QPixmap::grabWindow( QApplication::desktop()->winId(), e->globalPos().x(), e->globalPos().y(), 1, 1 );
|
||||
QImage snappedImage = snappedPixmap.toImage();
|
||||
QColor hoverColor = snappedImage.pixel( 0, 0 );
|
||||
setButtonBackground( hoverColor );
|
||||
QScreen *screen = findScreenAt( e->globalPos() );
|
||||
if ( screen )
|
||||
{
|
||||
QPixmap snappedPixmap = screen->grabWindow( QApplication::desktop()->winId(), e->globalPos().x(), e->globalPos().y(), 1, 1 );
|
||||
QImage snappedImage = snappedPixmap.toImage();
|
||||
QColor hoverColor = snappedImage.pixel( 0, 0 );
|
||||
setButtonBackground( hoverColor );
|
||||
}
|
||||
}
|
||||
e->accept();
|
||||
return;
|
||||
@ -298,6 +302,7 @@ void QgsColorButton::stopPicking( QPointF eventPos, bool sampleColor )
|
||||
releaseMouse();
|
||||
releaseKeyboard();
|
||||
unsetCursor();
|
||||
setMouseTracking( false );
|
||||
mPickingColor = false;
|
||||
|
||||
if ( !sampleColor )
|
||||
@ -307,7 +312,7 @@ void QgsColorButton::stopPicking( QPointF eventPos, bool sampleColor )
|
||||
}
|
||||
|
||||
//grab snapshot of pixel under mouse cursor
|
||||
QPixmap snappedPixmap = QPixmap::grabWindow( QApplication::desktop()->winId(), eventPos.x(), eventPos.y(), 1, 1 );
|
||||
QPixmap snappedPixmap = QApplication::desktop()->screen()->grab( QRect( eventPos.x(), eventPos.y(), 1, 1 ) );
|
||||
QImage snappedImage = snappedPixmap.toImage();
|
||||
//extract color from pixel and set color
|
||||
setColor( snappedImage.pixel( 0, 0 ) );
|
||||
@ -361,6 +366,18 @@ void QgsColorButton::dropEvent( QDropEvent *e )
|
||||
}
|
||||
}
|
||||
|
||||
QScreen *QgsColorButton::findScreenAt( const QPoint &pos )
|
||||
{
|
||||
for ( QScreen *screen : QGuiApplication::screens() )
|
||||
{
|
||||
if ( screen->geometry().contains( pos ) )
|
||||
{
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QgsColorButton::setValidColor( const QColor &newColor )
|
||||
{
|
||||
if ( newColor.isValid() )
|
||||
@ -672,12 +689,12 @@ void QgsColorButton::pasteColor()
|
||||
|
||||
void QgsColorButton::activatePicker()
|
||||
{
|
||||
//pick color
|
||||
QPixmap samplerPixmap = QPixmap( ( const char ** ) sampler_cursor );
|
||||
setCursor( QCursor( samplerPixmap, 0, 0 ) );
|
||||
//activate picker color
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Sampler ) );
|
||||
grabMouse();
|
||||
grabKeyboard();
|
||||
mPickingColor = true;
|
||||
setMouseTracking( true );
|
||||
}
|
||||
|
||||
QColor QgsColorButton::color() const
|
||||
|
@ -415,6 +415,7 @@ class GUI_EXPORT QgsColorButton : public QToolButton
|
||||
|
||||
private:
|
||||
|
||||
static QScreen *findScreenAt( const QPoint &pos );
|
||||
Behavior mBehavior = QgsColorButton::ShowDialog;
|
||||
QString mColorDialogTitle;
|
||||
QColor mColor;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "qgscolorscheme.h"
|
||||
#include "qgscolorschemeregistry.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "qgsaddremovemultiframecommand.h"
|
||||
#include "qgspaperitem.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgscomposerutils.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
@ -480,11 +479,9 @@ QCursor QgsComposerView::defaultCursorForTool( Tool currentTool )
|
||||
case Select:
|
||||
return Qt::ArrowCursor;
|
||||
|
||||
// Use custom QGIS cursor for ZoomIn
|
||||
case Zoom:
|
||||
{
|
||||
QPixmap myZoomQPixmap = QPixmap( ( const char ** )( zoom_in ) );
|
||||
return QCursor( myZoomQPixmap, 7, 7 );
|
||||
}
|
||||
return QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn );
|
||||
|
||||
case Pan:
|
||||
return Qt::OpenHandCursor;
|
||||
@ -492,16 +489,15 @@ QCursor QgsComposerView::defaultCursorForTool( Tool currentTool )
|
||||
case MoveItemContent:
|
||||
return Qt::ArrowCursor;
|
||||
|
||||
// Use QGIS custom cursor for the following
|
||||
case EditNodesItem:
|
||||
return Qt::CrossCursor;
|
||||
|
||||
case AddPolyline:
|
||||
case AddArrow:
|
||||
case AddMap:
|
||||
case AddRectangle:
|
||||
case AddTriangle:
|
||||
case AddEllipse:
|
||||
case AddPolygon:
|
||||
case AddPolyline:
|
||||
case AddHtml:
|
||||
case AddLabel:
|
||||
case AddScalebar:
|
||||
@ -509,10 +505,7 @@ QCursor QgsComposerView::defaultCursorForTool( Tool currentTool )
|
||||
case AddPicture:
|
||||
case AddTable:
|
||||
case AddAttributeTable:
|
||||
{
|
||||
QPixmap myCrosshairQPixmap = QPixmap( ( const char ** )( cross_hair_cursor ) );
|
||||
return QCursor( myCrosshairQPixmap, 8, 8 );
|
||||
}
|
||||
return QgsApplication::getThemeCursor( QgsApplication::Cursor::CrossHair );
|
||||
}
|
||||
return Qt::ArrowCursor;
|
||||
}
|
||||
@ -1688,10 +1681,9 @@ void QgsComposerView::keyPressEvent( QKeyEvent *e )
|
||||
else
|
||||
{
|
||||
//both control and space pressed
|
||||
//set cursor to zoom in/out depending on shift key status
|
||||
QPixmap myZoomQPixmap = QPixmap( ( const char ** )( ( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
|
||||
viewport()->setCursor( zoomCursor );
|
||||
viewport()->setCursor( ( e->modifiers() & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1724,9 +1716,9 @@ void QgsComposerView::keyPressEvent( QKeyEvent *e )
|
||||
mPreviousTool = mCurrentTool;
|
||||
setCurrentTool( Zoom );
|
||||
//set cursor to zoom in/out depending on alt key status
|
||||
QPixmap myZoomQPixmap = QPixmap( ( const char ** )( ( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
|
||||
viewport()->setCursor( zoomCursor );
|
||||
viewport()->setCursor( ( e->modifiers() & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1736,9 +1728,9 @@ void QgsComposerView::keyPressEvent( QKeyEvent *e )
|
||||
//using the zoom tool, respond to changes in alt key status and update mouse cursor accordingly
|
||||
if ( ! e->isAutoRepeat() )
|
||||
{
|
||||
QPixmap myZoomQPixmap = QPixmap( ( const char ** )( ( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
|
||||
viewport()->setCursor( zoomCursor );
|
||||
viewport()->setCursor( ( e->modifiers() & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1925,9 +1917,9 @@ void QgsComposerView::keyReleaseEvent( QKeyEvent *e )
|
||||
//if zoom tool is active, respond to changes in the alt key status and update cursor accordingly
|
||||
if ( ! e->isAutoRepeat() )
|
||||
{
|
||||
QPixmap myZoomQPixmap = QPixmap( ( const char ** )( ( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
|
||||
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
|
||||
viewport()->setCursor( zoomCursor );
|
||||
viewport()->setCursor( ( e->modifiers() & Qt::AltModifier ) ?
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn ) );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "qgscolorscheme.h"
|
||||
#include "qgscolorschemeregistry.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
@ -28,6 +27,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMouseEvent>
|
||||
#include <QScreen>
|
||||
#include <QInputDialog>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
@ -515,8 +515,7 @@ void QgsCompoundColorWidget::mAddCustomColorButton_clicked()
|
||||
void QgsCompoundColorWidget::mSampleButton_clicked()
|
||||
{
|
||||
//activate picker color
|
||||
QPixmap samplerPixmap = QPixmap( ( const char ** ) sampler_cursor );
|
||||
setCursor( QCursor( samplerPixmap, 0, 0 ) );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Sampler ) );
|
||||
grabMouse();
|
||||
grabKeyboard();
|
||||
mPickingColor = true;
|
||||
@ -544,6 +543,18 @@ void QgsCompoundColorWidget::mActionShowInButtons_toggled( bool state )
|
||||
}
|
||||
}
|
||||
|
||||
QScreen *QgsCompoundColorWidget::findScreenAt( const QPoint &pos )
|
||||
{
|
||||
for ( QScreen *screen : QGuiApplication::screens() )
|
||||
{
|
||||
if ( screen->geometry().contains( pos ) )
|
||||
{
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QgsCompoundColorWidget::saveSettings()
|
||||
{
|
||||
//save changes to scheme
|
||||
@ -696,8 +707,16 @@ QColor QgsCompoundColorWidget::averageColor( const QImage &image ) const
|
||||
QColor QgsCompoundColorWidget::sampleColor( QPoint point ) const
|
||||
{
|
||||
int sampleRadius = mSpinBoxRadius->value() - 1;
|
||||
QPixmap snappedPixmap = QPixmap::grabWindow( QApplication::desktop()->winId(), point.x() - sampleRadius, point.y() - sampleRadius,
|
||||
1 + sampleRadius * 2, 1 + sampleRadius * 2 );
|
||||
QScreen *screen = findScreenAt( point );
|
||||
if ( ! screen )
|
||||
{
|
||||
return QColor();
|
||||
}
|
||||
QPixmap snappedPixmap = screen->grabWindow( QApplication::desktop()->winId(),
|
||||
point.x() - sampleRadius,
|
||||
point.y() - sampleRadius,
|
||||
1 + sampleRadius * 2,
|
||||
1 + sampleRadius * 2 );
|
||||
QImage snappedImage = snappedPixmap.toImage();
|
||||
//scan all pixels and take average color
|
||||
return averageColor( snappedImage );
|
||||
|
@ -137,6 +137,8 @@ class GUI_EXPORT QgsCompoundColorWidget : public QgsPanelWidget, private Ui::Qgs
|
||||
|
||||
private:
|
||||
|
||||
static QScreen *findScreenAt( const QPoint &pos );
|
||||
|
||||
bool mAllowAlpha = true;
|
||||
|
||||
int mLastCustomColorIndex = 0;
|
||||
|
@ -1,191 +0,0 @@
|
||||
/***************************************************************************
|
||||
qgscursors.cpp
|
||||
|
||||
-------------------
|
||||
begin : 2007
|
||||
copyright : (C) 2007 by Gary E. Sherman
|
||||
email : sherman@mrcc.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#include "qgscursors.h"
|
||||
|
||||
#define SIP_NO_FILE
|
||||
|
||||
// cursors
|
||||
const char *zoom_in[] =
|
||||
{
|
||||
"16 16 3 1",
|
||||
". c None",
|
||||
"a c #000000",
|
||||
"# c #ffffff",
|
||||
".....#####......",
|
||||
"...##aaaaa##....",
|
||||
"..#.a.....a.#...",
|
||||
".#.a...a...a.#..",
|
||||
".#a....a....a#..",
|
||||
"#a.....a.....a#.",
|
||||
"#a.....a.....a#.",
|
||||
"#a.aaaa#aaaa.a#.",
|
||||
"#a.....a.....a#.",
|
||||
"#a.....a.....a#.",
|
||||
".#a....a....a#..",
|
||||
".#.a...a...aaa#.",
|
||||
"..#.a.....a#aaa#",
|
||||
"...##aaaaa###aa#",
|
||||
".....#####...###",
|
||||
"..............#."
|
||||
};
|
||||
|
||||
const char *zoom_out[] =
|
||||
{
|
||||
"16 16 4 1",
|
||||
"b c None",
|
||||
". c None",
|
||||
"a c #000000",
|
||||
"# c #ffffff",
|
||||
".....#####......",
|
||||
"...##aaaaa##....",
|
||||
"..#.a.....a.#...",
|
||||
".#.a.......a.#..",
|
||||
".#a.........a#..",
|
||||
"#a...........a#.",
|
||||
"#a...........a#.",
|
||||
"#a.aaaa#aaaa.a#.",
|
||||
"#a...........a#.",
|
||||
"#a...........a#.",
|
||||
".#a.........a#..",
|
||||
".#.a.......aaa#.",
|
||||
"..#.a.....a#aaa#",
|
||||
"...##aaaaa###aa#",
|
||||
".....#####...###",
|
||||
"..............#."
|
||||
};
|
||||
|
||||
|
||||
const char *capture_point_cursor[] =
|
||||
{
|
||||
"16 16 3 1",
|
||||
" » c None",
|
||||
".» c #000000",
|
||||
"+» c #FFFFFF",
|
||||
" ",
|
||||
" +.+ ",
|
||||
" ++.++ ",
|
||||
" +.....+ ",
|
||||
" +. .+ ",
|
||||
" +. . .+ ",
|
||||
" +. . .+ ",
|
||||
" ++. . .++",
|
||||
" ... ...+... ...",
|
||||
" ++. . .++",
|
||||
" +. . .+ ",
|
||||
" +. . .+ ",
|
||||
" ++. .+ ",
|
||||
" ++.....+ ",
|
||||
" ++.++ ",
|
||||
" +.+ "
|
||||
};
|
||||
|
||||
const char *select_cursor[] =
|
||||
{
|
||||
"16 16 3 1",
|
||||
"# c None",
|
||||
"a c #000000",
|
||||
". c #ffffff",
|
||||
".###############",
|
||||
"...#############",
|
||||
".aa..###########",
|
||||
"#.aaa..a.a.a.a.#",
|
||||
"#.aaaaa..#####a#",
|
||||
"#a.aaaaaa..###.#",
|
||||
"#..aaaaaa...##a#",
|
||||
"#a.aaaaa.#####.#",
|
||||
"#.#.aaaaa.####a#",
|
||||
"#a#.aa.aaa.###.#",
|
||||
"#.##..#..aa.##a#",
|
||||
"#a##.####.aa.#.#",
|
||||
"#.########.aa.a#",
|
||||
"#a#########.aa..",
|
||||
"#.a.a.a.a.a..a.#",
|
||||
"#############.##"
|
||||
};
|
||||
|
||||
const char *identify_cursor[] =
|
||||
{
|
||||
"16 16 3 1",
|
||||
"# c None",
|
||||
"a c #000000",
|
||||
". c #ffffff",
|
||||
".###########..##",
|
||||
"...########.aa.#",
|
||||
".aa..######.aa.#",
|
||||
"#.aaa..#####..##",
|
||||
"#.aaaaa..##.aa.#",
|
||||
"##.aaaaaa...aa.#",
|
||||
"##.aaaaaa...aa.#",
|
||||
"##.aaaaa.##.aa.#",
|
||||
"###.aaaaa.#.aa.#",
|
||||
"###.aa.aaa..aa.#",
|
||||
"####..#..aa.aa.#",
|
||||
"####.####.aa.a.#",
|
||||
"##########.aa..#",
|
||||
"###########.aa..",
|
||||
"############.a.#",
|
||||
"#############.##"
|
||||
};
|
||||
|
||||
const char *cross_hair_cursor[] =
|
||||
{
|
||||
"16 16 3 1",
|
||||
" » c None",
|
||||
".» c #000000",
|
||||
"+» c #FFFFFF",
|
||||
" ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" . ",
|
||||
" +++++ +++++",
|
||||
" ...... ......",
|
||||
" +++++ +++++",
|
||||
" . ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" +.+ ",
|
||||
" +.+ "
|
||||
};
|
||||
|
||||
const char *sampler_cursor[] =
|
||||
{
|
||||
"16 16 3 1",
|
||||
" » c None",
|
||||
".» c #000000",
|
||||
"+» c #FFFFFF",
|
||||
".. ",
|
||||
".+. ",
|
||||
" .+.. ",
|
||||
" .++. ",
|
||||
" .+++. ",
|
||||
" .+++. ",
|
||||
" .+++. ",
|
||||
" .+++... ",
|
||||
" .++... ",
|
||||
" ...... ",
|
||||
" ....... ",
|
||||
" ........ ",
|
||||
" .......",
|
||||
" ......",
|
||||
" .....",
|
||||
" ... "
|
||||
};
|
@ -1,38 +0,0 @@
|
||||
/***************************************************************************
|
||||
qgscursors.h
|
||||
|
||||
-------------------
|
||||
begin : 2007
|
||||
copyright : (C) 2007 by Gary E. Sherman
|
||||
email : sherman@mrcc.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
#ifndef QGSCURSORS_H
|
||||
#define QGSCURSORS_H
|
||||
|
||||
#include "qgis_gui.h"
|
||||
|
||||
#define SIP_NO_FILE
|
||||
|
||||
/**
|
||||
* \ingroup gui
|
||||
* Bitmap cursors for map operations.
|
||||
*/
|
||||
extern GUI_EXPORT const char *zoom_in[];
|
||||
extern GUI_EXPORT const char *zoom_out[];
|
||||
|
||||
extern GUI_EXPORT const char *capture_point_cursor[];
|
||||
extern GUI_EXPORT const char *select_cursor[];
|
||||
extern GUI_EXPORT const char *identify_cursor[];
|
||||
extern GUI_EXPORT const char *cross_hair_cursor[];
|
||||
extern GUI_EXPORT const char *sampler_cursor[];
|
||||
|
||||
#endif
|
@ -63,7 +63,6 @@ email : sherman at mrcc.com
|
||||
#include "qgsproject.h"
|
||||
#include "qgsrubberband.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmapthemecollection.h"
|
||||
#include <cmath>
|
||||
|
||||
@ -169,8 +168,7 @@ QgsMapCanvas::QgsMapCanvas( QWidget *parent )
|
||||
mPreviewEffect = new QgsPreviewEffect( this );
|
||||
viewport()->setGraphicsEffect( mPreviewEffect );
|
||||
|
||||
QPixmap zoomPixmap = QPixmap( ( const char ** )( zoom_in ) );
|
||||
mZoomCursor = QCursor( zoomPixmap, 7, 7 );
|
||||
mZoomCursor = QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn );
|
||||
|
||||
connect( &mAutoRefreshTimer, &QTimer::timeout, this, &QgsMapCanvas::autoRefreshTriggered );
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "qgsmaptoolcapture.h"
|
||||
|
||||
#include "qgscursors.h"
|
||||
#include "qgsexception.h"
|
||||
#include "qgsfeatureiterator.h"
|
||||
#include "qgsgeometryvalidator.h"
|
||||
@ -51,8 +50,7 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas *canvas, QgsAdvancedDigitizin
|
||||
|
||||
mSnapIndicator.reset( new QgsSnapIndicator( canvas ) );
|
||||
|
||||
QPixmap mySelectQPixmap = QPixmap( ( const char ** ) capture_point_cursor );
|
||||
setCursor( QCursor( mySelectQPixmap, 8, 8 ) );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::CapturePoint ) );
|
||||
|
||||
connect( canvas, &QgsMapCanvas::currentLayerChanged,
|
||||
this, &QgsMapToolCapture::currentLayerChanged );
|
||||
|
@ -14,7 +14,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsapplication.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsdistancearea.h"
|
||||
#include "qgsfeature.h"
|
||||
#include "qgsfeatureiterator.h"
|
||||
@ -56,9 +55,7 @@ QgsMapToolIdentify::QgsMapToolIdentify( QgsMapCanvas *canvas )
|
||||
, mLastMapUnitsPerPixel( -1.0 )
|
||||
, mCoordinatePrecision( 6 )
|
||||
{
|
||||
// set cursor
|
||||
QPixmap myIdentifyQPixmap = QPixmap( ( const char ** ) identify_cursor );
|
||||
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify ) );
|
||||
}
|
||||
|
||||
QgsMapToolIdentify::~QgsMapToolIdentify()
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmaptoolidentifyfeature.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
|
||||
@ -27,8 +26,7 @@ QgsMapToolIdentifyFeature::QgsMapToolIdentifyFeature( QgsMapCanvas *canvas, QgsV
|
||||
mToolName = tr( "Identify feature" );
|
||||
|
||||
// set cursor
|
||||
QPixmap cursorPixmap = QPixmap( ( const char ** ) cross_hair_cursor );
|
||||
mCursor = QCursor( cursorPixmap, 1, 1 );
|
||||
mCursor = QCursor( Qt::CrossCursor );
|
||||
}
|
||||
|
||||
void QgsMapToolIdentifyFeature::canvasReleaseEvent( QgsMapMouseEvent *e )
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "qgsmaptoolpan.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmaptopixel.h"
|
||||
#include <QBitmap>
|
||||
#include <QCursor>
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "qgsmaptoolzoom.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmaptopixel.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsrubberband.h"
|
||||
|
||||
#include <QMouseEvent>
|
||||
@ -35,8 +34,8 @@ QgsMapToolZoom::QgsMapToolZoom( QgsMapCanvas *canvas, bool zoomOut )
|
||||
{
|
||||
mToolName = tr( "Zoom" );
|
||||
// set the cursor
|
||||
QPixmap myZoomQPixmap = QPixmap( ( const char ** )( zoomOut ? zoom_out : zoom_in ) );
|
||||
mCursor = QCursor( myZoomQPixmap, 7, 7 );
|
||||
mCursor = zoomOut ? QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomOut ) :
|
||||
QgsApplication::getThemeCursor( QgsApplication::Cursor::ZoomIn );
|
||||
}
|
||||
|
||||
QgsMapToolZoom::~QgsMapToolZoom()
|
||||
|
@ -14,7 +14,6 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "coordinatecapturemaptool.h"
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
#include "qgsmaptopixel.h"
|
||||
#include "qgsrubberband.h"
|
||||
@ -29,9 +28,7 @@
|
||||
CoordinateCaptureMapTool::CoordinateCaptureMapTool( QgsMapCanvas *thepCanvas )
|
||||
: QgsMapTool( thepCanvas )
|
||||
{
|
||||
// set cursor
|
||||
QPixmap myCursor = QPixmap( ( const char ** ) capture_point_cursor );
|
||||
mCursor = QCursor( myCursor, 8, 8 ); //8,8 is the point in the cursor where clicks register
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::CrossHair ) );
|
||||
mpMapCanvas = thepCanvas;
|
||||
mpRubberBand = new QgsRubberBand( mpMapCanvas, QgsWkbTypes::PolygonGeometry );
|
||||
mpRubberBand->setColor( Qt::red );
|
||||
|
@ -26,7 +26,6 @@
|
||||
**/
|
||||
#include "eviseventidtool.h"
|
||||
|
||||
#include "qgscursors.h"
|
||||
#include "qgsmaptopixel.h"
|
||||
#include "qgsmaptool.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
@ -45,8 +44,7 @@ eVisEventIdTool::eVisEventIdTool( QgsMapCanvas *canvas )
|
||||
: QgsMapTool( canvas )
|
||||
{
|
||||
//set cursor
|
||||
QPixmap myIdentifyQPixmap = QPixmap( ( const char ** ) identify_cursor );
|
||||
mCursor = QCursor( myIdentifyQPixmap, 1, 1 );
|
||||
setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify ) );
|
||||
|
||||
//set the current tool to this object
|
||||
if ( mCanvas )
|
||||
|