ui: Fixed annotation hovering slow in code snippet view due to style calculation from setting stylesheets
This commit is contained in:
@@ -117,10 +117,14 @@
|
||||
#code_file {
|
||||
background-color: <color:code/snippet/background>;
|
||||
margin-bottom: 0px;
|
||||
border-bottom: 1px solid <color:code/file/background>; /* last file only */
|
||||
border: none;
|
||||
font-size: <setting:font_size>px;
|
||||
}
|
||||
|
||||
#code_file[last=true] {
|
||||
border-bottom: 1px solid <color:code/file/background>;
|
||||
}
|
||||
|
||||
#title_bar, #title_bar_single {
|
||||
background-color: <color:code/file/background>;
|
||||
font-size: <setting:font_size>px;
|
||||
@@ -186,6 +190,10 @@
|
||||
font-size: <setting:font_size>px;
|
||||
}
|
||||
|
||||
#code_file #code_snippet[first=true] {
|
||||
border: none;
|
||||
}
|
||||
|
||||
#code_file #code_snippet #scope_name, #code_file #code_snippet #dots {
|
||||
background-color: <color:code/snippet/title/background>;
|
||||
border: none;
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user