patrik08
7th July 2007, 11:17
Why QGraphicsTextItem dont open link? is this a bug?
or is here other method to append QGraphicsTextItem to scene?
a minimal build main.cpp is attach here.
/* load central widget */
void Load_Connector()
{
view = new QGraphicsView(this); /* QMainWindow */
Vbar = view->verticalScrollBar();
Hbar = view->horizontalScrollBar();
QGraphicsScene *scene = new QGraphicsScene(view);
scene->setSceneRect( 0, 0, 1000, 1000 );
view->setScene(scene);
setCentralWidget(view);
/* set tag xhtml to projekt xml tag */
QString qthtml = "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"><span style=\" font-family:'Impact'; font-size:26pt; color:#5555ff;\">H</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#0000ff;\">e</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ff0000;\">l</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ffff00;\">l</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ffaa7f;\">o</span>"
"<span style=\" font-family:'Impact'; font-size:26pt;\"> </span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#00ff00;\">color</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ff0000;\"> world</span>"
"<span style=\" font-family:'Impact'; font-size:26pt;\">!</span>"
"<a href=\"http://wiki.qtcentre.org/index.php?title=QGraphicsTextItem\"><span style=\" text-decoration: underline; color:#0000ff;\">link</span></a> </p> ";
QGraphicsTextItem* txtarea = scene->addText("");
txtarea->setHtml(qthtml);
txtarea->setOpenExternalLinks(true); /* set clickable */
txtarea->setFlag(QGraphicsItem::ItemIsMovable);
ViewPoint(0); /* scroll area stay 0 to init! */
}
or is here other method to append QGraphicsTextItem to scene?
a minimal build main.cpp is attach here.
/* load central widget */
void Load_Connector()
{
view = new QGraphicsView(this); /* QMainWindow */
Vbar = view->verticalScrollBar();
Hbar = view->horizontalScrollBar();
QGraphicsScene *scene = new QGraphicsScene(view);
scene->setSceneRect( 0, 0, 1000, 1000 );
view->setScene(scene);
setCentralWidget(view);
/* set tag xhtml to projekt xml tag */
QString qthtml = "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;\"><span style=\" font-family:'Impact'; font-size:26pt; color:#5555ff;\">H</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#0000ff;\">e</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ff0000;\">l</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ffff00;\">l</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ffaa7f;\">o</span>"
"<span style=\" font-family:'Impact'; font-size:26pt;\"> </span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#00ff00;\">color</span>"
"<span style=\" font-family:'Impact'; font-size:26pt; color:#ff0000;\"> world</span>"
"<span style=\" font-family:'Impact'; font-size:26pt;\">!</span>"
"<a href=\"http://wiki.qtcentre.org/index.php?title=QGraphicsTextItem\"><span style=\" text-decoration: underline; color:#0000ff;\">link</span></a> </p> ";
QGraphicsTextItem* txtarea = scene->addText("");
txtarea->setHtml(qthtml);
txtarea->setOpenExternalLinks(true); /* set clickable */
txtarea->setFlag(QGraphicsItem::ItemIsMovable);
ViewPoint(0); /* scroll area stay 0 to init! */
}