mirror of
				https://github.com/python-LimeReport/LimeReport.git
				synced 2025-10-31 22:01:22 +03:00 
			
		
		
		
	Finish 1.4.74
This commit is contained in:
		| @@ -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 = 73 | LIMEREPORT_VERSION_RELEASE = 74 | ||||||
|  |  | ||||||
| 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}\" | ||||||
|   | |||||||
| @@ -67,19 +67,39 @@ void BoolPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mod | |||||||
|     setValueToObject(propertyName(),propertyValue()); |     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) | bool BoolPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index) | ||||||
| { | { | ||||||
|  |  | ||||||
|     QStyle* style = option.widget ? option.widget->style() : QApplication::style(); |     QStyle* style = option.widget ? option.widget->style() : QApplication::style(); | ||||||
|  |  | ||||||
|     if (index.column()==1){ |     if (index.column()==1){ | ||||||
|         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); | //        QStyleOptionButton so; | ||||||
|         so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth)); | //        so.rect = option.rect.adjusted(border,border,0,-border); | ||||||
|         so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight)); | //        so.rect.setWidth(style->pixelMetric(QStyle::PM_IndicatorWidth)); | ||||||
|         so.state |= propertyValue().toBool() ? QStyle::State_On : QStyle::State_Off; | //        so.rect.setHeight(style->pixelMetric(QStyle::PM_IndicatorHeight)); | ||||||
|         style->drawPrimitive(QStyle::PE_IndicatorItemViewItemCheck,&so,painter); | //        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; |         return true; | ||||||
|     } else return false; |     } else return false; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -45,6 +45,8 @@ public: | |||||||
|     virtual void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const; |     virtual void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const; | ||||||
|     virtual void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index); |     virtual void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index); | ||||||
|     bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index); |     bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index); | ||||||
|  | protected: | ||||||
|  |     QPixmap getIndicatorImage(const StyleOptionViewItem &option); | ||||||
| }; | }; | ||||||
| } // namespace LimeReport | } // namespace LimeReport | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user