mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-24 12:34:39 +03:00
Merge branch 'master' into 1.4
This commit is contained in:
commit
9243036750
@ -10,7 +10,7 @@ env:
|
|||||||
- QT_BASE=56
|
- QT_BASE=56
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt56-trusty -y; fi
|
- if [ "$QT_BASE" = "56" ]; then sudo add-apt-repository ppa:beineri/opt-qt561-trusty -y; fi
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
@ -68,6 +68,7 @@ greaterThan(QT_MAJOR_VERSION, 4) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lessThan(QT_MAJOR_VERSION, 5){
|
lessThan(QT_MAJOR_VERSION, 5){
|
||||||
|
DEFINES+=HAVE_QT4
|
||||||
CONFIG(uitools){
|
CONFIG(uitools){
|
||||||
message(uitools)
|
message(uitools)
|
||||||
DEFINES += HAVE_UI_LOADER
|
DEFINES += HAVE_UI_LOADER
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "qglobal.h"
|
#include "qglobal.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QStyleOptionViewItem>
|
||||||
|
|
||||||
#if defined(LIMEREPORT_EXPORTS)
|
#if defined(LIMEREPORT_EXPORTS)
|
||||||
# define LIMEREPORT_EXPORT Q_DECL_EXPORT
|
# define LIMEREPORT_EXPORT Q_DECL_EXPORT
|
||||||
@ -94,6 +95,13 @@ namespace Const{
|
|||||||
bool m_suppressAbsentFieldsAndVarsWarnings;
|
bool m_suppressAbsentFieldsAndVarsWarnings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_QT4
|
||||||
|
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
||||||
|
#else
|
||||||
|
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<enum>QTabWidget::South</enum>
|
<enum>QTabWidget::South</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -158,6 +158,7 @@ void QueryHolder::fillParams(QSqlQuery *query)
|
|||||||
void QueryHolder::extractParams()
|
void QueryHolder::extractParams()
|
||||||
{
|
{
|
||||||
m_preparedSQL = replaceVariables(m_queryText);
|
m_preparedSQL = replaceVariables(m_queryText);
|
||||||
|
m_prepared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QueryHolder::replaceVariables(QString query)
|
QString QueryHolder::replaceVariables(QString query)
|
||||||
@ -195,6 +196,11 @@ QString QueryHolder::queryText()
|
|||||||
void QueryHolder::setQueryText(QString queryText)
|
void QueryHolder::setQueryText(QString queryText)
|
||||||
{
|
{
|
||||||
m_queryText=queryText;
|
m_queryText=queryText;
|
||||||
|
m_prepared = false;
|
||||||
|
if (m_query) {
|
||||||
|
delete m_query;
|
||||||
|
m_query = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IDataSource* QueryHolder::dataSource(IDataSource::DatasourceMode mode)
|
IDataSource* QueryHolder::dataSource(IDataSource::DatasourceMode mode)
|
||||||
@ -364,7 +370,7 @@ void ConnectionDesc::setName(const QString &value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection)
|
QueryDesc::QueryDesc(QString queryName, QString queryText, QString connection)
|
||||||
:m_queryName(queryName), m_query(queryText), m_connectionName(connection)
|
:m_queryName(queryName), m_queryText(queryText), m_connectionName(connection)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SubQueryHolder::SubQueryHolder(QString queryText, QString connectionName, QString masterDatasource, DataSourceManager* dataManager)
|
SubQueryHolder::SubQueryHolder(QString queryText, QString connectionName, QString masterDatasource, DataSourceManager* dataManager)
|
||||||
|
@ -159,13 +159,15 @@ public:
|
|||||||
explicit QueryDesc(QObject* parent=0):QObject(parent){}
|
explicit QueryDesc(QObject* parent=0):QObject(parent){}
|
||||||
void setQueryName(QString value){m_queryName=value;}
|
void setQueryName(QString value){m_queryName=value;}
|
||||||
QString queryName(){return m_queryName;}
|
QString queryName(){return m_queryName;}
|
||||||
void setQueryText(QString value){m_query=value;}
|
void setQueryText(QString value){m_queryText=value; emit queryTextChanged(m_queryName, m_queryText);}
|
||||||
QString queryText(){return m_query;}
|
QString queryText(){return m_queryText;}
|
||||||
void setConnectionName(QString value){m_connectionName=value;}
|
void setConnectionName(QString value){m_connectionName=value;}
|
||||||
QString connectionName(){return m_connectionName;}
|
QString connectionName(){return m_connectionName;}
|
||||||
|
signals:
|
||||||
|
void queryTextChanged(const QString& queryName, const QString& queryText);
|
||||||
private:
|
private:
|
||||||
QString m_queryName;
|
QString m_queryName;
|
||||||
QString m_query;
|
QString m_queryText;
|
||||||
QString m_connectionName;
|
QString m_connectionName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -620,13 +620,7 @@ bool DataSourceManager::checkConnectionDesc(ConnectionDesc *connection)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataSourceManager::addQueryDesc(QueryDesc *query)
|
void DataSourceManager::putHolder(const QString& name, IDataSourceHolder *dataSource)
|
||||||
{
|
|
||||||
m_queries.append(query);
|
|
||||||
addQuery(query->queryName(), query->queryText(), query->connectionName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataSourceManager::putHolder(QString name, IDataSourceHolder *dataSource)
|
|
||||||
{
|
{
|
||||||
if (!m_datasources.contains(name.toLower())){
|
if (!m_datasources.contains(name.toLower())){
|
||||||
m_datasources.insert(
|
m_datasources.insert(
|
||||||
@ -640,6 +634,8 @@ void DataSourceManager::putQueryDesc(QueryDesc* queryDesc)
|
|||||||
{
|
{
|
||||||
if (!containsDatasource(queryDesc->queryName())){
|
if (!containsDatasource(queryDesc->queryName())){
|
||||||
m_queries.append(queryDesc);
|
m_queries.append(queryDesc);
|
||||||
|
connect(queryDesc, SIGNAL(queryTextChanged(QString,QString)),
|
||||||
|
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(queryDesc->queryName()));
|
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(queryDesc->queryName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,6 +643,8 @@ void DataSourceManager::putSubQueryDesc(SubQueryDesc *subQueryDesc)
|
|||||||
{
|
{
|
||||||
if (!containsDatasource(subQueryDesc->queryName())){
|
if (!containsDatasource(subQueryDesc->queryName())){
|
||||||
m_subqueries.append(subQueryDesc);
|
m_subqueries.append(subQueryDesc);
|
||||||
|
connect(subQueryDesc, SIGNAL(queryTextChanged(QString,QString)),
|
||||||
|
this, SLOT(slotQueryTextChanged(QString,QString)));
|
||||||
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(subQueryDesc->queryName()));
|
} else throw ReportError(tr("datasource with name \"%1\" already exists !").arg(subQueryDesc->queryName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,6 +1056,14 @@ void DataSourceManager::slotConnectionRenamed(const QString &oldName, const QStr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataSourceManager::slotQueryTextChanged(const QString &queryName, const QString &queryText)
|
||||||
|
{
|
||||||
|
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(queryName));
|
||||||
|
if (holder){
|
||||||
|
holder->setQueryText(queryText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DataSourceManager::clear(ClearMethod method)
|
void DataSourceManager::clear(ClearMethod method)
|
||||||
{
|
{
|
||||||
DataSourcesMap::iterator dit;
|
DataSourcesMap::iterator dit;
|
||||||
|
@ -195,8 +195,7 @@ signals:
|
|||||||
void cleared();
|
void cleared();
|
||||||
void datasourcesChanged();
|
void datasourcesChanged();
|
||||||
protected:
|
protected:
|
||||||
void addQueryDesc(QueryDesc *);
|
void putHolder(const QString& name, LimeReport::IDataSourceHolder* dataSource);
|
||||||
void putHolder(QString name, LimeReport::IDataSourceHolder* dataSource);
|
|
||||||
void putQueryDesc(QueryDesc *queryDesc);
|
void putQueryDesc(QueryDesc *queryDesc);
|
||||||
void putSubQueryDesc(SubQueryDesc *subQueryDesc);
|
void putSubQueryDesc(SubQueryDesc *subQueryDesc);
|
||||||
void putProxyDesc(ProxyDesc *proxyDesc);
|
void putProxyDesc(ProxyDesc *proxyDesc);
|
||||||
@ -217,6 +216,7 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotConnectionRenamed(const QString& oldName,const QString& newName);
|
void slotConnectionRenamed(const QString& oldName,const QString& newName);
|
||||||
|
void slotQueryTextChanged(const QString& queryName, const QString& queryText);
|
||||||
private:
|
private:
|
||||||
explicit DataSourceManager(QObject *parent = 0);
|
explicit DataSourceManager(QObject *parent = 0);
|
||||||
Q_DISABLE_COPY(DataSourceManager)
|
Q_DISABLE_COPY(DataSourceManager)
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "qglobal.h"
|
#include "qglobal.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QStyleOptionViewItem>
|
||||||
|
|
||||||
#if defined(LIMEREPORT_EXPORTS)
|
#if defined(LIMEREPORT_EXPORTS)
|
||||||
# define LIMEREPORT_EXPORT Q_DECL_EXPORT
|
# define LIMEREPORT_EXPORT Q_DECL_EXPORT
|
||||||
@ -94,6 +95,13 @@ namespace Const{
|
|||||||
bool m_suppressAbsentFieldsAndVarsWarnings;
|
bool m_suppressAbsentFieldsAndVarsWarnings;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_QT4
|
||||||
|
typedef QStyleOptionViewItemV4 StyleOptionViewItem;
|
||||||
|
#else
|
||||||
|
typedef QStyleOptionViewItem StyleOptionViewItem;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ ObjectInspectorWidget::~ObjectInspectorWidget(){}
|
|||||||
void ObjectInspectorWidget::drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const
|
void ObjectInspectorWidget::drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
ObjectPropItem *node = nodeFromIndex(index);
|
ObjectPropItem *node = nodeFromIndex(index);
|
||||||
QStyleOptionViewItemV4 so = options;
|
StyleOptionViewItem so = options;
|
||||||
bool alternate = so.features & QStyleOptionViewItemV4::Alternate;
|
bool alternate = so.features & StyleOptionViewItem::Alternate;
|
||||||
if (node){
|
if (node){
|
||||||
if ((!node->isHaveValue())){
|
if ((!node->isHaveValue())){
|
||||||
const QColor c = options.palette.color(QPalette::Dark);
|
const QColor c = options.palette.color(QPalette::Dark);
|
||||||
|
@ -177,7 +177,7 @@ void ObjectPropItem::updatePropertyValue()
|
|||||||
m_model->setData(m_index,m_object->property(m_name.toLatin1()));
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include <QMetaProperty>
|
#include <QMetaProperty>
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QStyleOptionViewItemV4>
|
|
||||||
|
|
||||||
#include "lrattribsabstractfactory.h"
|
#include "lrattribsabstractfactory.h"
|
||||||
#include "lrsingleton.h"
|
#include "lrsingleton.h"
|
||||||
@ -70,7 +69,7 @@ namespace LimeReport{
|
|||||||
virtual void setModelData(QWidget * /*editor*/, QAbstractItemModel * /*model*/, const QModelIndex &/*index*/){}
|
virtual void setModelData(QWidget * /*editor*/, QAbstractItemModel * /*model*/, const QModelIndex &/*index*/){}
|
||||||
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const;
|
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &/*index*/) const;
|
||||||
virtual void updatePropertyValue();
|
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;}
|
ObjectPropItem* parent() const{ return m_parent;}
|
||||||
QObject* object() const{return m_object;}
|
QObject* object() const{return m_object;}
|
||||||
|
@ -50,7 +50,7 @@ void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionVi
|
|||||||
if (node){
|
if (node){
|
||||||
if (!node->isHaveValue()){
|
if (!node->isHaveValue()){
|
||||||
if (index.column()==0) {
|
if (index.column()==0) {
|
||||||
QStyleOptionViewItemV4 cellOpt = option;
|
StyleOptionViewItem cellOpt = option;
|
||||||
QTreeView const *tree = dynamic_cast<const QTreeView*>(cellOpt.widget);
|
QTreeView const *tree = dynamic_cast<const QTreeView*>(cellOpt.widget);
|
||||||
QStyleOptionViewItem primitiveOpt = cellOpt;
|
QStyleOptionViewItem primitiveOpt = cellOpt;
|
||||||
primitiveOpt.rect.setWidth(tree->indentation());
|
primitiveOpt.rect.setWidth(tree->indentation());
|
||||||
@ -82,7 +82,7 @@ void LimeReport::PropertyDelegate::paint(QPainter *painter, const QStyleOptionVi
|
|||||||
painter->restore();
|
painter->restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStyleOptionViewItemV4 so = option;
|
StyleOptionViewItem so = option;
|
||||||
if ((node->isValueReadonly())&&(!node->isHaveChildren())) {
|
if ((node->isValueReadonly())&&(!node->isHaveChildren())) {
|
||||||
so.palette.setColor(QPalette::Text,so.palette.color(QPalette::Dark));
|
so.palette.setColor(QPalette::Text,so.palette.color(QPalette::Dark));
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ void BoolPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mod
|
|||||||
setValueToObject(propertyName(),propertyValue());
|
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){
|
if (index.column()==1){
|
||||||
QStyleOptionButton so;
|
QStyleOptionButton so;
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
virtual QWidget* createProperyEditor(QWidget *parent) const;
|
virtual QWidget* createProperyEditor(QWidget *parent) const;
|
||||||
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 QStyleOptionViewItemV4 &option, const QModelIndex &index);
|
bool paint(QPainter *painter, const StyleOptionViewItem &option, const QModelIndex &index);
|
||||||
};
|
};
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ void ColorPropItem::setModelData(QWidget *propertyEditor, QAbstractItemModel *mo
|
|||||||
setValueToObject(propertyName(),propertyValue());
|
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){
|
if (index.column()==1){
|
||||||
painter->save();
|
painter->save();
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
QWidget* createProperyEditor(QWidget *parent) const;
|
QWidget* createProperyEditor(QWidget *parent) const;
|
||||||
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
void setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const;
|
||||||
void setModelData(QWidget *propertyEditor, QAbstractItemModel *model, const QModelIndex &index);
|
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);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user