mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
Fixed some deprecation warnings
This commit is contained in:
parent
1b1c0d52bc
commit
a865e92a23
@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
set(LIMEREPORT_VERSION_MAJOR 1)
|
||||
set(LIMEREPORT_VERSION_MINOR 6)
|
||||
set(LIMEREPORT_VERSION_RELEASE 7)
|
||||
set(LIMEREPORT_VERSION_RELEASE 8)
|
||||
|
||||
option(ENABLE_ZINT "Enable libzint build for barcode support" OFF)
|
||||
option(LIMEREPORT_STATIC "Build LimeReport as static library" OFF)
|
||||
@ -38,7 +38,7 @@ endif()
|
||||
|
||||
add_subdirectory(3rdparty)
|
||||
add_subdirectory(designer EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(demo_r1 EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(demo_r1 EXCLUDE_FROM_ALL)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
@ -141,7 +141,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
||||
|
||||
LIMEREPORT_VERSION_MAJOR = 1
|
||||
LIMEREPORT_VERSION_MINOR = 6
|
||||
LIMEREPORT_VERSION_RELEASE = 7
|
||||
LIMEREPORT_VERSION_RELEASE = 8
|
||||
|
||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||
|
@ -61,8 +61,13 @@ BaseDesignIntf *ImageItem::createSameTypeItem(QObject *owner, QGraphicsItem *par
|
||||
}
|
||||
|
||||
void ImageItem::loadPictureFromVariant(QVariant& data){
|
||||
//TODO: Migrate to QMetaType
|
||||
if (data.isValid()){
|
||||
if (data.type()==QVariant::Image){
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
if (data.typeId() == QMetaType::QImage){
|
||||
#else
|
||||
if (data.type() == QVariant::Image){
|
||||
#endif
|
||||
m_picture = data.value<QImage>();
|
||||
} else {
|
||||
switch (m_format) {
|
||||
@ -178,11 +183,22 @@ void ImageItem::updateItemSize(DataSourceManager* dataManager, RenderPass pass,
|
||||
m_resourcePath = expandDataFields(m_resourcePath, NoEscapeSymbols, dataManager);
|
||||
m_picture = QImage(m_resourcePath);
|
||||
} else if (!m_variable.isEmpty()){
|
||||
//TODO: Migrate to QMetaType
|
||||
QVariant data = dataManager->variable(m_variable);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
if (data.typeId() == QMetaType::QString){
|
||||
#else
|
||||
if (data.type() == QVariant::String){
|
||||
#endif
|
||||
m_picture = QImage(data.toString());
|
||||
} else if (data.type() == QVariant::Image){
|
||||
loadPictureFromVariant(data);
|
||||
} else {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
if (data.typeId() == QMetaType::QImage){
|
||||
#else
|
||||
if (data.type() == QVariant::Image){
|
||||
#endif
|
||||
loadPictureFromVariant(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,11 +107,22 @@ void SVGItem::updateItemSize(DataSourceManager *dataManager, RenderPass pass, in
|
||||
m_resourcePath = expandDataFields(m_resourcePath, NoEscapeSymbols, dataManager);
|
||||
m_image = imageFromResource(m_resourcePath);
|
||||
} else if (!m_variable.isEmpty()){
|
||||
//TODO: Migrate to QMetaType
|
||||
QVariant data = dataManager->variable(m_variable);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (data.typeId() == QMetaType::QString){
|
||||
#else
|
||||
if (data.type() == QVariant::String){
|
||||
#endif
|
||||
m_image = imageFromResource(data.toString());
|
||||
} else if (data.type() == QVariant::ByteArray) {
|
||||
m_image = data.value<QByteArray>() ;
|
||||
} else {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (data.typeId() == QMetaType::QByteArray) {
|
||||
#else
|
||||
if (data.type() == QVariant::ByteArray) {
|
||||
#endif
|
||||
m_image = data.value<QByteArray>() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -487,6 +487,7 @@ QString TextItem::formatFieldValue()
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
switch (value.type()) {
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
@ -496,6 +497,17 @@ QString TextItem::formatFieldValue()
|
||||
default:
|
||||
return value.toString();
|
||||
}
|
||||
#else
|
||||
switch (value.typeId()) {
|
||||
case QMetaType::QDate:
|
||||
case QMetaType::QDateTime:
|
||||
return formatDateTime(value.toDateTime());
|
||||
case QMetaType::Double:
|
||||
return formatNumber(value.toDouble());
|
||||
default:
|
||||
return value.toString();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -1349,18 +1349,27 @@ void BaseDesignIntf::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
|
||||
QAction* lockGeometryAction = menu.addAction(tr("Lock item geometry"));
|
||||
lockGeometryAction->setCheckable(true);
|
||||
lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
|
||||
|
||||
lockGeometryAction->setChecked(isGeometryLocked());
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* copyAction = menu.addAction(QIcon(":/report/images/copy"), tr("Copy"));
|
||||
copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
QAction* cutAction = menu.addAction(QIcon(":/report/images/cut"), tr("Cut"));
|
||||
cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
|
||||
QAction* cutAction = menu.addAction(QIcon(":/report/images/cut"), tr("Cut"));
|
||||
QAction* pasteAction = menu.addAction(QIcon(":/report/images/paste"), tr("Paste"));
|
||||
pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
|
||||
pasteAction->setEnabled(false);
|
||||
|
||||
#if QT_VERSION >=QT_VERSION_CHECK(5,0,0)
|
||||
lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_L));
|
||||
copyAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C));
|
||||
cutAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_X));
|
||||
pasteAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V));
|
||||
#else
|
||||
lockGeometryAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
|
||||
copyAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
cutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
|
||||
pasteAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
|
||||
#endif
|
||||
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
ItemsReaderIntf::Ptr reader = StringXMLreader::create(clipboard->text());
|
||||
if (reader->first() && reader->itemType() == "Object"){
|
||||
|
@ -85,7 +85,12 @@ bool QueryHolder::runQuery(IDataSource::DatasourceMode mode)
|
||||
query.exec();
|
||||
|
||||
QSqlQueryModel *model = new QSqlQueryModel;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
model->setQuery(std::move(query));
|
||||
#else
|
||||
model->setQuery(query);
|
||||
#endif
|
||||
|
||||
while (model->canFetchMore())
|
||||
model->fetchMore();
|
||||
|
@ -392,7 +392,13 @@ QSharedPointer<QAbstractItemModel>DataSourceManager::previewSQL(const QString &c
|
||||
}
|
||||
|
||||
query.exec();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
|
||||
model->setQuery(std::move(query));
|
||||
#else
|
||||
model->setQuery(query);
|
||||
#endif
|
||||
|
||||
m_lastError = model->lastError().text();
|
||||
putError(m_lastError);
|
||||
if (model->query().isActive())
|
||||
@ -443,7 +449,6 @@ QString DataSourceManager::replaceVariables(QString value){
|
||||
}
|
||||
result += value.mid(pos);
|
||||
return result;
|
||||
// TODO: Qt6 port - done
|
||||
#else
|
||||
QRegExp rx(Const::VARIABLE_RX);
|
||||
|
||||
@ -508,7 +513,6 @@ QString DataSourceManager::replaceVariables(QString query, QMap<QString,QString>
|
||||
match = rx.match(query);
|
||||
}
|
||||
}
|
||||
// TODO: Qt6 port - done
|
||||
#else
|
||||
QRegExp rx(Const::VARIABLE_RX);
|
||||
int curentAliasIndex = 0;
|
||||
@ -582,7 +586,6 @@ QString DataSourceManager::replaceFields(QString query, QMap<QString,QString> &a
|
||||
match = rx.match(query);
|
||||
}
|
||||
}
|
||||
// TODO: Qt6 port - done
|
||||
#else
|
||||
QRegExp rx(Const::FIELD_RX);
|
||||
if (query.contains(rx)){
|
||||
|
@ -519,17 +519,32 @@ QString ScriptEngineManager::expandDataFields(QString context, ExpandType expand
|
||||
fieldValue="\"\"";
|
||||
} else {
|
||||
fieldValue = escapeSimbols(varValue.toString());
|
||||
switch (dataManager()->fieldData(field).type()) {
|
||||
case QVariant::Char:
|
||||
case QVariant::String:
|
||||
case QVariant::StringList:
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
fieldValue = "\""+fieldValue+"\"";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
//TODO: Migrate to QMetaType
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
switch (dataManager()->fieldData(field).typeId()) {
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::QString:
|
||||
case QMetaType::QStringList:
|
||||
case QMetaType::QDate:
|
||||
case QMetaType::QDateTime:
|
||||
fieldValue = "\""+fieldValue+"\"";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
switch (dataManager()->fieldData(field).type()) {
|
||||
case QVariant::Char:
|
||||
case QVariant::String:
|
||||
case QVariant::StringList:
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
fieldValue = "\""+fieldValue+"\"";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (expandType == ReplaceHTMLSymbols)
|
||||
|
@ -56,7 +56,12 @@ ComboBoxEditor::ComboBoxEditor(QWidget *parent, bool clearable) :
|
||||
connect(m_buttonClear,SIGNAL(clicked()),this,SLOT(slotClearButtonClicked()));
|
||||
}
|
||||
|
||||
connect(m_comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(slotCurrentIndexChanged(QString)));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
connect(m_comboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(slotCurrentIndexChanged(QString)));
|
||||
#else
|
||||
connect(m_comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(slotCurrentIndexChanged(QString)));
|
||||
#endif
|
||||
|
||||
m_comboBox->installEventFilter(this);
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->addWidget(m_comboBox);
|
||||
|
@ -85,6 +85,17 @@ LimeReport::RectPropItem::RectPropItem(QObject *object, ObjectsList* objects, co
|
||||
|
||||
QString LimeReport::RectPropItem::displayValue() const
|
||||
{
|
||||
//TODO: Migrate to QMetaType
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
switch(propertyValue().typeId()){
|
||||
case QMetaType::QRect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
case QMetaType::QRectF:
|
||||
return rectToString(propertyValue().toRect());
|
||||
default :
|
||||
return ObjectPropItem::displayValue();
|
||||
}
|
||||
#else
|
||||
switch(propertyValue().type()){
|
||||
case QVariant::Rect:
|
||||
return rectToString(propertyValue().toRect());
|
||||
@ -93,6 +104,7 @@ QString LimeReport::RectPropItem::displayValue() const
|
||||
default :
|
||||
return ObjectPropItem::displayValue();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
LimeReport::RectUnitPropItem::RectUnitPropItem(QObject *object, ObjectsList* objects, const QString &name, const QString &displayName, const QVariant &value, ObjectPropItem *parent, bool /*readonly*/):
|
||||
|
@ -193,13 +193,23 @@ bool XMLWriter::enumOrFlag(QString name, QObject *item)
|
||||
bool XMLWriter::isCollection(QString propertyName, QObject* item)
|
||||
{
|
||||
QMetaProperty prop=item->metaObject()->property(item->metaObject()->indexOfProperty(propertyName.toLatin1()));
|
||||
return QMetaType::type(prop.typeName())==COLLECTION_TYPE_ID;
|
||||
//TODO: Migrate to QMetaType
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return QMetaType::fromName(prop.typeName()).id() == COLLECTION_TYPE_ID;
|
||||
#else
|
||||
return QMetaType::type(prop.typeName()) == COLLECTION_TYPE_ID;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool XMLWriter::isTranslation(QString propertyName, QObject* item)
|
||||
{
|
||||
QMetaProperty prop=item->metaObject()->property(item->metaObject()->indexOfProperty(propertyName.toLatin1()));
|
||||
return QMetaType::type(prop.typeName())==TRANSLATION_TYPE_ID;
|
||||
//TODO: Migrate to QMetaType
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return QMetaType::fromName(prop.typeName()).id() == TRANSLATION_TYPE_ID;
|
||||
#else
|
||||
return QMetaType::type(prop.typeName()) == TRANSLATION_TYPE_ID;
|
||||
#endif
|
||||
}
|
||||
|
||||
void XMLWriter::saveCollection(QString propertyName, QObject *item, QDomElement *node)
|
||||
@ -254,7 +264,13 @@ void XMLWriter::saveTranslation(QString propertyName, QObject* item, QDomElement
|
||||
bool XMLWriter::isQObject(QString propertyName, QObject *item)
|
||||
{
|
||||
QMetaProperty prop=item->metaObject()->property(item->metaObject()->indexOfProperty(propertyName.toLatin1()));
|
||||
return QMetaType::type(prop.typeName())==QMetaType::QObjectStar;
|
||||
//TODO: Migrate to QMetaType
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
return QMetaType::fromName(prop.typeName()).id() == QMetaType::QObjectStar;
|
||||
#else
|
||||
return QMetaType::type(prop.typeName()) == QMetaType::QObjectStar;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
bool XMLWriter::replaceNode(QDomElement node, QObject* item)
|
||||
|
@ -29,7 +29,11 @@ TranslationEditor::TranslationEditor(QWidget *parent) :
|
||||
ui->tbStrings->setHorizontalHeaderItem(1,new QTableWidgetItem(tr("Report Item")));
|
||||
ui->tbStrings->setHorizontalHeaderItem(2,new QTableWidgetItem(tr("Property")));
|
||||
ui->tbStrings->setHorizontalHeaderItem(3,new QTableWidgetItem(tr("Source text")));
|
||||
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(slotItemChecked()));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||
m_clrReturn = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return), this, SLOT(slotItemChecked()));
|
||||
#else
|
||||
m_clrReturn = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Return), this, SLOT(slotItemChecked()));
|
||||
#endif
|
||||
//ui->tbStrings->setSortingEnabled(true);
|
||||
|
||||
}
|
||||
@ -50,6 +54,7 @@ void TranslationEditor::setReportEngine(ITranslationContainer* translationContai
|
||||
TranslationEditor::~TranslationEditor()
|
||||
{
|
||||
delete ui;
|
||||
delete m_clrReturn;
|
||||
}
|
||||
|
||||
QLocale::Language TranslationEditor::getLanguageByName(const QString& languageName){
|
||||
|
@ -46,6 +46,7 @@ private:
|
||||
PageTranslation* m_currentPageTranslation;
|
||||
PropertyTranslation* m_currentPropertyTranslation;
|
||||
bool m_translationChanging;
|
||||
QShortcut* m_clrReturn;
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
Loading…
Reference in New Issue
Block a user