mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
Qt4 build fixed
This commit is contained in:
parent
7ba2b1d5b3
commit
40bafebbbd
@ -59,7 +59,12 @@ win32 {
|
||||
DESTDIR = $$DEST_DIR
|
||||
RC_FILE += mainicon.rc
|
||||
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
}
|
||||
lessThan(QT_MAJOR_VERSION, 5){
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
}
|
||||
!contains(CONFIG, static_build){
|
||||
contains(CONFIG,zint){
|
||||
LIBS += -L$${DEST_LIBS} -lQtZint
|
||||
|
@ -70,6 +70,11 @@ win32 {
|
||||
LIBS += -llimereportd
|
||||
}
|
||||
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$EXTRA_DIR\\*) $$shell_quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
}
|
||||
lessThan(QT_MAJOR_VERSION, 5){
|
||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$quote($$EXTRA_DIR\\*) $$quote($$REPORTS_DIR\\demo_reports) $$escape_expand(\\n\\t)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace Const{
|
||||
{
|
||||
public:
|
||||
enum VariableDataType {Undefined, String, Bool, Int, Real, Date, Time, DateTime};
|
||||
Q_ENUM(VariableDataType)
|
||||
Q_ENUMS(VariableDataType)
|
||||
private:
|
||||
Enums(){}
|
||||
Q_GADGET
|
||||
|
@ -78,7 +78,12 @@ void LRVariableDialog::showEvent(QShowEvent *)
|
||||
QMetaEnum enumerator = LimeReport::Enums::staticMetaObject.enumerator(enumIndex);
|
||||
if (!m_variableName.isEmpty()&&m_variablesContainer&&m_variablesContainer->containsVariable(m_variableName)){
|
||||
ui->leValue->setText(m_variablesContainer->variable(m_variableName).toString());
|
||||
#ifdef HAVE_QT5
|
||||
ui->cbbType->setCurrentText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName)));
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->cbbType->setCurrentIndex(ui->cbbType->findText(enumerator.valueToKey(m_variablesContainer->variableDataType(m_variableName))));
|
||||
#endif
|
||||
ui->cbbMandatory->setChecked(m_variablesContainer->variableIsMandatory(m_variableName));
|
||||
}
|
||||
}
|
||||
|
@ -461,7 +461,12 @@ void PieChart::drawPercent(QPainter *painter, QRectF chartRect, qreal startAngle
|
||||
|
||||
QPointF center(chartRect.left()+chartRect.width()/2,chartRect.top()+chartRect.height()/2);
|
||||
qreal percent = angle/3.6;
|
||||
#ifdef HAVE_QT4
|
||||
qreal radAngle = (angle/2+startAngle)*(M_PI/180);
|
||||
#endif
|
||||
#ifdef HAVE_QT5
|
||||
qreal radAngle = qDegreesToRadians(angle/2+startAngle);
|
||||
#endif
|
||||
qreal radius = painter->fontMetrics().width("99,9%");
|
||||
qreal border = chartRect.height()*0.02;
|
||||
qreal length = (chartRect.height())/2-(radius/2+border);
|
||||
|
@ -118,7 +118,12 @@ void ChartItemEditor::init()
|
||||
ui->seriesTypeComboBox->addItem(enumerator.key(i));
|
||||
}
|
||||
|
||||
#ifdef HAVE_QT5
|
||||
ui->labelsFieldComboBox->setCurrentText(m_charItem->labelsField());
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->labelsFieldComboBox->setCurrentIndex(ui->labelsFieldComboBox->findText( m_charItem->labelsField()));
|
||||
#endif
|
||||
if (!m_charItem->series().isEmpty()){
|
||||
enableSeriesEditor();
|
||||
ui->tableWidget->selectRow(0);
|
||||
@ -145,7 +150,12 @@ void ChartItemEditor::disableSeriesEditor()
|
||||
ui->valuesFieldComboBox->setDisabled(true);
|
||||
m_colorButton->setDisabled(true);
|
||||
m_colorIndicator->setDisabled(true);
|
||||
#ifdef HAVE_QT5
|
||||
ui->valuesFieldComboBox->setCurrentText("");
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->valuesFieldComboBox->setEditText("");
|
||||
#endif
|
||||
ui->seriesTypeComboBox->setDisabled(true);
|
||||
}
|
||||
|
||||
@ -198,7 +208,12 @@ void ChartItemEditor::slotAddSeries()
|
||||
ui->tableWidget->setRowCount(m_charItem->series().count());
|
||||
ui->tableWidget->setItem(m_charItem->series().count()-1, 0, new QTableWidgetItem(series->name()));
|
||||
ui->tableWidget->selectRow(m_charItem->series().count()-1);
|
||||
#ifdef HAVE_QT5
|
||||
ui->valuesFieldComboBox->setCurrentText("");
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->valuesFieldComboBox->setEditText("");
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChartItemEditor::slotDeleteSeries()
|
||||
@ -220,11 +235,21 @@ void ChartItemEditor::on_tableWidget_itemSelectionChanged()
|
||||
if (ui->tableWidget->selectionModel()->hasSelection()){
|
||||
LimeReport::SeriesItem* series = m_charItem->series().at(ui->tableWidget->selectionModel()->currentIndex().row());
|
||||
ui->seriesNameLineEdit->setText(series->name());
|
||||
#ifdef HAVE_QT5
|
||||
ui->valuesFieldComboBox->setCurrentText(series->valuesColumn());
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->valuesFieldComboBox->setCurrentIndex(ui->valuesFieldComboBox->findText(series->valuesColumn()));
|
||||
#endif
|
||||
m_colorIndicator->setColor(series->color());
|
||||
static int enumIndex = LimeReport::SeriesItem::staticMetaObject.indexOfEnumerator("SeriesItemPreferredType");
|
||||
QMetaEnum enumerator = LimeReport::SeriesItem::staticMetaObject.enumerator(enumIndex);
|
||||
#ifdef HAVE_QT5
|
||||
ui->seriesTypeComboBox->setCurrentText(enumerator.valueToKey(series->preferredType()));
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->seriesTypeComboBox->setCurrentIndex(ui->seriesTypeComboBox->findText(enumerator.valueToKey(series->preferredType())));
|
||||
#endif
|
||||
enableSeriesEditor();
|
||||
}
|
||||
}
|
||||
|
@ -99,8 +99,13 @@ contains(CONFIG,build_translations){
|
||||
TRANSLATIONS = $$prependAll(LANGUAGES, \"$$TRANSLATIONS_PATH/limereport_,.ts\")
|
||||
|
||||
qtPrepareTool(LUPDATE, lupdate)
|
||||
ts.commands = $$LUPDATE $$shell_quote($$PWD) -ts $$TRANSLATIONS
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
ts.commands = $$LUPDATE $$shell_quote($$PWD) -ts $$TRANSLATIONS
|
||||
}
|
||||
lessThan(QT_MAJOR_VERSION, 5){
|
||||
ts.commands = $$LUPDATE $$quote($$PWD) -ts $$TRANSLATIONS
|
||||
}
|
||||
TRANSLATIONS_FILES =
|
||||
qtPrepareTool(LRELEASE, lrelease)
|
||||
for(tsfile, TRANSLATIONS) {
|
||||
|
@ -156,7 +156,7 @@ namespace Const{
|
||||
{
|
||||
public:
|
||||
enum VariableDataType {Undefined, String, Bool, Int, Real, Date, Time, DateTime};
|
||||
Q_ENUM(VariableDataType)
|
||||
Q_ENUMS(VariableDataType)
|
||||
private:
|
||||
Enums(){}
|
||||
Q_GADGET
|
||||
|
@ -58,11 +58,11 @@ ReportDesignWidget::ReportDesignWidget(ReportEngine *report, QMainWindow *mainWi
|
||||
#endif
|
||||
m_mainWindow(mainWindow), m_verticalGridStep(10), m_horizontalGridStep(10), m_useGrid(false), m_dialogChanged(false)
|
||||
{
|
||||
#ifdef HAVE_QT5
|
||||
m_tabWidget = new QTabWidget(this);
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
m_tabWidget = new LimeReportTabWidget(this);
|
||||
#endif
|
||||
#ifdef HAVE_QT5
|
||||
m_tabWidget = new QTabWidget(this);
|
||||
#endif
|
||||
m_tabWidget->setTabPosition(QTabWidget::South);
|
||||
m_tabWidget->setMovable(true);
|
||||
|
@ -45,6 +45,7 @@
|
||||
#ifdef HAVE_QT4
|
||||
QT_BEGIN_NAMESPACE
|
||||
class LimeReportTabWidget: public QTabWidget{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit LimeReportTabWidget(QWidget *parent = 0):QTabWidget(parent){}
|
||||
QTabBar* tabBar() const{ return QTabWidget::tabBar();}
|
||||
@ -207,11 +208,11 @@ private:
|
||||
DialogDesignerManager* m_dialogDesignerManager;
|
||||
#endif
|
||||
QMainWindow *m_mainWindow;
|
||||
#ifdef HAVE_QT5
|
||||
QTabWidget* m_tabWidget;
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
LimeReportTabWidget* m_tabWidget;
|
||||
#endif
|
||||
#ifdef HAVE_QT5
|
||||
QTabWidget* m_tabWidget;
|
||||
#endif
|
||||
GraphicsViewZoomer* m_zoomer;
|
||||
QFont m_defaultFont;
|
||||
|
@ -1003,8 +1003,14 @@ bool ReportRender::registerBand(BandDesignIntf *band, bool registerInChildren)
|
||||
if (band->isData()) m_renderedDataBandCount++;
|
||||
band->setObjectName(band->objectName()+QString::number(++m_curentNameIndex));
|
||||
renameChildItems(band);
|
||||
if (m_lastDataBand)
|
||||
if (m_lastDataBand){
|
||||
#ifdef HAVE_QT4
|
||||
m_lastDataBand->metaObject()->invokeMethod(m_lastDataBand,"bandRegistred");
|
||||
#endif
|
||||
#ifdef HAVE_QT5
|
||||
emit m_lastDataBand->bandRegistred();
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
} else return false;
|
||||
}
|
||||
|
@ -303,8 +303,16 @@ private:
|
||||
class ScriptFunctionsManager : public QObject{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ScriptFunctionsManager(QObject* parent = 0):QObject(parent){ m_wrappersFactory.insert("QComboBox",new ComboBoxWrapperCreator());}
|
||||
~ScriptFunctionsManager(){ foreach(IWrapperCreator* wrapper, m_wrappersFactory.values()){ delete wrapper;} m_wrappersFactory.clear();}
|
||||
explicit ScriptFunctionsManager(QObject* parent = 0):QObject(parent){
|
||||
#ifdef USE_QJSENGINE
|
||||
m_wrappersFactory.insert("QComboBox",new ComboBoxWrapperCreator());
|
||||
#endif
|
||||
}
|
||||
~ScriptFunctionsManager(){
|
||||
#ifdef USE_QJSENGINE
|
||||
foreach(IWrapperCreator* wrapper, m_wrappersFactory.values()){ delete wrapper;} m_wrappersFactory.clear();
|
||||
#endif
|
||||
}
|
||||
Q_INVOKABLE QVariant calcGroupFunction(const QString& name, const QString& expressionID, const QString& bandName);
|
||||
Q_INVOKABLE QVariant line(const QString& bandName);
|
||||
Q_INVOKABLE QVariant numberFormat(QVariant value, const char &format, int precision, const QString &locale);
|
||||
@ -337,7 +345,9 @@ public:
|
||||
static QColor createQColor(const QString& color){ return QColor(color);}
|
||||
private:
|
||||
ScriptEngineManager* m_scriptEngineManager;
|
||||
#ifdef USE_QJSENGINE
|
||||
QMap<QString, IWrapperCreator*> m_wrappersFactory;
|
||||
#endif
|
||||
};
|
||||
|
||||
class ScriptEngineManager : public QObject, public Singleton<ScriptEngineManager>, public IScriptEngineManager
|
||||
@ -484,7 +494,8 @@ public:
|
||||
}
|
||||
|
||||
#ifndef USE_QJSENGINE
|
||||
Q_DECLARE_METATYPE(LimeReport::ComboBoxPrototype*);
|
||||
Q_DECLARE_METATYPE(LimeReport::ComboBoxPrototype*)
|
||||
Q_DECLARE_METATYPE(QComboBox*)
|
||||
#endif
|
||||
|
||||
#endif // LRSCRIPTENGINEMANAGER_H
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "lrscripteditor.h"
|
||||
#include "ui_lrscripteditor.h"
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
#include <QJSValueIterator>
|
||||
#endif
|
||||
|
||||
#include "lrdatasourcemanager.h"
|
||||
#include "lrscriptenginemanager.h"
|
||||
@ -88,6 +91,7 @@ void ScriptEditor::initCompleter()
|
||||
|
||||
ScriptEngineManager& se = LimeReport::ScriptEngineManager::instance();
|
||||
|
||||
#ifdef USE_QJSENGINE
|
||||
QJSValue globalObject = se.scriptEngine()->globalObject();
|
||||
QJSValueIterator it(globalObject);
|
||||
while (it.hasNext()){
|
||||
@ -96,7 +100,7 @@ void ScriptEditor::initCompleter()
|
||||
dataWords << it.name();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
foreach(const QString &dsName,dm->dataSourceNames()){
|
||||
dataWords << dsName;
|
||||
foreach(const QString &field, dm->fieldNames(dsName)){
|
||||
|
@ -12,7 +12,12 @@ LanguageSelectDialog::LanguageSelectDialog(QWidget *parent) :
|
||||
for (int i = 2; i<QLocale::LastLanguage; ++i){
|
||||
ui->comboBox->addItem(QLocale::languageToString(static_cast<QLocale::Language>(i)),static_cast<QLocale::Language>(i));
|
||||
}
|
||||
#ifdef HAVE_QT5
|
||||
ui->comboBox->setCurrentText("");
|
||||
#endif
|
||||
#ifdef HAVE_QT4
|
||||
ui->comboBox->setEditText("");
|
||||
#endif
|
||||
}
|
||||
|
||||
LanguageSelectDialog::~LanguageSelectDialog()
|
||||
|
@ -20,4 +20,6 @@ private:
|
||||
Ui::LanguageSelectDialog *ui;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QLocale::Language)
|
||||
|
||||
#endif // LANGUAGESELECTDIALOG_H
|
||||
|
Loading…
Reference in New Issue
Block a user