Skip to content
  • Qtquick\Qml Arc

    Unsolved QML and Qt Quick
    4
    0 Votes
    4 Posts
    2k Views
    ndiasN

    Hi @fallouthase,

    Please find bellow a simple example using PathAngleArc:

    https://doc.qt.io/qt-6/qml-qtquick-pathanglearc.html import QtQuick.Shapes Shape { width: 200 height: 200 anchors.top: parent.top anchors.left: parent.left // Enable multisampled rendering layer.enabled: true layer.samples: 4 // Outer gray arc: ShapePath { fillColor: "transparent" strokeColor: "gray" strokeWidth: 20 capStyle: ShapePath.RoundCap PathAngleArc { centerX: 100; centerY: 100 radiusX: 100-20/2; radiusY: 100-20/2 startAngle: 135 sweepAngle: 270 } } // Inner blue arc: ShapePath { fillColor: "transparent" strokeColor: "blue" strokeWidth: 20 capStyle: ShapePath.RoundCap PathAngleArc { centerX: 100; centerY: 100 radiusX: 100-20/2; radiusY: 100-20/2 startAngle: 135 sweepAngle: 180 } } }

    8aa108e1-c336-46a0-a39e-af38847fdfed-image.png

    You can also use already implemented customizable QML Circular Slider:

    https://github.com/arunpkqt/CircularSlider

    Best Regards

  • 0 Votes
    1 Posts
    324 Views
    No one has replied
  • QML Shape and ShapePath

    Unsolved QML and Qt Quick
    1
    0 Votes
    1 Posts
    562 Views
    No one has replied
  • 0 Votes
    2 Posts
    885 Views
    mrjjM

    Hi
    I just keep a pointer to the "white lines" and adjust if i move yellow.

    class ColorItem : public QGraphicsItem { .. ConnectorLine* line = nullptr; .. protected: QVariant itemChange(GraphicsItemChange change, const QVariant& value) override { if (change == ItemPositionChange && scene()) { if (line) { line->adjust(); } } return QGraphicsItem::itemChange(change, value); } private: QColor color; };

    line->Adjust() alters its endpoints. You could just adjust it directly here.

  • 0 Votes
    11 Posts
    4k Views
    H

    @Asperamanca

    No, I didn't set these two flags ItemClipsToShape, ItemClipsChildrenToShape.

    Then I tried setting only one flag ItemClipsToShape, and both of ItemClipsToShape, ItemClipsChildrenToShape. For each, it still check if the point is in the boundingrect() firstly, and then check the shape() which means if point is not in boundingrect(), it wouldn't bother to check shape().

    So now my solution is still enlarging the boundingrect() area.

  • 0 Votes
    24 Posts
    12k Views
    Joel BodenmannJ

    @mrjj Well, thanks to you and @kshegunov too. You guys are amazing!