qt - How select an area in QQuickPaintedItem -


i want build selection tool qml image editor.

for this, i'm looking similar function setselectedarea in qgraphicsscene. has solution this?

greetings

edit: maybe can write plugin selection tool extends qquickitem , draw qpolygon opengl.

you need implement selection yourself.

you can create mousearea track mouse activity , update selected rect accordingly. mean this:

documentviewer { // qquickpainteditem     id: viewer     mousearea {         anchors.fill: parent         acceptedbuttons: qt.leftbutton         property real originx: 0         property real originy: 0         onpressed: {             originx = mouse.x             originy = mouse.y         }         onpositionchanged: {             var width = mouse.x - originx             var height = mouse.y - originy             viewer.selectionrect = qt.rect(originx, originy, width, height)         }     } } 

then you'll able update and paint selection rectangle in viewer's selectionrect property setter.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -