cool!
if you want to draw on a tree widget you must:
-- subclass QTreeWidget/QTreeView and reimplement paintEvent;
...
{
//drawing stuff
}
...
...
void MyTreeWidget::paintEvent(QPaintEvent *e)
{
QTreeWidget::paintEvent(e);
QPainter p(this);
//drawing stuff
}
...
To copy to clipboard, switch view to plain text mode
-- install event filter on a tree widget and process QPaintEvent.
...
m_treeWidget->viewport()->installEventFilter(this);
...
{
if (o
== m_treeWidget
->viewport
() && e
->type
() == QEvent::Paint) { //draw stuff
}
}
...
m_treeWidget->viewport()->installEventFilter(this);
...
bool MyWidget::eventFilter(QObject *o, QEvent *e)
{
if (o == m_treeWidget->viewport() && e->type() == QEvent::Paint) {
QPainter p(m_treeWidget->viewport());
//draw stuff
}
return QWidget::eventFilter(o, e);
}
To copy to clipboard, switch view to plain text mode
Bookmarks