[Qt-interest] QDialog + Qt::FramelessWindowHint = void?

Ulf-Alexander v. Ceumern-Lindenstjerna ceumern at vrmagic.com
Mon Mar 1 12:15:03 CET 2010


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().parent()));
int ret = d.exec();

otherCode(); // <-- never reached when setWindowFlags(Qt::FramelessWindowHint); is active

regards, Ulf

--
Ulf v. Ceumern
Dipl.-Inf.

VRmagic GmbH
Augustaanlage 32
68165 Mannheim, Germany
E-Mail: ceumern at vrmagic.com

Tel.: +49/621/400416-52
Fax: +49/621/400416-99


Steuernummer: 38189/54003
USt.IdNr.: DE217365947
Registergericht: Amtsgericht Mannheim, HRB 8958
Geschäftsführer: Norbert Hinckers, Dr. Markus Schill
--






More information about the Qt-interest-old mailing list