Add a push button to automatically reorder the terminal strip

This commit is contained in:
joshua
2021-09-22 23:02:33 +02:00
parent 377f8b1521
commit 1699ad9dd8
7 changed files with 311 additions and 74 deletions

View File

@@ -30,6 +30,7 @@
#include "../../qeticons.h"
#include "terminalstripmodel.h"
#include "../diagram.h"
#include "../UndoCommand/sortterminalstripcommand.h"
#include <QTreeWidgetItem>
@@ -273,6 +274,10 @@ void TerminalStripEditor::setCurrentStrip(TerminalStrip *strip_)
return;
}
if (m_current_strip) {
disconnect(m_current_strip, &TerminalStrip::orderChanged, this, &TerminalStripEditor::on_m_reload_pb_clicked);
}
if (!strip_)
{
ui->m_installation_le ->clear();
@@ -302,6 +307,8 @@ void TerminalStripEditor::setCurrentStrip(TerminalStrip *strip_)
m_model = new TerminalStripModel(strip_, this);
ui->m_table_widget->setModel(m_model);
connect(m_current_strip, &TerminalStrip::orderChanged, this, &TerminalStripEditor::on_m_reload_pb_clicked);
}
}
@@ -456,3 +463,14 @@ void TerminalStripEditor::on_m_dialog_button_box_clicked(QAbstractButton *button
on_m_reload_pb_clicked();
}
/**
* @brief TerminalStripEditor::on_m_auto_pos_pb_clicked
*/
void TerminalStripEditor::on_m_auto_ordering_pb_clicked()
{
if (m_project && m_current_strip) {
m_project->undoStack()->push(new SortTerminalStripCommand(m_current_strip));
}
}