0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-11-10 10:01:25 +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

@@ -47,7 +47,11 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event)
QStyleOption option;
option.initFrom(this);
//painter.fillRect(event->rect(), QPalette().background().color());
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
QColor bg = option.palette.window().color().darker(150);
#else
QColor bg = option.palette.background().color().darker(150);
#endif
painter.fillRect(event->rect(), bg);
QTextBlock block = firstVisibleBlock();
@@ -78,8 +82,11 @@ int CodeEditor::lineNumberAreaWidth()
max /= 10;
++digits;
}
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
int space = fontMetrics().horizontalAdvance(QLatin1Char('9')) * 2 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits;
#else
int space = fontMetrics().width(QLatin1Char('9'))*2 + fontMetrics().width(QLatin1Char('9')) * digits;
#endif
return space;
}
@@ -299,8 +306,11 @@ void CodeEditor::highlightCurrentLine()
if (!isReadOnly()) {
QTextEdit::ExtraSelection selection;
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
QColor lineColor = QColor(QPalette().window().color()).darker(100);
#else
QColor lineColor = QColor(QPalette().background().color()).darker(100);
#endif
selection.format.setBackground(lineColor);
selection.format.setProperty(QTextFormat::FullWidthSelection, true);

View File

@@ -20,7 +20,11 @@ ScriptEditor::ScriptEditor(QWidget *parent) :
setFocusProxy(ui->textEdit);
m_completer = new ReportStructureCompleater(this);
ui->textEdit->setCompleter(m_completer);
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("0")*m_tabIndention);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().horizontalAdvance("0") * m_tabIndention);
#else
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("0") * m_tabIndention);
#endif
connect(ui->splitter, SIGNAL(splitterMoved(int,int)), this, SIGNAL(splitterMoved(int,int)));
connect(ui->textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
}
@@ -86,7 +90,11 @@ void ScriptEditor::setPageBand(BandDesignIntf* band)
void ScriptEditor::setTabIndention(int charCount)
{
if (m_tabIndention != charCount){
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("W")*charCount);
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 3)
ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().horizontalAdvance("W") * charCount);
#else
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().width("W") * charCount);
#endif
m_tabIndention = charCount;
}
}