Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Non-retangular shapes
Forum Updated to NodeBB v4.3 + New Features

Non-retangular shapes

Scheduled Pinned Locked Moved QML and Qt Quick
23 Posts 8 Posters 20.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    puelocesar
    wrote on last edited by
    #8

    Thanks for the replies everybody! I had that implemented already, but I didn't like the methods to achieve that..

    The image inside circle I did with a c++ extension to do the clipping:

    @QRegion regiao(boundingRect().x(), boundingRect().y(), boundingRect().width(), boundingRect().height(), QRegion::Ellipse);
    painter->setClipRegion(regiao);
    painter->drawImage(boundingRect(), QImage("../ParesQml/" + imagem()));@

    I know I could just put a PNG image with a transparent circle inside it, but it woudn't work for me, because I need transparent background..

    The 3 arcs are 3 PNG images with transparency, and when I mouse hover then, they became orange..

    But I had problems with the retangular MouseArea, because I needed the arcs to be buttons, but I had retangular mouseAreas instead. Anyway, I solved that by putting a smaller rounded mouseArea above the arcs, so as Quick doesn't support overlapping MouseAreas, it sort of cut off the arc's retangular mouseArea :P

    1 Reply Last reply
    0
    • P Offline
      P Offline
      puelocesar
      wrote on last edited by
      #9

      My point is, it should be easier to work with non-retangular areas in Qt Quick. Will this be supported in the future?

      1 Reply Last reply
      0
      • 2 Offline
        2 Offline
        2beers
        wrote on last edited by
        #10

        [quote author="puelocesar" date="1291289914"]My point is, it should be easier to work with non-retangular areas in Qt Quick. Will this be supported in the future?[/quote]

        I asked a similar question a few month ago and it seems that non-rectangular shapes have a lot of limitations. my problem was with clipping a "rounded" rectangle: "here is what doc is tolding":http://doc.qt.nokia.com/4.7/qml-item.html#clip-prop

        "Non-rectangular clipping regions are not supported for performance reasons."

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xsacha
          wrote on last edited by
          #11

          There's a special widget in here: http://developer.qt.nokia.com/wiki/EmbeddedWidgetDemos
          Source code is at the top.
          At the bottom of the page, look at Qt5WayWidget. I think you could modify it to a 4 way widget. It looks to be exactly what you want.

          Then you just need to put the class in to QML as a Type :).

          • Sacha
          1 Reply Last reply
          0
          • B Offline
            B Offline
            blex
            wrote on last edited by
            #12

            Have you checked the Pie menu implementation in Qt solutions: http://doc.trolltech.com/qq/qq09-qt-solutions.html


            Oleksiy Balabay

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kamalakshantv
              wrote on last edited by
              #13

              Hope the next release of QML supports handling such irregular shapes.

              1 Reply Last reply
              0
              • X Offline
                X Offline
                xsacha
                wrote on last edited by
                #14

                [quote author="blex" date="1291440045"]Have you checked the Pie menu implementation[/quote]

                Which you can link to QML with a plugin like this: http://doc.qt.nokia.com/latest/declarative-tutorials-extending-chapter6-plugins.html

                It's for PieChart but just as easily PieMenu.

                This is what you'll need to do until there's proper support for arcs and so on.

                • Sacha
                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  blex
                  wrote on last edited by
                  #15

                  [quote author="xsacha" date="1291440435"]
                  Which you can link to QML with a plugin like this: http://doc.qt.nokia.com/latest/declarative-tutorials-extending-chapter6-plugins.html[/quote]

                  Thanks for the link.


                  Oleksiy Balabay

                  1 Reply Last reply
                  0
                  • P Offline
                    P Offline
                    puelocesar
                    wrote on last edited by
                    #16

                    Thanks for the tips! That's what I'm doing, creating c++ extensions to things I can't do in Qml. But I'm having serious problems in turning these extensions in plugins...

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      kamalakshantv
                      wrote on last edited by
                      #17

                      [quote author="puelocesar" date="1291636834"]Thanks for the tips! That's what I'm doing, creating c++ extensions to things I can't do in Qml. But I'm having serious problems in turning these extensions in plugins...[/quote]

                      May be you can post the problems faced in the forums and someone might help you out.

                      1 Reply Last reply
                      0
                      • X Offline
                        X Offline
                        xsacha
                        wrote on last edited by
                        #18

                        You know how you need a qmlviewer C++ wrapper (well eventually)?
                        You can put plugin code in there. Then you don't need to compile it separate and worry about plugins. You can just run the app and the plugin will be compiled inside the wrapper.
                        The only downside is no auto complete in qml for that type.

                        • Sacha
                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          puelocesar
                          wrote on last edited by
                          #19

                          It's here: https://developer.qt.nokia.com/forums/viewthread/2103/ :)

                          [quote author="QtK" date="1291637122"]
                          [quote author="puelocesar" date="1291636834"]Thanks for the tips! That's what I'm doing, creating c++ extensions to things I can't do in Qml. But I'm having serious problems in turning these extensions in plugins...[/quote]

                          May be you can post the problems faced in the forums and someone might help you out.[/quote]

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            puelocesar
                            wrote on last edited by
                            #20

                            Yes, that's what I'm doing actually...

                            But I wanted to create plugins to have a better organization between projects. Imagine 10 projects, all using a similar extension, if I wanted to change the extension, it would be MUCH easier if I had only one plugin to change and compile, get it?

                            [quote author="xsacha" date="1291637394"]You know how you need a qmlviewer C++ wrapper (well eventually)?
                            You can put plugin code in there. Then you don't need to compile it separate and worry about plugins. You can just run the app and the plugin will be compiled inside the wrapper.
                            The only downside is no auto complete in qml for that type.[/quote]

                            1 Reply Last reply
                            0
                            • X Offline
                              X Offline
                              xsacha
                              wrote on last edited by
                              #21

                              Yes, as your project gets larger just move those classes out in to separate projects. Compile the plugin separately. List the plugin in your qmldir.
                              I just thought it'd help you get started if just included it in the wrapper. I had problems compiling plugins too.

                              • Sacha
                              1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                puelocesar
                                wrote on last edited by
                                #22

                                Well, I posted all my plugin code on the other thread.. Let's hope someone points out what is that stupid thing that I'm doing and how to fix it :P

                                Until that, I'm using c++ extensions like you said

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  Msuijkerbuijk
                                  wrote on last edited by
                                  #23

                                  Hi,

                                  In the mean time; is there any improvement in supporting irregular shapes (and MouseAreas) in QtQuick?
                                  I can't find them.....

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved