Non-retangular shapes
-
Will going forward QML support irregular shapes.
-
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
-
My point is, it should be easier to work with non-retangular areas in Qt Quick. Will this be supported in the future?
-
[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."
-
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 :).
-
Have you checked the Pie menu implementation in Qt solutions: http://doc.trolltech.com/qq/qq09-qt-solutions.html
-
Hope the next release of QML supports handling such irregular shapes.
-
[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.
-
[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.
-
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 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.
-
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. -
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]
-
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] -
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. -
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
-
Hi,
In the mean time; is there any improvement in supporting irregular shapes (and MouseAreas) in QtQuick?
I can't find them.....