новые иконки в OpenBoard
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
OpenBoard/src/gui/UBTGWidgetTreeDelegate.cpp

34 lines
1.1 KiB

#include <QApplication>
#include <QStyleOptionButton>
#include <QStyledItemDelegate>
#include <QStyleOptionViewItem>
#include <QPainter>
#include <QModelIndex>
#include "UBTGWidgetTreeDelegate.h"
UBTGWidgetTreeDelegate::UBTGWidgetTreeDelegate(QObject *parent) :
QStyledItemDelegate(parent)
{
//NOOP
}
void UBTGWidgetTreeDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
if(index.data(Qt::UserRole) != eUBTGAddSubItemWidgetType_None){
painter->setBackgroundMode(Qt::OpaqueMode);
painter->setBackground(QBrush(QColor(Qt::red)));
QStyleOptionButton styleButton;
styleButton.text = "pipo";
styleButton.rect = option.rect;
QApplication::style()->drawControl(QStyle::CE_PushButtonLabel,&styleButton,painter);
}
else
QStyledItemDelegate::paint(painter,option,index);
}
QSize UBTGWidgetTreeDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSize size = QStyledItemDelegate::sizeHint(option,index);
return size;
}