forked from qt-creator/qt-creator
Make the TaskView 10% faster by caching how wide "8888" is.
This commit is contained in:
@@ -142,6 +142,7 @@ private:
|
|||||||
const QIcon m_warningIcon;
|
const QIcon m_warningIcon;
|
||||||
int m_taskCount;
|
int m_taskCount;
|
||||||
int m_errorTaskCount;
|
int m_errorTaskCount;
|
||||||
|
int m_sizeOfLineNumber;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TaskFilterModel : public QSortFilterProxyModel
|
class TaskFilterModel : public QSortFilterProxyModel
|
||||||
@@ -221,7 +222,8 @@ TaskModel::TaskModel() :
|
|||||||
m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
|
m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
|
||||||
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png")),
|
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png")),
|
||||||
m_taskCount(0),
|
m_taskCount(0),
|
||||||
m_errorTaskCount(0)
|
m_errorTaskCount(0),
|
||||||
|
m_sizeOfLineNumber(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -422,9 +424,12 @@ int TaskModel::sizeOfFile()
|
|||||||
|
|
||||||
int TaskModel::sizeOfLineNumber()
|
int TaskModel::sizeOfLineNumber()
|
||||||
{
|
{
|
||||||
|
if (m_sizeOfLineNumber == 0) {
|
||||||
QFont font;
|
QFont font;
|
||||||
QFontMetrics fm(font);
|
QFontMetrics fm(font);
|
||||||
return fm.width("8888");
|
m_sizeOfLineNumber = fm.width("8888");
|
||||||
|
}
|
||||||
|
return m_sizeOfLineNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskModel::setFileNotFound(const QModelIndex &idx, bool b)
|
void TaskModel::setFileNotFound(const QModelIndex &idx, bool b)
|
||||||
|
|||||||
Reference in New Issue
Block a user