39 myRules->setSelectionMode(QAbstractItemView::SingleSelection);
40 myRules->setSelectionBehavior(QAbstractItemView::SelectRows);
41 myRules->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
42 myRules->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
50 myRules->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
53 addWidget(tr(
"Message rules (blue: uses token set by current rule as pre-condition, red: rule that sets token for pre-condition of current rule)"),
myRules,
false,
nullptr,
nullptr);
55 QHBoxLayout* buttons =
new QHBoxLayout();
57 QPushButton* add =
new QPushButton(tr(
"insert rule"),
this);
58 buttons->addWidget(add);
60 QPushButton* remove =
new QPushButton(tr(
"remove rule"),
this);
61 buttons->addWidget(remove);
64 QPushButton* up =
new QPushButton(tr(
"move up"),
this);
65 buttons->addWidget(up);
67 QPushButton* down =
new QPushButton(tr(
"move down"),
this);
68 buttons->addWidget(down);
71 QPushButton* copy =
new QPushButton(tr(
"copy"),
this);
72 buttons->addWidget(copy);
75 QPushButton* reset =
new QPushButton(tr(
"reset all changes"),
this);
76 buttons->addWidget(reset);
82 myUse =
new QTreeWidget(
this);
109 QTreeWidgetItem*
root = NULL;
112 root =
new QTreeWidgetItem(
myUse, QStringList(tr(
"Maps")));
113 root->setExpanded(
true);
116 new QTreeWidgetItem(
root, QStringList(
map->path()));
126 QStringList includes =
rule->include();
127 foreach(QString include, includes)
129 if (include.isEmpty())
132 if (!include.startsWith(
'/'))
134 int last =
file->path().lastIndexOf(QDir::separator());
137 include =
file->path().left(last + 1) + include;
144 root =
new QTreeWidgetItem(
myUse, QStringList(tr(
"Messages")));
145 root->setExpanded(
true);
148 new QTreeWidgetItem(
root, QStringList(
file->path()));
174 int row =
myRules->selectionModel()->currentIndex().row() + 1;
176 myRules->selectionModel()->select(
myModel->
index(row, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
197 if (index < 0 || index >=
myItem->
rules().size() - 1)
218 if (QMessageBox::question(
this,
"Confirm reset",
"Reset message to its initial values?") != QMessageBox::StandardButton::Yes)