uwerat / qskinny

A lightweight framework on top of the Qt scene graph and only few classes from Qt/Quick. It is usable from C++ and/or QML.
1.45k stars 293 forks source link

qquickitem display problem #421

Closed hestrro closed 2 months ago

hestrro commented 2 months ago

How should I display a custom image that inherits qquickitem in qskwindow? Should I additem directly?

hestrro commented 2 months ago

Are there similar concepts of view, scene, and item?

uwerat commented 2 months ago

Guess by "custom image" you mean a QImage you have rendered using QPainter - you can use QskGraphic then.

Note, that QskGraphic is a paint device itself and you might not need the QImage. When drawing your content directly to it the result will be scalable.

There are various ways how to display a QskGraphic as a texture on the scene graph. The most simple one is to use a QskGraphicLabel.

hestrro commented 2 months ago

Thank you, I think I found what I want, I want to draw an roi by dragging with the mouse, such as rectangle, circle, concentric circle, etc. I found that qskGraphic can accept a qpainterpath parameter, this should help I achieve the desired effect

uwerat commented 2 months ago

QskGraphic graphic;

QPainter painter( &graphic ); painter.setPen( ... ); painter.setBrush( .. ); painter.drawXXX( ... ); ...