From 028d3d587ec9c9e79753bb305d1961dbbde7c0f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D1=A3=D0=B9=20=D0=91=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Tue, 3 Apr 2018 23:13:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D1=91=D0=BD=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=80=D1=8F=D0=B4=D0=BE=D0=BA=20=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D0=BE=D0=BD=D0=BE=D0=BA=20=D0=B2=20=D0=B4=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D0=B2=D0=B5.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Теперь сначала идёт путь, потом значение. --- src/gtool1cd/models/skobka_tree_model.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gtool1cd/models/skobka_tree_model.cpp b/src/gtool1cd/models/skobka_tree_model.cpp index 7614087c..32d6e57e 100644 --- a/src/gtool1cd/models/skobka_tree_model.cpp +++ b/src/gtool1cd/models/skobka_tree_model.cpp @@ -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) { @@ -69,7 +72,7 @@ QVariant SkobkaTreeModel::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { tree *item = static_cast(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; @@ -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()); } } @@ -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("Путь"); } }