ui: Fixed annotation hovering slow in code snippet view due to style calculation from setting stylesheets

This commit is contained in:
Eberhard Graether
2019-05-28 14:30:23 +02:00
parent 762b27d306
commit 5084a11dec
3 changed files with 13 additions and 21 deletions
+3 -10
View File
@@ -1,6 +1,7 @@
#include "QtCodeFile.h"
#include <QVBoxLayout>
#include <QStyle>
#include "MessageChangeFileView.h"
@@ -363,23 +364,15 @@ void QtCodeFile::updateSnippets()
int maxDigits = 1;
for (QtCodeSnippet* snippet : m_snippets)
{
if (snippet != m_snippets.front() && snippet->styleSheet().size())
{
snippet->setStyleSheet("");
}
maxDigits = qMax(maxDigits, snippet->lineNumberDigits());
}
for (QtCodeSnippet* snippet : m_snippets)
{
snippet->setProperty("first", snippet == m_snippets.front());
snippet->style()->polish(snippet); // recomputes style to make property take effect
snippet->updateLineNumberAreaWidthForDigits(maxDigits);
}
if (!m_snippets.front()->styleSheet().size())
{
m_snippets.front()->setStyleSheet("#code_snippet { border: none; }");
}
}
void QtCodeFile::updateTitleBar()
+1 -10
View File
@@ -236,19 +236,10 @@ void QtCodeFileList::updateFiles()
{
for (QtCodeFile* file : m_files)
{
if (file != m_files.back())
{
file->setStyleSheet("#code_file { border: none; }");
}
file->setProperty("last", file == m_files.back());
file->updateContent();
}
if (m_files.size())
{
m_files.back()->setStyleSheet("");
}
// Perform delayed so all widgets are already visible
QTimer::singleShot(100, this, &QtCodeFileList::updateSnippetTitleAndScrollBarSlot);
}