[Qt-interest] QDialog + Qt::FramelessWindowHint = void?
Ulf-Alexander v. Ceumern-Lindenstjerna
ceumern at vrmagic.com
Mon Mar 1 15:46:12 CET 2010
Thanks, setting the wflag in the ctor actually resolved the issue.
Regards, Ulf
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of David Ching
> Sent: Monday, March 01, 2010 3:23 PM
> To: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] QDialog + Qt::FramelessWindowHint = void?
>
> "Ulf-Alexander v. Ceumern-Lindenstjerna" <ceumern at vrmagic.com> wrote
in
> message
> news:1C5B9B48EC79514FB4F4A7884ACFCB9FE0DCB4 at vrmserver1.vrm.local...
> > Hi List!
> >
> > I want to create my own QDialog, doing some custom painting. For
that
> I
> > need to hide the default windows decoration.
> >
> > However, when I call setWindowFlags(Qt::FramelessWindowHint); my
> dialog
> > ceases to show at all.
> >
> > Code:
> >
> > class EsogDialog : public QDialog
> > {
> > Q_OBJECT
> >
> > typedef QDialog base_class_type;
> > public:
> > EsogDialog(QWidget *parent);
> > ~EsogDialog();
> >
> > protected:
> > virtual void paintEvent( QPaintEvent * event );
> > virtual void showEvent( QShowEvent * event );
> >
> > private:
> >
> > };
> >
> > EsogDialog::EsogDialog(QWidget *parent)
> > : base_class_type(parent)
> > {
> > setAttribute(Qt::WA_TranslucentBackground);
> > setWindowFlags(Qt::FramelessWindowHint);
> >
> > // create full screen widget in background using parent
> > QDialogButtonBox *buttonBox = new
> QDialogButtonBox(QDialogButtonBox::Ok
> > | QDialogButtonBox::Cancel);
> >
> > QVBoxLayout *l = new QVBoxLayout;
> > l->addWidget(new QLabel("Some Text."));
> > l->addWidget(buttonBox);
> > setLayout(l);
> >
> > connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
> > connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
> > }
> >
> > Calling code:
> >
> > EsogDialog
> >
>
d(static_cast<QWidget*>(EsogEventFilterSingleton::getrSingleton().paren
> t()));
> > int ret = d.exec();
> >
> > otherCode(); // <-- never reached when
> > setWindowFlags(Qt::FramelessWindowHint); is active
> >
>
> On Mac, I saw the default Qt::Dialog style caused some weirdness
> (window was
> always on top), replacing with Qt::Window fixed it. Also, try setting
> these
> style bits in the ctor call to the parent (I think it's the second
> parameter, after "parent"), not in the ctor body.
>
> -- David
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list