0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-31 05:11:56 +03:00

Qt6 support added

This commit is contained in:
fralx
2021-01-20 14:47:05 +03:00
parent e3356a3d00
commit 81f27782be
39 changed files with 759 additions and 204 deletions

View File

@@ -34,7 +34,11 @@
#include <QFocusEvent>
#include <QApplication>
#include <QStyle>
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
#include <QScreen>
#else
#include <QDesktopWidget>
#endif
#include "lrtextitempropertyeditor.h"
namespace LimeReport{
@@ -66,7 +70,18 @@ void ButtonLineEditor::editButtonClicked()
{
TextItemPropertyEditor* editor = new TextItemPropertyEditor(QApplication::activeWindow());
editor->setAttribute(Qt::WA_DeleteOnClose);
editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QApplication::desktop()->availableGeometry()));
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
editor->setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
editor->size(),
QGuiApplication::primaryScreen()->geometry()
)
);
#else
editor->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, editor->size(), QApplication::desktop()->geometry()));
#endif
editor->setWindowTitle(m_propertyName);
editor->setText(m_lineEdit->text());
connect(editor,SIGNAL(accepted()),this,SLOT(editingByEditorFinished()));

View File

@@ -168,7 +168,11 @@ bool PropertyFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex &sou
{
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
if (sourceParent.isValid()) return true;
#if QT_VERSION >= 0x060000
return sourceModel()->data(index).toString().contains(filterRegularExpression());
#else
return sourceModel()->data(index).toString().contains(filterRegExp());
#endif
}
ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
@@ -178,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 >= QT_VERSION_CHECK(5, 12, 3)
m_filterModel->setFilterRegularExpression(QRegularExpression("", QRegularExpression::CaseInsensitiveOption));
#else
m_filterModel->setFilterRegExp(QRegExp("", Qt::CaseInsensitive, QRegExp::FixedString));
#endif
m_objectInspectorView->setModel(m_filterModel);
QVBoxLayout* l = new QVBoxLayout();
QLineEdit* le = new QLineEdit(this);
@@ -209,7 +217,16 @@ ObjectInspectorWidget::ObjectInspectorWidget(QWidget *parent)
h->addWidget(settingButton);
l->addLayout(h);
l->addWidget(m_objectInspectorView);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
l->setContentsMargins(
Const::DOCKWIDGET_MARGINS,
Const::DOCKWIDGET_MARGINS,
Const::DOCKWIDGET_MARGINS,
Const::DOCKWIDGET_MARGINS
);
#else
l->setMargin(Const::DOCKWIDGET_MARGINS);
#endif
l->setSpacing(2);
this->setLayout(l);
}
@@ -305,7 +322,11 @@ void ObjectInspectorWidget::updateProperty(const QString &propertyName)
void ObjectInspectorWidget::slotFilterTextChanged(const QString &filter)
{
if (m_filterModel)
#if QT_VERSION >= 0x060000
m_filterModel->setFilterRegularExpression(QRegularExpression(filter, QRegularExpression::CaseInsensitiveOption));
#else
m_filterModel->setFilterRegExp(QRegExp(filter, Qt::CaseInsensitive, QRegExp::FixedString));
#endif
}
void ObjectInspectorWidget::slotTranslatePropertiesChecked(bool value)