Commit c8bbdfd6 authored by Kåre Särs's avatar Kåre Särs
Browse files

build-plugin: Remove the target-set combo-box

-Fix moving command down if there are more commands than target-sets
parent 5a847970
Pipeline #256349 failed with stage
in 60 minutes and 6 seconds
......@@ -209,12 +209,13 @@ void TargetModel::moveRowDown(const QModelIndex &itemIndex)
QModelIndex parent = itemIndex.parent();
int row = itemIndex.row();
if (row >= m_targets.size() - 1) {
return;
}
beginMoveRows(parent, row, row, parent, row + 2);
if (!parent.isValid()) {
if (!parent.isValid() && row >= m_targets.size() - 1) {
return;
}
beginMoveRows(parent, row, row, parent, row + 2);
m_targets.move(row, row + 1);
endMoveRows();
} else {
int rootRow = itemIndex.internalId();
if (rootRow < 0 || rootRow >= m_targets.size()) {
......@@ -224,9 +225,10 @@ void TargetModel::moveRowDown(const QModelIndex &itemIndex)
if (row >= m_targets[rootRow].commands.size() - 1) {
return;
}
beginMoveRows(parent, row, row, parent, row + 2);
m_targets[rootRow].commands.move(row, row + 1);
endMoveRows();
}
endMoveRows();
}
const QString TargetModel::command(const QModelIndex &itemIndex)
......
......@@ -19,12 +19,8 @@ TargetsUi::TargetsUi(QObject *view, QWidget *parent)
{
proxyModel.setSourceModel(&targetsModel);
targetCombo = new QComboBox(this);
targetCombo->setToolTip(i18n("Select active target set"));
targetCombo->setModel(&proxyModel);
targetFilterEdit = new QLineEdit(this);
targetFilterEdit->setPlaceholderText(i18n("Filter targets"));
targetFilterEdit->setPlaceholderText(i18n("Filter targets, use arrow keys to select, press Enter to execute"));
targetFilterEdit->setClearButtonEnabled(true);
newTarget = new QToolButton(this);
......@@ -72,7 +68,6 @@ TargetsUi::TargetsUi(QObject *view, QWidget *parent)
QHBoxLayout *tLayout = new QHBoxLayout();
tLayout->addWidget(targetCombo);
tLayout->addWidget(targetFilterEdit);
tLayout->addWidget(buildButton);
tLayout->addWidget(runButton);
......@@ -91,7 +86,6 @@ TargetsUi::TargetsUi(QObject *view, QWidget *parent)
layout->addWidget(targetsView);
layout->setContentsMargins(0, 0, 0, 0);
connect(targetCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, &TargetsUi::targetSetSelected);
connect(targetsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &TargetsUi::targetActivated);
connect(targetsView->selectionModel(), &QItemSelectionModel::currentChanged, this, &TargetsUi::updateTargetsButtonStates);
......@@ -120,16 +114,6 @@ TargetsUi::TargetsUi(QObject *view, QWidget *parent)
targetFilterEdit->installEventFilter(this);
}
void TargetsUi::targetSetSelected(int index)
{
// qDebug() << index;
targetsView->collapseAll();
QModelIndex rootItem = proxyModel.index(index, 0);
targetsView->setExpanded(rootItem, true);
targetsView->setCurrentIndex(proxyModel.index(0, 0, rootItem));
}
void TargetsUi::targetActivated(const QModelIndex &index)
{
// qDebug() << index;
......@@ -140,8 +124,6 @@ void TargetsUi::targetActivated(const QModelIndex &index)
if (rootItem.parent().isValid()) {
rootItem = rootItem.parent();
}
targetCombo->setCurrentIndex(rootItem.row());
}
void TargetsUi::updateTargetsButtonStates()
......
......@@ -46,7 +46,6 @@ public:
void updateTargetsButtonStates();
public Q_SLOTS:
void targetSetSelected(int index);
void targetActivated(const QModelIndex &index);
Q_SIGNALS:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment