[Qt-interest] Problem with widget + opengl

fungos fungos at gmail.com
Sun Dec 6 05:15:56 CET 2009


Hi, I'm having trouble to get some widgets working under
QGraphicsScene + OpenGL.

This is the code:

Dialog::Dialog(QGraphicsScene *scene, const QString &title)
{
	QWidget *widget = new QWidget;
	setCentralWidget(widget);

	// Working
	this->setWindowOpacity(0.75);
	this->setWindowTitle("Properties");

	// Issue 1: Menu doesn't work - I can't click it
	QMenu *menuFile = new QMenu(tr("&File"), this);
	QAction *actionNew = new QAction(tr("&New"), this);
	actionNew->setShortcut(QKeySequence::New);
	actionNew->setStatusTip(tr("Create a new project"));
	menuFile->addAction(actionNew);
	this->menuBar()->addMenu(menuFile);

	// Issue 2: Layout doesn't work - widgets get over each other
	this->setLayout(new QVBoxLayout);
	this->layout()->addWidget(new QCheckBox("Check 1"));
	this->layout()->addWidget(new QCheckBox("Check 2"));
	this->layout()->addWidget(new QCheckBox("Check 3"));

	// Style working
	//this->setStyle(QStyleFactory::create("Plastique"));
}

My scene:

...
	Dialog *d = new Dialog(this, "Test");
	d->move(8, 30);
	d->resize(200, 300);

	CustomProxy *proxy = new CustomProxy(0, Qt::Window |
Qt::WindowTitleHint | Qt::CustomizeWindowHint); //Qt::Window);
	proxy->setWidget(d);

	this->addItem(proxy);
...

Download code + project here:
http://jump.fm/JNPKL

Anyone can help me with this? I used to get something like this
working in 4.5, but looks like a lot of things changed since there.
Thank you



More information about the Qt-interest-old mailing list