0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-10-01 11:31:10 +03:00
This commit is contained in:
Rodrigo Torres
2021-08-23 02:07:08 -03:00
parent 53683a8c89
commit 7dad9d700b
42 changed files with 249 additions and 157 deletions

View File

@@ -46,8 +46,8 @@ void CodeEditor::lineNumberAreaPaintEvent(QPaintEvent* event)
QPainter painter(lineNumberArea);
QStyleOption option;
option.initFrom(this);
//painter.fillRect(event->rect(), QPalette().background().color());
QColor bg = option.palette.background().color().darker(150);
//painter.fillRect(event->rect(), QPalette().window().color());
QColor bg = option.palette.window().color().darker(150);
painter.fillRect(event->rect(), bg);
QTextBlock block = firstVisibleBlock();
@@ -79,7 +79,7 @@ int CodeEditor::lineNumberAreaWidth()
++digits;
}
int space = fontMetrics().width(QLatin1Char('9'))*2 + fontMetrics().width(QLatin1Char('9')) * digits;
int space = fontMetrics().boundingRect(QLatin1Char('9')).width()*2 + fontMetrics().boundingRect(QLatin1Char('9')).width() * digits;
return space;
}
@@ -300,7 +300,7 @@ void CodeEditor::highlightCurrentLine()
if (!isReadOnly()) {
QTextEdit::ExtraSelection selection;
QColor lineColor = QColor(QPalette().background().color()).darker(100);
QColor lineColor = QColor(QPalette().window().color()).darker(100);
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 < 0x060000
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().boundingRect("0").width()*m_tabIndention);
#else
ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().boundingRect("0").width()*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 < 0x060000
ui->textEdit->setTabStopWidth(ui->textEdit->fontMetrics().boundingRect("W").width()*charCount);
#else
ui->textEdit->setTabStopDistance(ui->textEdit->fontMetrics().boundingRect("W").width()*charCount);
#endif
m_tabIndention = charCount;
}
}

View File

@@ -247,7 +247,7 @@ ScriptHighlighter::ScriptHighlighter(QTextDocument* parent):
m_keywords.insert(keywords[i]);
}
if ( isColorDark(QPalette().background().color())){
if ( isColorDark(QPalette().window().color())){
m_formats[NumberFormat].setForeground(Qt::darkBlue);
m_formats[StringFormat].setForeground(Qt::darkGreen);
m_formats[KeywordFormat].setForeground(Qt::darkYellow);