diff --git a/common.pri b/common.pri index 2534473..c15fe14 100644 --- a/common.pri +++ b/common.pri @@ -68,6 +68,7 @@ greaterThan(QT_MAJOR_VERSION, 4) { } lessThan(QT_MAJOR_VERSION, 5){ + DEFINES+=HAVE_QT4 CONFIG(uitools){ message(uitools) DEFINES += HAVE_UI_LOADER diff --git a/include/lrglobal.h b/include/lrglobal.h index 4d1a456..b131207 100644 --- a/include/lrglobal.h +++ b/include/lrglobal.h @@ -32,6 +32,7 @@ #include "qglobal.h" #include #include +#include #if defined(LIMEREPORT_EXPORTS) # define LIMEREPORT_EXPORT Q_DECL_EXPORT @@ -94,6 +95,13 @@ namespace Const{ bool m_suppressAbsentFieldsAndVarsWarnings; }; +#ifdef HAVE_QT4 + typedef QStyleOptionViewItemV4 StyleOptionViewItem; +#else + typedef QStyleOptionViewItem StyleOptionViewItem; +#endif + + } // namespace LimeReport diff --git a/limereport/databrowser/lrdatabrowser.ui b/limereport/databrowser/lrdatabrowser.ui index 2bfc7a6..2b60383 100644 --- a/limereport/databrowser/lrdatabrowser.ui +++ b/limereport/databrowser/lrdatabrowser.ui @@ -35,7 +35,7 @@ QTabWidget::South - 1 + 0 diff --git a/limereport/lrglobal.h b/limereport/lrglobal.h index 4d1a456..b131207 100644 --- a/limereport/lrglobal.h +++ b/limereport/lrglobal.h @@ -32,6 +32,7 @@ #include "qglobal.h" #include #include +#include #if defined(LIMEREPORT_EXPORTS) # define LIMEREPORT_EXPORT Q_DECL_EXPORT @@ -94,6 +95,13 @@ namespace Const{ bool m_suppressAbsentFieldsAndVarsWarnings; }; +#ifdef HAVE_QT4 + typedef QStyleOptionViewItemV4 StyleOptionViewItem; +#else + typedef QStyleOptionViewItem StyleOptionViewItem; +#endif + + } // namespace LimeReport diff --git a/limereport/objectinspector/lrobjectinspectorwidget.cpp b/limereport/objectinspector/lrobjectinspectorwidget.cpp index 4405f7d..325ec1e 100644 --- a/limereport/objectinspector/lrobjectinspectorwidget.cpp +++ b/limereport/objectinspector/lrobjectinspectorwidget.cpp @@ -59,8 +59,8 @@ ObjectInspectorWidget::~ObjectInspectorWidget(){} void ObjectInspectorWidget::drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const { ObjectPropItem *node = nodeFromIndex(index); - QStyleOptionViewItemV4 so = options; - bool alternate = so.features & QStyleOptionViewItemV4::Alternate; + StyleOptionViewItem so = options; + bool alternate = so.features & StyleOptionViewItem::Alternate; if (node){ if ((!node->isHaveValue())){ const QColor c = options.palette.color(QPalette::Dark); diff --git a/limereport/objectinspector/lrobjectpropitem.cpp b/limereport/objectinspector/lrobjectpropitem.cpp index 908237c..fa516ff 100644 --- a/limereport/objectinspector/lrobjectpropitem.cpp +++ b/limereport/objectinspector/lrobjectpropitem.cpp @@ -177,7 +177,7 @@ void ObjectPropItem::updatePropertyValue() m_model->setData(m_index,m_object->property(m_name.toLatin1())); } -bool ObjectPropItem::paint(QPainter *, const QStyleOptionViewItemV4 &, const QModelIndex &) +bool ObjectPropItem::paint(QPainter *, const StyleOptionViewItem &, const QModelIndex &) { return false; } diff --git a/limereport/objectinspector/lrobjectpropitem.h b/limereport/objectinspector/lrobjectpropitem.h index 6e2d796..c78cf69 100644 --- a/limereport/objectinspector/lrobjectpropitem.h +++ b/limereport/objectinspector/lrobjectpropitem.h @@ -36,7 +36,6 @@ #include #include #include -#include #include "lrattribsabstractfactory.h" #include "lrsingleton.h" @@ -70,7 +69,7 @@ namespace LimeReport{ virtual void setModelData(QWidget * /*editor*/, QAbstractItemModel * /*model*/, const QModelIndex &/*index*/){} virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const; virtual void updatePropertyValue(); - virtual bool paint(QPainter *, const QStyleOptionViewItemV4 &, const QModelIndex &); + virtual bool paint(QPainter *, const StyleOptionViewItem &, const QModelIndex &); ObjectPropItem* parent() const{ return m_parent;} QObject* object() const{return m_object;} diff --git a/limereport/objectinspector/lrpropertydelegate.cpp b/limereport/objectinspector/lrpropertydelegate.cpp index 4796c23..db44400 100644 --- a/limereport/objectinspector/lrpropertydelegate.cpp +++ b/limereport/objectinspector/lrpropertydelegate.cpp @@ -50,7 +50,7 @@ void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionVi if (node){ if (!node->isHaveValue()){ if (index.column()==0) { - QStyleOptionViewItemV4 cellOpt = option; + StyleOptionViewItem cellOpt = option; QTreeView const *tree = dynamic_cast(cellOpt.widget); QStyleOptionViewItem primitiveOpt = cellOpt; primitiveOpt.rect.setWidth(tree->indentation()); @@ -82,7 +82,7 @@ void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionVi painter->restore(); } - QStyleOptionViewItemV4 so = option; + StyleOptionViewItem so = option; if ((node->isValueReadonly())&&(!node->isHaveChildren())) { so.palette.setColor(QPalette::Text,so.palette.color(QPalette::Dark)); } diff --git a/limereport/objectinspector/propertyItems/lrboolpropitem.cpp b/limereport/objectinspector/propertyItems/lrboolpropitem.cpp index 9989af5..950c531 100644 --- a/limereport/objectinspector/propertyItems/lrboolpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrboolpropitem.cpp @@ -67,7 +67,7 @@ void BoolPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mod setValueToObject(propertyName(),propertyValue()); } -bool BoolPropItem::paint(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index) +bool BoolPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index) { if (index.column()==1){ QStyleOptionButton so; diff --git a/limereport/objectinspector/propertyItems/lrboolpropitem.h b/limereport/objectinspector/propertyItems/lrboolpropitem.h index 0e7dc99..3407925 100644 --- a/limereport/objectinspector/propertyItems/lrboolpropitem.h +++ b/limereport/objectinspector/propertyItems/lrboolpropitem.h @@ -44,7 +44,7 @@ public: virtual QWidget* createProperyEditor(QWidget *parent) const; virtual void setPropertyEditorData(QWidget * propertyEditor, const QModelIndex &) const; virtual void setModelData(QWidget * propertyEditor, QAbstractItemModel * model, const QModelIndex & index); - bool paint(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index); + bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index); }; } // namespace LimeReport diff --git a/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp b/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp index 7880442..4443cb9 100644 --- a/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrcolorpropitem.cpp @@ -54,7 +54,7 @@ void ColorPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mo setValueToObject(propertyName(),propertyValue()); } -bool ColorPropItem::paint(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index) +bool ColorPropItem::paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index) { if (index.column()==1){ painter->save(); diff --git a/limereport/objectinspector/propertyItems/lrcolorpropitem.h b/limereport/objectinspector/propertyItems/lrcolorpropitem.h index f4940b5..6d0b8de 100644 --- a/limereport/objectinspector/propertyItems/lrcolorpropitem.h +++ b/limereport/objectinspector/propertyItems/lrcolorpropitem.h @@ -44,7 +44,7 @@ public: QWidget* createProperyEditor(QWidget *parent) const; void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const; void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index); - bool paint(QPainter *painter, const QStyleOptionViewItemV4 &option, const QModelIndex &index); + bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index); }; }