Draw 10% opacity icon behind view, so as to give a better hint as to which list is which.

This commit is contained in:
craig.p.drummond@gmail.com
2012-04-26 16:11:11 +00:00
parent 42205ea150
commit 99f52848f6
5 changed files with 32 additions and 0 deletions

View File

@@ -23,6 +23,8 @@
#include "treeview.h"
#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtGui/QPainter>
#include <QtCore/QMap>
TreeView::TreeView(QWidget *parent)
@@ -126,3 +128,14 @@ void TreeView::correctSelection()
setCurrentIndex(currentIndex());
selectionModel()->select(s, QItemSelectionModel::SelectCurrent);
}
void TreeView::paintEvent(QPaintEvent *e)
{
QTreeView::paintEvent(e);
if (!pixmap.isNull()) {
QPainter p(viewport());
p.setOpacity(0.1);
p.drawPixmap((width() - pixmap.width())/2, (height() - pixmap.height())/2, pixmap);
}
}