GUI: Right-align line number.

This commit is contained in:
Kimmo Varis 2010-11-19 23:11:40 +02:00
parent a0a1ad806a
commit 3fba8b52c0
2 changed files with 20 additions and 1 deletions

View File

@ -82,6 +82,15 @@ QStandardItem *ResultsTree::CreateNormalItem(const QString &name)
return item;
}
QStandardItem *ResultsTree::CreateLineNumberItem(const QString &linenumber)
{
QStandardItem *item = new QStandardItem(linenumber);
item->setData(linenumber, Qt::ToolTipRole);
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
item->setEditable(false);
return item;
}
void ResultsTree::AddErrorItem(const ErrorItem &item)
{
if (item.files.isEmpty())
@ -177,7 +186,7 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent,
const QString file = QDir::toNativeSeparators(item.file);
list << CreateNormalItem(file);
list << CreateNormalItem(tr(item.severity.toLatin1()));
list << CreateNormalItem(QString("%1").arg(item.line));
list << CreateLineNumberItem(QString("%1").arg(item.line));
//TODO message has parameter names so we'll need changes to the core
//cppcheck so we can get proper translations
list << CreateNormalItem(tr(item.summary.toLatin1()));

View File

@ -272,11 +272,21 @@ protected:
/**
* @brief Create new normal item.
*
* Normal item has left alignment and text set also as tooltip.
* @param name name for the item
* @return new QStandardItem
*/
QStandardItem *CreateNormalItem(const QString &name);
/**
* @brief Create new line number item.
*
* Line number item has right align and text set as tooltip.
* @param name name for the item
* @return new QStandardItem
*/
QStandardItem *CreateLineNumberItem(const QString &linenumber);
/**
* @brief Finds a file item
*