[Interest] QPainter, elastic rectangles

Rainer Wiesenfarth Rainer_Wiesenfarth at Trimble.com
Mon Jul 29 09:11:41 CEST 2013


From: Alexander Syvak
> Look at the next piece of code
> 
> void event_dlg::create_pattern() 
> {
>     qDebug() << "create_pattern() slot's been called!";
>     pattern_qualifier ptrn_qualifier_wdg(this);
>     ptrn_qualifier_wdg.setWindowFlags(Qt::FramelessWindowHint|Qt::Popup);
// ...
>     auto const full_screen_rect =
QApplication::desktop()->screenGeometry(); // ...
>     ptrn_qualifier_wdg.setGeometry(full_screen_rect);
>     ptrn_qualifier_wdg.showMaximized();
>     int usr_anwer = ptrn_qualifier_wdg.exec();
> }
> The event_dlg is of type QDialog. The pattern_qualifier may be anything
from QWidget, QDialog, QMainWindow.
> 
> #1. When it inherits QWidget it's not visible or it's not even started. I
don't understand this.
> 
> #2. When it inherits QDialog without Qt::Popup flag set, the event_dlg
window is blocked except the title bar thereof.
> #3. After the Qt::Popup flag is set it is shown and it works.
> 
> Why in #1 it's not shown at all?

QWidget does not have a method exec(), how do you manage to compile it?

> Why in #2 it's blocking its parent but not visible

QDialog is application modal by default, i.e. you application's event loop
is blocked until the dialog closes.

> Why in #3 it's working fine with Qt::Popup?

Hmm, no idea for this one.

To solve your problem, you might refer to the "Code Examples" section of the
QDialog documentation.

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
Software Engineer | Trimble Imaging Division
Rotebühlstraße 81 | 70178 Stuttgart | Germany
Office +49 711 22881 0 | Fax +49 711 22881 11
http://www.trimble.com/geospatial/ | http://www.inpho.de/

Trimble Germany GmbH, Am Prime Parc 11, 65479 Raunheim
Eingetragen beim Amtsgericht Darmstadt unter HRB 83893,
Geschäftsführer: Dr. Frank Heimberg, Hans-Jürgen Gebauer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6490 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130729/209d4f0e/attachment.bin>


More information about the Interest mailing list