mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-23 16:22:58 +03:00
WIP
This commit is contained in:
parent
7dad9d700b
commit
fa6cbef6a7
@ -360,7 +360,11 @@ void TextItem::updateLayout()
|
||||
|
||||
bool TextItem::isNeedExpandContent() const
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp rx("$*\\{[^{]*\\}");
|
||||
#else
|
||||
QRegularExpression rx("$*\\{[^{]*\\}");
|
||||
#endif
|
||||
return content().contains(rx) || isContentBackedUp();
|
||||
}
|
||||
|
||||
@ -448,7 +452,11 @@ QString TextItem::formatNumber(const double value)
|
||||
|
||||
if (m_format.contains("%"))
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
str.sprintf(m_format.toStdString().c_str(), value);
|
||||
#else
|
||||
str.asprintf(m_format.toStdString().c_str(), value);
|
||||
#endif
|
||||
str = str.replace(",", QLocale::system().groupSeparator());
|
||||
str = str.replace(".", QLocale::system().decimalPoint());
|
||||
}
|
||||
@ -813,7 +821,11 @@ void TextItem::expandContent(DataSourceManager* dataManager, RenderPass pass)
|
||||
{
|
||||
QString context=content();
|
||||
foreach (QString variableName, dataManager->variableNamesByRenderPass(SecondPass)) {
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
||||
#else
|
||||
QRegularExpression rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
||||
#endif
|
||||
if (context.contains(rx) && pass == FirstPass){
|
||||
backupContent();
|
||||
break;
|
||||
|
@ -1392,7 +1392,11 @@ void DataSourceManager::invalidateQueriesContainsVariable(const QString& variabl
|
||||
foreach (const QString& datasourceName, dataSourceNames()){
|
||||
QueryHolder* holder = dynamic_cast<QueryHolder*>(m_datasources.value(datasourceName));
|
||||
if (holder){
|
||||
#if QT_VERSION < 0x060000
|
||||
QRegExp rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
||||
#else
|
||||
QRegularExpression rx(QString(Const::NAMED_VARIABLE_RX).arg(variableName));
|
||||
#endif
|
||||
if (holder->queryText().contains(rx)){
|
||||
holder->invalidate(designTime() ? IDataSource::DESIGN_MODE : IDataSource::RENDER_MODE);
|
||||
datasources.append(datasourceName);
|
||||
|
@ -53,12 +53,21 @@ bool GraphicsViewZoomer::eventFilter(QObject *object, QEvent *event) {
|
||||
} else if (event->type() == QEvent::Wheel) {
|
||||
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event);
|
||||
if (QApplication::keyboardModifiers() == m_modifiers) {
|
||||
#if QT_VERSION < 0x060000
|
||||
if (wheel_event->orientation() == Qt::Vertical) {
|
||||
double angle = wheel_event->delta();
|
||||
double factor = qPow(m_zoomFactorBase, angle);
|
||||
gentleZoom(factor);
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
if (wheel_event->angleDelta().y() != 0) {
|
||||
double angle = wheel_event->angleDelta().y();
|
||||
double factor = qPow(m_zoomFactorBase, angle);
|
||||
gentleZoom(factor);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Q_UNUSED(object)
|
||||
|
@ -752,8 +752,12 @@ void PageDesignIntf::dropEvent(QGraphicsSceneDragDropEvent* event)
|
||||
bool isVar = event->mimeData()->text().indexOf("variable:")==0;
|
||||
BaseDesignIntf* item = addReportItem("TextItem",event->scenePos(),QSize(250, 50));
|
||||
TextItem* ti = dynamic_cast<TextItem*>(item);
|
||||
QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1);
|
||||
QString data = event->mimeData()->text().remove(0,event->mimeData()->text().indexOf(":")+1);
|
||||
#if QT_VERSION < 0x060000
|
||||
if (isVar) data = data.remove(QRegExp(" \\[.*\\]"));
|
||||
#else
|
||||
if (isVar) data = data.remove(QRegularExpression(" \\[.*\\]"));
|
||||
#endif
|
||||
ti->setContent(data);
|
||||
if (!isVar){
|
||||
BandDesignIntf* parentBand = dynamic_cast<BandDesignIntf*>(ti->parentItem());
|
||||
|
@ -711,10 +711,18 @@ QSizeF PageItemDesignIntf::getRectByPageSize(const PageSize& size)
|
||||
if (size != Custom) {
|
||||
QPrinter printer;
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
#if QT_VERSION < 0x060000
|
||||
printer.setOrientation((QPrinter::Orientation)pageOrientation());
|
||||
printer.setPaperSize((QPrinter::PageSize)size);
|
||||
return QSizeF(printer.paperSize(QPrinter::Millimeter).width() * 10,
|
||||
printer.paperSize(QPrinter::Millimeter).height() * 10);
|
||||
|
||||
#else
|
||||
printer.setPageOrientation((QPageLayout::Orientation)pageOrientation());
|
||||
printer.setPageSize(QPageSize((QPageSize::PageSizeId)size));
|
||||
return QSizeF(printer.pageLayout().pageSize().size(QPageSize::Millimeter).width() * 10,
|
||||
printer.pageLayout().pageSize().size(QPageSize::Millimeter).height() * 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
else {
|
||||
|
@ -1058,8 +1058,13 @@ bool ReportDesignWidget::eventFilter(QObject *target, QEvent *event)
|
||||
if (event->type() == QEvent::Wheel){
|
||||
QWheelEvent* we = dynamic_cast<QWheelEvent*>(event);
|
||||
if (QApplication::keyboardModifiers()==Qt::ControlModifier){
|
||||
#if QT_VERSION < 0x060000
|
||||
if(we->delta()<0) scale(1.2,1.2);
|
||||
else scale(1/1.2,1/1.2);
|
||||
#else
|
||||
if(we->pixelDelta().x()<0) scale(1.2,1.2);
|
||||
else scale(1/1.2,1/1.2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(target,event);
|
||||
|
@ -842,7 +842,6 @@ void ReportDesignWindow::restoreSetting()
|
||||
|
||||
int screenWidth = desktop->screenGeometry().width();
|
||||
int screenHeight = desktop->screenGeometry().height();
|
||||
|
||||
#else
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
|
||||
@ -1541,7 +1540,11 @@ void ReportDesignWindow::slotPageDeleted()
|
||||
|
||||
void ReportDesignWindow::slotFilterTextChanged(const QString& filter)
|
||||
{
|
||||
#if QT_VERSION < 0x060000
|
||||
m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString));
|
||||
#else
|
||||
m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_QTDESIGNER_INTEGRATION
|
||||
|
@ -151,7 +151,7 @@ void SettingDialog::setDesignerUnites(QList<QString> unitTypes, const QString cu
|
||||
ui->reportUnits->clear();
|
||||
ui->reportUnits->addItems(unitTypes);
|
||||
#if QT_VERSION < 0x050000
|
||||
ui->cbTheme->setCurrentIndex(ui->cbTheme->findText(currentUnitType));
|
||||
ui->reportUnits->setCurrentIndex(ui->reportUnits->findText(currentUnitType));
|
||||
#else
|
||||
ui->reportUnits->setCurrentText(currentUnitType);
|
||||
#endif
|
||||
|
@ -182,7 +182,11 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
|
||||
m_propertyModel = new BaseDesignPropertyModel(this);
|
||||
m_filterModel = new PropertyFilterModel(this);
|
||||
m_filterModel->setSourceModel(m_propertyModel);
|
||||
#if QT_VERSION < 0x060000
|
||||
m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString));
|
||||
#else
|
||||
m_filterModel->setFilterRegularExpression(QRegularExpression("", QRegularExpression::CaseInsensitiveOption));
|
||||
#endif
|
||||
m_objectInspectorView->setModel(m_filterModel);
|
||||
QVBoxLayout* l = new QVBoxLayout();
|
||||
QLineEdit* le = new QLineEdit(this);
|
||||
@ -310,7 +314,11 @@ void ObjectInspectorWidget::updateProperty(const QString &propertyName)
|
||||
void ObjectInspectorWidget::slotFilterTextChanged(const QString &filter)
|
||||
{
|
||||
if (m_filterModel)
|
||||
#if QT_VERSION < 0x060000
|
||||
m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString));
|
||||
#else
|
||||
m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
|
||||
#endif
|
||||
}
|
||||
|
||||
void ObjectInspectorWidget::slotTranslatePropertiesChecked(bool value)
|
||||
|
Loading…
Reference in New Issue
Block a user