[Interest] [Quick Controls 2] Best way to add binding arrow tip to Popup?

Mitch Curtis mitch.curtis at qt.io
Wed Oct 12 16:30:23 CEST 2016


It probably wasn't mentioned because it's got a bad reputation as being slow. It's easy to abuse it and end up with crappy performance. As long as you limit the amount of painting you do and how often you do it, I don't think using it is really an issue in practice.

________________________________________
From: Interest <interest-bounces+mitch.curtis=qt.io at qt-project.org> on behalf of Oleg Evseev <ev.mipt at gmail.com>
Sent: Wednesday, 12 October 2016 1:48:54 PM
To: Qt Project
Subject: Re: [Interest] [Quick Controls 2] Best way to add binding arrow tip to Popup?

Great thanks, Shawn.

Canvas is what I searching for!

Even in canvas example there is a Talk bubble example that is look similar to tipped Popup!
[Встроенное изображение 1]

Canvas is Qt Quick Item, so it is quite easy to add it on the scene and add a shadows (or other effects) to it
[Встроенное изображение 2]
and use it as background for Qt Quick Controls.

Only thing that I miss is the inner border in Canvas (to be identical to Rectangle drawing principle). But for simple tipped popup (rectangle with rounded corners and tip) it was quite easy to recalculate coordinates points.
Plus, apparently there is the other solution with globalCompositeOperation http://stackoverflow.com/a/34234589/5765076 for complex shapes (didn't test it).

I made tipped rectangle with Canvas and it looks great!

I really surprised, why using Canvas item was not suggested in first place?!

And you, Shawn, write this:

... we've always needed support for arbitrary shapes in QtQuick.  We’ll have them eventually…

like Canvas is not the really good solution - just a workaround. That is, it not claims to be "support for arbitrary shapes in QtQuick".

Why? How your ideal support for arbitrary shapes in QtQuick will look like in general words, then?

What about Canvas vs QSGGeometry Node approach? Only performance aspects?

--
Regards, Oleg.

2016-10-10 10:41 GMT+03:00 Shawn Rutledge <Shawn.Rutledge at qt.io<mailto:Shawn.Rutledge at qt.io>>:
You can add two rotated rectangles, one underneath for the border, and one (on top) for the fill, to cover up the edge of the main rectangle.  Next you will want a drop shadow, then you need a couple more Rectangles (or something from GraphicalEffects) underneath.

This is a good illustration of why we've always needed support for arbitrary shapes in QtQuick.  We’ll have them eventually…

Meanwhile you can use Canvas (draw the shape) or BorderImage (pull edge, corner and center pieces from an image and assemble them into a resizable balloon).

_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 26155 bytes
Desc: image.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161012/025f83d5/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 18626 bytes
Desc: image.png
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161012/025f83d5/attachment-0001.png>


More information about the Interest mailing list