From: Milian Wolff Date: Mon, 15 Jun 2015 19:46:36 +0000 (+0200) Subject: Add tooltip to header X-Git-Tag: submit/tizen/20180620.112952^2~328^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc83d5bfb881b4d6c4c23e853f854f6069e69a14;p=sdk%2Ftools%2Fheaptrack.git Add tooltip to header --- diff --git a/gui/model.cpp b/gui/model.cpp index 0a5fb39..ef6446a 100644 --- a/gui/model.cpp +++ b/gui/model.cpp @@ -173,26 +173,55 @@ Model::~Model() QVariant Model::headerData(int section, Qt::Orientation orientation, int role) const { - if (orientation != Qt::Horizontal || role != Qt::DisplayRole || section < 0 || section >= NUM_COLUMNS) { + if (orientation != Qt::Horizontal || section < 0 || section >= NUM_COLUMNS) { return {}; } - switch (static_cast(section)) { - case FileColumn: - return i18n("File"); - case FunctionColumn: - return i18n("Function"); - case ModuleColumn: - return i18n("Module"); - case AllocationsColumn: - return i18n("Allocations"); - case PeakColumn: - return i18n("Peak"); - case LeakedColumn: - return i18n("Leaked"); - case AllocatedColumn: - return i18n("Allocated"); - case NUM_COLUMNS: - break; + if (role == Qt::DisplayRole) { + switch (static_cast(section)) { + case FileColumn: + return i18n("File"); + case FunctionColumn: + return i18n("Function"); + case ModuleColumn: + return i18n("Module"); + case AllocationsColumn: + return i18n("Allocations [-]"); + case PeakColumn: + return i18n("Peak [B]"); + case LeakedColumn: + return i18n("Leaked [B]"); + case AllocatedColumn: + return i18n("Allocated [B]"); + case LocationColumn: + return i18n("Location"); + case NUM_COLUMNS: + break; + } + } else if (role == Qt::ToolTipRole) { + switch (static_cast(section)) { + case FileColumn: + return i18n("The file and line number where the allocation function was called from. " + "May be empty when debug information is missing."); + case FunctionColumn: + return i18n("The parent function that called an allocation function. " + "May be unknown when debug information is missing."); + case ModuleColumn: + return i18n("The module, i.e. executable or shared library, from which an allocation function was called."); + case AllocationsColumn: + return i18n("The number of times an allocation function was called from this location."); + case PeakColumn: + return i18n("The maximum heap memory in bytes consumed from allocations originating at this location. " + "This takes deallocations into account."); + case LeakedColumn: + return i18n("The bytes allocated at this location that have not been deallocated."); + case AllocatedColumn: + return i18n("The sum of all bytes allocated from this location, ignoring deallocations."); + case LocationColumn: + return i18n("The location from which an allocation function was called. Function symbol and file information " + "may be unknown when debug information was missing when heaptrack was run."); + case NUM_COLUMNS: + break; + } } return {}; }