[Qt-interest] Can QTextEdit scale in the way what QGraphicsView does?

Guido Seifert Wargand at gmx.de
Thu May 20 13:28:48 CEST 2010




> Embedding a Widget with QGraphicsProxyWidget
> 
> There are two ways to embed a widget using QGraphicsProxyWidget. The most
> common way is to pass a widget pointer to
> QGraphicsScene::addWidget<http://doc.qt.nokia.com/4.6/qgraphicsscene.html#addWidget>()
> together with any relevant
> Qt::WindowFlags<http://doc.qt.nokia.com/4.6/qt.html#WindowType-enum>.
> This function returns a pointer to a QGraphicsProxyWidget. You can then
> choose to reparent or position either the proxy, or the embedded widget
> itself.
> 

Interesting. I really missed that part. But why easy, when there is a more 
complicated way. :-/

I am just seeing you create your widget with 'this' as parent. To add it to
a QGraphicsScene use 0 as parent:

QTextEdit* textEdit = new QTextEdit(0);
textEdit->setText("Hello, Qt");
scene->addWidget(textEdit);

Should work.


Guido

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the Qt-interest-old mailing list