forked from qt-creator/qt-creator
QmlProfiler: Clean up type selection in statistics model
The statistics have one extra valid event type: "Main Program". This should not be mapped to typeId -1, as -1 is the invalid typeId. Map it instead to std::numeric_limits<int>::max() and remove all the hacks around it. Additionally, optimize the selection algorithm for the statistics main view: We don't need to iterate all types to select one. We can rather use the fact that the row numbers in the source model match the type indices (except for the two special ones). Change-Id: I7c4dc4f84fd167f9a21c418466ad2bfce56e441f Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -81,13 +81,11 @@ public:
|
||||
void copyTableToClipboard() const;
|
||||
void copyRowToClipboard() const;
|
||||
|
||||
int selectedTypeId() const;
|
||||
|
||||
void setShowExtendedStatistics(bool);
|
||||
bool showExtendedStatistics() const;
|
||||
|
||||
void jumpToItem(const QModelIndex &index);
|
||||
void selectType(int typeIndex);
|
||||
void displayTypeIndex(int typeIndex);
|
||||
void jumpToItem(int typeIndex);
|
||||
|
||||
void restrictToFeatures(quint64 features);
|
||||
bool isRestrictedToRange() const;
|
||||
@@ -97,10 +95,10 @@ public:
|
||||
|
||||
signals:
|
||||
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
||||
void typeSelected(int typeIndex);
|
||||
void typeClicked(int typeIndex);
|
||||
void propagateTypeIndex(int typeIndex);
|
||||
|
||||
private:
|
||||
void selectItem(const QModelIndex &index);
|
||||
QString textForItem(const QModelIndex &index) const;
|
||||
|
||||
std::unique_ptr<QmlProfilerStatisticsModel> m_model;
|
||||
@@ -115,11 +113,10 @@ public:
|
||||
~QmlProfilerStatisticsRelativesView();
|
||||
|
||||
void displayType(int typeIndex);
|
||||
void jumpToItem(const QModelIndex &);
|
||||
void jumpToItem(int typeIndex);
|
||||
|
||||
signals:
|
||||
void typeClicked(int typeIndex);
|
||||
void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user