Re: [Interest] Custom-shaped QDialog or similar

2013-05-22 Thread Sensei

Thanks to both of you for your hints.

I am now modifying the Window Flags example, in order to have it my way. 
For this proof of concept, I am trying to do two things:

- Have the custom-shaped window

- Move the window where I want: beside the Quit button.


However, something's wrong here. I am using QRegion to define the shape, 
and moving it with move().

If I set the window type to Qt::Tool I still have the window title, but 
I can see the clipping working just fine. When I set the type to 
Qt::Tooltip or use Qt::FramelessWindowHint, the whole window disappears!

Moreover, I am unable to move it where I want. I know it is some kind of 
coordinates misunderstanding here...


Can anyone enlighten me? Code follows.


Cheers!



void ControllerWindow::updatePreview()
{
 //...

 QPoint b = quitButton-mapToGlobal(quitButton-pos());

 pos.setX(b.x() + quitButton-width()  / 2);
 pos.setY(b.y() + quitButton-height() / 2);

 previewWindow-move(quitButton-mapToParent(pos));
}




PreviewWindow::PreviewWindow(QWidget *parent) : QWidget(parent)
{
 //...
 QVectorQPoint pts;

 pts.push_back(QPoint(0, 10));
 pts.push_back(QPoint(36, 10));
 pts.push_back(QPoint(36+10, 0));
 pts.push_back(QPoint(36+20, 10));
 pts.push_back(QPoint(296, 10));
 pts.push_back(QPoint(296, 266));
 pts.push_back(QPoint(0, 266));
 QPolygon p(pts);

 setMask(QRegion(pts));
}


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Custom-shaped QDialog or similar

2013-05-21 Thread Rutledge Shawn

On 21 May 2013, at 8:20 AM, Rutledge Shawn wrote:

 
 On 17 May 2013, at 4:19 PM, Sensei wrote:
 
 Dear all,
 
 I'd like to try something new for an application: having a custom shaped 
 dialog for some options. You can see my desire in the attachment.
 
 Now, what do you suggest to do that? I am lost here!
 
 Using a QDialog maybe? But how can I position it exactly where I'd like? 
 Should this be modal? I'd say no: if a user clicks elsewhere, it should 
 disappear, probably.
 
 It's the first time I'm trying something like this, so any suggestion is 
 more than welcome!
 
 If you are using a Mac, that kind of window is called a popover.  We don't 
 have support for it yet in Qt, but it should be in Qt::WindowFlags eventually 
 (but only on the Mac).
 
 Yes you can fake it with Qt Quick, and you could draw the outline with the 
 Canvas API, but probably it's easier to use BorderImage because of the 
 shadows.  See 
 qtdeclarative/examples/quick/imageelements/content/ShadowRectangle.qml for 
 example, but you will need an image with the pointy part already done.  Make 
 it as wide as the maximum-width popover you will ever want, so you can use 
 horizontalTileMode: BorderImage.Repeat without ever repeating the pointy 
 part.  The height won't matter as much.  If the popovers sometimes go upwards 
 then you might need two different images.
 
 Since the pointy part is always inside another window, you don't necessarily 
 need a shaped window for the popover, but a separate Window will allow the 
 popover to extend outside the main window if necessary.  Maybe use a QtQuick 
 Window, set color: transparent and then provide the frame yourself with 
 BorderImage?  Later on you can remove that and set the new window flag when 
 it's working.

But since this is a bit complex I'm beginning to wonder if we should provide a 
reusable Popover in QtQuick.Dialogs.
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


Re: [Interest] Custom-shaped QDialog or similar

2013-05-17 Thread Joseph Crowell
This would be easiest with Qt Quick but the shaped clock example is a 
good starting point if you want to use widgets.


On 5/18/2013 12:19 AM, Sensei wrote:

Dear all,

I'd like to try something new for an application: having a custom 
shaped dialog for some options. You can see my desire in the attachment.


Now, what do you suggest to do that? I am lost here!

Using a QDialog maybe? But how can I position it exactly where I'd 
like? Should this be modal? I'd say no: if a user clicks elsewhere, it 
should disappear, probably.


It's the first time I'm trying something like this, so any suggestion 
is more than welcome!


Cheers!



___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest


___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest