0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 00:33:02 +03:00

Finish 1.4.74

This commit is contained in:
Arin Alexander 2018-03-27 01:10:34 +03:00
commit 7c92ecfc5f
3 changed files with 29 additions and 7 deletions

View File

@ -97,7 +97,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 73
LIMEREPORT_VERSION_RELEASE = 74
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -67,19 +67,39 @@ void BoolPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mod
setValueToObject(propertyName(),propertyValue());
}
QPixmap BoolPropItem::getIndicatorImage(const StyleOptionViewItem &option){
QStyleOptionButton so;
so.state = option.state;
if (!isValueReadonly())
so.state = QStyle::State_Enabled;
else
so.state &= ~QStyle::State_Enabled;
so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
so.rect = QRect(0,0,
QApplication::style()->pixelMetric(QStyle::PM_IndicatorWidth),
QApplication::style()->pixelMetric(QStyle::PM_IndicatorHeight));
QPixmap pixmap(so.rect.width(),so.rect.height());
pixmap.fill(Qt::transparent);
QPainter p(&pixmap);
option.widget->style()->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so, &p);
return pixmap;
}
bool BoolPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index)
{
QStyle* style = option.widget ? option.widget->style() : QApplication::style();
if (index.column()==1){
QStyleOptionButton so;
int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth))/2;
so.rect = option.rect.adjusted(border,border,0,-border);
so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth));
so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight));
so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter);
// QStyleOptionButton so;
// so.rect = option.rect.adjusted(border,border,0,-border);
// so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth));
// so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight));
// so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
// style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter);
painter->drawPixmap(option.rect.x()+border,option.rect.y()+border, getIndicatorImage(option));
return true;
} else return false;
}

View File

@ -45,6 +45,8 @@ public:
virtual void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const;
virtual void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index);
bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index);
protected:
QPixmap getIndicatorImage(const StyleOptionViewItem &option);
};
} // namespace LimeReport