Skip to content

Commit

Permalink
Изменён порядок колонок в дереве.
Browse files Browse the repository at this point in the history
Теперь сначала идёт путь, потом значение.
  • Loading branch information
dmpas committed Apr 3, 2018
1 parent c0048cd commit 028d3d5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/gtool1cd/models/skobka_tree_model.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "skobka_tree_model.h"

const int PATH_COLUMN = 0;
const int DATA_COLUMN = 1;

SkobkaTreeModel::SkobkaTreeModel(tree *data_tree)
: data_tree(data_tree)
{
Expand Down Expand Up @@ -69,7 +72,7 @@ QVariant SkobkaTreeModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) {
tree *item = static_cast<tree*>(index.internalPointer());
switch (index.column()) {
case 0: {
case DATA_COLUMN: {
if (item->get_type() == node_type::nd_list) {
QString result = QString(tr("{Элементов: %1}")).arg(item->get_num_subnode());
return result;
Expand All @@ -78,7 +81,7 @@ QVariant SkobkaTreeModel::data(const QModelIndex &index, int role) const
item->outtext(presentation);
return QString::fromStdString(presentation);
}
case 1:
case PATH_COLUMN:
return QString::fromStdString(item->path());
}
}
Expand All @@ -90,9 +93,9 @@ QVariant SkobkaTreeModel::headerData(int section, Qt::Orientation orientation, i
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) {
case 0:
case DATA_COLUMN:
return tr("Значение");
case 1:
case PATH_COLUMN:
return tr("Путь");
}
}
Expand Down

0 comments on commit 028d3d5

Please sign in to comment.