1 Attachment(s)
QGraphicsTextItem dont open Link /bug?
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.
Code:
/* load central widget */
void Load_Connector()
{
Vbar = view->verticalScrollBar();
Hbar = view->horizontalScrollBar();
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> ";
txtarea->setHtml(qthtml);
txtarea->setOpenExternalLinks(true); /* set clickable */
ViewPoint(0); /* scroll area stay 0 to init! */
}
Re: QGraphicsTextItem dont open Link /bug?
Code:
txtarea->setTextInteractionFlags(Qt::LinksAccessibleByMouse); // | Qt::LinksAccessibleByKeyboard
Re: QGraphicsTextItem dont open Link /bug?
Quote:
Originally Posted by
jpn
Code:
txtarea->setTextInteractionFlags(Qt::LinksAccessibleByMouse); // | Qt::LinksAccessibleByKeyboard
OK .. tanks i found ... but is not possibel to make it ItemIsMovable and
Qt::TextBrowserInteraction on same modus? i must split modus to
view edit preview , correct or is this mistake?
Code:
txtarea->setHtml(qthtml);
txtarea->setOpenExternalLinks(true); /* set clickable */
////txtarea->setTextInteractionFlags(Qt::TextEditorInteraction);
txtarea->setTextInteractionFlags(Qt::TextBrowserInteraction);
txtarea
->ensureVisible
(QRectF(10,
10,
200,
200),
80,
80);
txtarea->moveBy(100,200);
Re: QGraphicsTextItem dont open Link /bug?
Quote:
Originally Posted by
patrik08
but is not possibel to make it ItemIsMovable and
Qt::TextBrowserInteraction on same modus?
Well, setting Qt::TextBrowserInteraction makes the item to handle mouse move events as selection. You should still be able to move the item by grabbing from its edges.
Re: QGraphicsTextItem dont open Link /bug?
Now i have adjusted and it paint correct ..
but ..
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
stay on old place... why?
how i can handle ItemIsMovable area?
Code:
{
/*
int width; html div area
int hight; html div area
moveBy(GetInt("left"),GetInt("top"));
*/
return QGraphicsTextItem::boundingRect().
adjusted(-2,
-2, width
- now.
width() , hight
- now.
height() );
}