Some issues with rotation of buttons inside a circle



  • hi ,
    I wanted to partition a circle into 5 clickable area (buttons) using QML so when I click on any area of them , the circle should rotate until this area reach the middle of the left side of the window then stop.

    This is what I have done so far :
    "Before rotation":http://postimg.org/image/tkfiblfpr/
    "After rotation":http://postimg.org/image/5rlzbmja1/

    The issues I have right now :

    1- The clickable area is in the shape of a rectangle or a circle but I need every area of the 5 to be clickable and they are in a shape of an arc.

    2- The text inside each area became upside down or rotated by an angle after rotation while I don't want it to rotate while moving on the circle .

    3- how can I add this circle as a part of QT widget GUI ?

    Thanks in advance.



  • MouseArea is specified in width*height. So it is shape of rectangle. If you define the MouseArea for entire rectangle you should be able to get the mouse clicks.

    Since you are rotating the entire circle, items inside will also get rotated. You need to separate out text area and rotate the text in opposite direction of your circle movement.

    Please look QWidget::createWindowContainer(...) in Qt Assistant.



  • Thanks for replying and both answers for the last two questions are indeed what I was looking for , thanks :)

    But I don't get what you mean by defining the MouseArea for entire rectangle , I want each area or arc of the 5 to act like a button so they can't be in the shape of a rectangle , the clickable area for each one of them must be in the shape of an arc , can that be done in QML ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.