QGraphicsTextItem Linkactivated not responding
I am not able to get the linkactivated signal of QGraphicsTextItem with the below code.When ever I click on the text only a dashed outline box comes around the text.
Code:
{
Q_OBJECT
public:
MenuPage();
~MenuPage()
public slots:
slot_linkactivated(const QString&);
};
MenuPage::
MenuPage()
{
setHandlesChildEvents ( false);
}
MenuPage::
~MenuPage()
{
}
MenuPage::
{
addToGroup(clicktext);
clicktext->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::LinksAccessibleByKeyboard);
clicktext->setPlainText(s);
QObject::connect((QObject*)clicktext ,
SIGNAL(linkActivated
(const QString
&)),
this,
SLOT(slot_linkactivated
(const QString
&)) );
clicktext->setFont(dfont);
clicktext->setDefaultTextColor(Qt::blue);
clicktext->setPos(20,wheight+5);
wheight += clicktext->boundingRect().height() -5 ;
clicktext = NULL;
}
void MenuPage::
slot_linkactivated(const QString&)
{
.....
}
Re: QGraphicsTextItem Linkactivated not responding
Quote:
Originally Posted by
Pancho
I am not able to get the linkactivated signal of QGraphicsTextItem with the below code.When ever I click on the text only a dashed outline box comes around the text.
Code:
{
Q_OBJECT
public:
MenuPage();
~MenuPage()
public slots:
slot_linkactivated(const QString&);
};
MenuPage::
MenuPage()
{
setHandlesChildEvents ( false);
}
MenuPage::
~MenuPage()
{
}
MenuPage::
{
addToGroup(clicktext);
clicktext->setTextInteractionFlags(Qt::LinksAccessibleByMouse|Qt::LinksAccessibleByKeyboard);
clicktext->setPlainText(s);
QObject::connect((QObject*)clicktext ,
SIGNAL(linkActivated
(const QString
&)),
this,
SLOT(slot_linkactivated
(const QString
&)) );
clicktext->setFont(dfont);
clicktext->setDefaultTextColor(Qt::blue);
clicktext->setPos(20,wheight+5);
wheight += clicktext->boundingRect().height() -5 ;
clicktext = NULL;
}
void MenuPage::
slot_linkactivated(const QString&)
{
.....
}
The problem was at setting the text.I am using setPlainText() instead of setHtml() and also see that the text is in <a href="<link>">text</a> format