mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'tomaz-css' into Qt
Tomaz' code does a much better job of shading the dive list! Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
commit
ff2ce39970
10 changed files with 106 additions and 16 deletions
|
@ -7,18 +7,24 @@
|
|||
#include <QtDebug>
|
||||
#include <QPainter>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QStyle>
|
||||
#include <QStyleOption>
|
||||
|
||||
StarWidgetsDelegate::StarWidgetsDelegate(QWidget* parent):
|
||||
QStyledItemDelegate(parent),
|
||||
parentWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void StarWidgetsDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
QStyledItemDelegate::paint(painter, option, index);
|
||||
|
||||
if (!index.isValid())
|
||||
return;
|
||||
|
||||
QVariant value = index.model()->data(index, Qt::DisplayRole);
|
||||
|
||||
if(option.state & QStyle::State_Selected)
|
||||
painter->fillRect(option.rect, option.palette.highlight());
|
||||
else
|
||||
painter->fillRect(option.rect, index.model()->data(index, Qt::BackgroundRole).value<QBrush>());
|
||||
QVariant value = index.model()->data(index, TreeItemDT::STAR_ROLE);
|
||||
|
||||
if (!value.isValid())
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue