-
Notifications
You must be signed in to change notification settings - Fork 256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tooltips for each of the models. #41
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ | |
*/ | ||
|
||
#include "treemodel.h" | ||
#include "../util.h" | ||
|
||
AbstractTreeModel::AbstractTreeModel(QObject* parent) | ||
: QAbstractItemModel(parent) | ||
|
@@ -55,6 +56,20 @@ QString BottomUpModel::headerTitle(Columns column) | |
return {}; | ||
} | ||
|
||
QString BottomUpModel::headerToolTip(Columns column) | ||
{ | ||
switch (column) { | ||
case Symbol: | ||
return tr("The symbol's function name. May be empty when debug information is missing."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. apostrophe or not? |
||
case Binary: | ||
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing."); | ||
case Cost: | ||
return tr("The symbol's inclusive cost, i.e. the number of samples attributed to this symbol, both directly and indirectly."); | ||
} | ||
Q_UNREACHABLE(); | ||
return {}; | ||
} | ||
|
||
QVariant BottomUpModel::displayData(const Data::BottomUp* row, Columns column) | ||
{ | ||
switch (column) { | ||
|
@@ -69,6 +84,14 @@ QVariant BottomUpModel::displayData(const Data::BottomUp* row, Columns column) | |
return {}; | ||
} | ||
|
||
QVariant BottomUpModel::displayToolTip(const Data::BottomUp* row, quint64 sampleCount) | ||
{ | ||
QString toolTip = tr("%1 in %2\ncost: %3 out of %4 total samples (%5%)").arg( | ||
Util::formatString(row->symbol.symbol), Util::formatString(row->symbol.binary), | ||
Util::formatCost(row->cost.samples), Util::formatCost(sampleCount), Util::formatCostRelative(row->cost.samples, sampleCount)); | ||
return toolTip; | ||
} | ||
|
||
TopDownModel::TopDownModel(QObject* parent) | ||
: TreeModel(parent) | ||
{ | ||
|
@@ -92,6 +115,22 @@ QString TopDownModel::headerTitle(Columns column) | |
return {}; | ||
} | ||
|
||
QString TopDownModel::headerToolTip(Columns column) | ||
{ | ||
switch (column) { | ||
case Symbol: | ||
return tr("The symbol's function name. May be empty when debug information is missing."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here again: apostrophe or not? |
||
case Binary: | ||
return tr("The name of the executable the symbol resides in. May be empty when debug information is missing."); | ||
case InclusiveCost: | ||
return tr("The number of samples attributed to this symbol, both directly and indirectly. This includes the costs of all functions called by this symbol plus its self cost."); | ||
case SelfCost: | ||
return tr("The number of samples directly attributed to this symbol."); | ||
} | ||
Q_UNREACHABLE(); | ||
return {}; | ||
} | ||
|
||
QVariant TopDownModel::displayData(const Data::TopDown* row, Columns column) | ||
{ | ||
switch (column) { | ||
|
@@ -107,3 +146,12 @@ QVariant TopDownModel::displayData(const Data::TopDown* row, Columns column) | |
Q_UNREACHABLE(); | ||
return {}; | ||
} | ||
|
||
QVariant TopDownModel::displayToolTip(const Data::TopDown* row, quint64 sampleCount) | ||
{ | ||
QString toolTip = tr("%1 in %2\nself cost: %3 out of %4 total samples (%5%)\ninclusive cost: %6 out of %7 total samples (%8%)").arg( | ||
Util::formatString(row->symbol.symbol), Util::formatString(row->symbol.binary), | ||
Util::formatCost(row->selfCost.samples), Util::formatCost(sampleCount), Util::formatCostRelative(row->selfCost.samples, sampleCount), | ||
Util::formatCost(row->inclusiveCost.samples), Util::formatCost(sampleCount), Util::formatCostRelative(row->inclusiveCost.samples, sampleCount)); | ||
return toolTip; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are the native speaker, but isn't it "The symbols function name", i.e. without the apostroph?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The symbol's function name." is correct. The apostrophe is used to show possession. i.e. "This is the function name of the symbol." is equal to "The symbol's function name."