perf: Fix more clazy qstring-allocation warnings and pass parameters by reference (#910)
* Fix some more clazy-qstring-allocation warnings * Fix missing refs on large types in lib_gui * Fix trivially copyable types being passed by ref in lib_gui
This commit is contained in:
@@ -787,7 +787,7 @@ void QtCodeArea::updateLineNumberAreaWidth(int /* newBlockCount */)
|
||||
setViewportMargins(lineNumberAreaWidth(), 0, 0, 0);
|
||||
}
|
||||
|
||||
void QtCodeArea::updateLineNumberArea(const QRect& rect, int dy)
|
||||
void QtCodeArea::updateLineNumberArea(QRect rect, int dy)
|
||||
{
|
||||
if (dy)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ protected:
|
||||
|
||||
private slots:
|
||||
void updateLineNumberAreaWidth(int newBlockCount = 0);
|
||||
void updateLineNumberArea(const QRect&, int);
|
||||
void updateLineNumberArea(QRect , int);
|
||||
void setIDECursorPosition();
|
||||
void setCopyAvailable(bool yes);
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void QtCodeFileList::clearSnippetTitleAndScrollBar()
|
||||
updateLastSnippetScrollBar(nullptr);
|
||||
}
|
||||
|
||||
QtCodeFile* QtCodeFileList::getFile(const FilePath filePath)
|
||||
QtCodeFile* QtCodeFileList::getFile(const FilePath& filePath)
|
||||
{
|
||||
QtCodeFile* file = nullptr;
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
void clear();
|
||||
void clearSnippetTitleAndScrollBar();
|
||||
|
||||
QtCodeFile* getFile(const FilePath filePath);
|
||||
QtCodeFile* getFile(const FilePath& filePath);
|
||||
|
||||
void addFile(const CodeFileParams& params);
|
||||
|
||||
|
||||
@@ -32,7 +32,10 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
FilePath imageDir = ResourcePaths::getGuiPath().concatenate(L"code_view/images/");
|
||||
|
||||
m_expandButton = new QtSelfRefreshIconButton(
|
||||
QLatin1String(""), imageDir.getConcatenated(L"snippet_arrow_right.png"), "code/file/title", this);
|
||||
QLatin1String(""),
|
||||
imageDir.getConcatenated(L"snippet_arrow_right.png"),
|
||||
"code/file/title",
|
||||
this);
|
||||
m_collapseButton = new QtSelfRefreshIconButton(
|
||||
QLatin1String(""), imageDir.getConcatenated(L"snippet_arrow_down.png"), "code/file/title", this);
|
||||
|
||||
@@ -74,7 +77,8 @@ QtCodeFileTitleBar::QtCodeFileTitleBar(QWidget* parent, bool isHovering, bool is
|
||||
|
||||
m_showErrorsButton = new QPushButton(QStringLiteral("show errors"));
|
||||
m_showErrorsButton->setObjectName(QStringLiteral("screen_button"));
|
||||
m_showErrorsButton->setToolTip(QStringLiteral("Show all errors causing this file to be incomplete"));
|
||||
m_showErrorsButton->setToolTip(
|
||||
QStringLiteral("Show all errors causing this file to be incomplete"));
|
||||
m_showErrorsButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // fixes layouting on Mac
|
||||
m_showErrorsButton->hide();
|
||||
titleLayout->addWidget(m_showErrorsButton);
|
||||
@@ -168,7 +172,8 @@ void QtCodeFileTitleBar::updateRefCount(int refCount, bool hasErrors, size_t fat
|
||||
|
||||
if (fatalErrorCount > 0)
|
||||
{
|
||||
label += QStringLiteral(" (") + QString::number(fatalErrorCount) + QStringLiteral(" fatal)");
|
||||
label += QStringLiteral(" (") + QString::number(fatalErrorCount) +
|
||||
QStringLiteral(" fatal)");
|
||||
}
|
||||
|
||||
QString text = QString::number(refCount) + QChar(' ') + label;
|
||||
|
||||
@@ -11,7 +11,7 @@ QtCodeNavigateable::~QtCodeNavigateable() {}
|
||||
void QtCodeNavigateable::ensureWidgetVisibleAnimated(
|
||||
const QWidget* parentWidget,
|
||||
const QWidget* childWidget,
|
||||
QRectF rect,
|
||||
const QRectF& rect,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ protected:
|
||||
void ensureWidgetVisibleAnimated(
|
||||
const QWidget* parentWidget,
|
||||
const QWidget* childWidget,
|
||||
QRectF rect,
|
||||
const QRectF& rect,
|
||||
bool animated,
|
||||
CodeScrollParams::Target target);
|
||||
void ensurePercentVisibleAnimated(
|
||||
|
||||
@@ -78,8 +78,10 @@ QtCodeNavigator::QtCodeNavigator(QWidget* parent)
|
||||
m_nextLocalReferenceButton = new QtSearchBarButton(
|
||||
ResourcePaths::getGuiPath().concatenate(L"code_view/images/arrow_down.png"), true);
|
||||
|
||||
m_prevLocalReferenceButton->setObjectName(QStringLiteral("local_reference_button_previous"));
|
||||
m_nextLocalReferenceButton->setObjectName(QStringLiteral("local_reference_button_next"));
|
||||
m_prevLocalReferenceButton->setObjectName(
|
||||
QStringLiteral("local_reference_button_previous"));
|
||||
m_nextLocalReferenceButton->setObjectName(
|
||||
QStringLiteral("local_reference_button_next"));
|
||||
|
||||
m_prevLocalReferenceButton->setToolTip(QStringLiteral("previous local reference"));
|
||||
m_nextLocalReferenceButton->setToolTip(QStringLiteral("next local reference"));
|
||||
|
||||
Reference in New Issue
Block a user