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

Bool property item fixed

This commit is contained in:
Arin Alex 2018-03-27 00:39:59 +03:00
parent 285f3a467b
commit fdab56b1d8
2 changed files with 4 additions and 17 deletions

View File

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

View File

@ -71,28 +71,15 @@ bool BoolPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, c
{ {
QStyle* style = option.widget ? option.widget->style() : QApplication::style(); QStyle* style = option.widget ? option.widget->style() : QApplication::style();
int offset = 0;
#ifdef Q_OS_MAC
offset = 2;
#endif
if (index.column()==1){ if (index.column()==1){
StyleOptionViewItem so(option); QStyleOptionButton so;
int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth))/2; int border = (option.rect.height() - style->pixelMetric(QStyle::PM_IndicatorWidth))/2;
so.rect = option.rect.adjusted(border,border,0,-border); so.rect = option.rect.adjusted(border,border,0,-border);
so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth)+offset); so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth));
so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight)+offset); so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight));
// if (!isValueReadonly())
// so.state = QStyle::State_Enabled;
// else
// so.state &= ~QStyle::State_Enabled;
so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off; so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off;
style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter); style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter);
return true; return true;
} else return false; } else return false;
} }