//=============================================================================
//=============================================================================
/* virtual */ void ZeParagraphWidget
::enterEvent(QEvent * event
) {
if (mTextBrowser)
{
mTextBrowser->document()->deleteLater();
mTextBrowser->deleteLater();
mTextBrowser = NULL;
}
mTextBrowser->setDocument(mTextDocument->clone());
mTextBrowser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mTextBrowser->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mTextBrowser->setStyle(ZeStyle::get());
mTextBrowser->setOpenExternalLinks(true);
mTextBrowser->setContextMenuPolicy(Qt::NoContextMenu);
mTextBrowser->move(-1, -1);
mTextBrowser->resize(mTextDocument->idealWidth() + 2, height() + 2);
mTextBrowser->show();
update();
}
//=============================================================================
//=============================================================================
/* virtual */ void ZeParagraphWidget::enterEvent(QEvent * event)
{
if (mTextBrowser)
{
mTextBrowser->document()->deleteLater();
mTextBrowser->deleteLater();
mTextBrowser = NULL;
}
mTextBrowser = new QTextBrowser(this);
mTextBrowser->setDocument(mTextDocument->clone());
mTextBrowser->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mTextBrowser->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
mTextBrowser->setStyle(ZeStyle::get());
mTextBrowser->setOpenExternalLinks(true);
mTextBrowser->setContextMenuPolicy(Qt::NoContextMenu);
mTextBrowser->move(-1, -1);
mTextBrowser->resize(mTextDocument->idealWidth() + 2, height() + 2);
mTextBrowser->show();
update();
}
To copy to clipboard, switch view to plain text mode
That stuff is working. Instead of tweaking the QFrame I set my own style.
Only problem is : when entered the newly created TextBrowser never gets deleted.
I guess would need some kind of isActive() flag for the QTextBrowser in order to choose wether I can delete it or not in the leaveEvent.
Thanks man.
Bookmarks