Merge pull request #1199 from ispyisail/feature/terminal-strip-drag-drop

Add drag and drop of free terminals onto a terminal strip (#409)
This commit is contained in:
Laurent Trinques
2026-10-01 08:14:25 +02:00
committed by GitHub
7 changed files with 267 additions and 1 deletions
@@ -41,6 +41,9 @@ FreeTerminalEditor::FreeTerminalEditor(QETProject *project, QWidget *parent) :
m_model = new FreeTerminalModel(m_project, this);
ui->m_table_view->setModel(m_model);
ui->m_table_view->setCurrentIndex(m_model->index(0,0));
//Selected rows can be dragged onto a strip of the terminal strip tree
ui->m_table_view->setDragEnabled(true);
ui->m_table_view->setDragDropMode(QAbstractItemView::DragOnly);
if (m_project) {
connect(m_project, &QObject::destroyed, this, &FreeTerminalEditor::reload);
@@ -274,6 +277,14 @@ void FreeTerminalEditor::on_m_move_pb_clicked()
reload();
}
/**
* @brief FreeTerminalEditor::hasPendingEdits
* @return true if cells were edited and not yet applied
*/
bool FreeTerminalEditor::hasPendingEdits() const {
return !m_model->modifiedModelRealTerminalData().isEmpty();
}
void FreeTerminalEditor::selectionChanged()
{
const bool has_selection = !ui->m_table_view->selectionModel()->selectedIndexes().isEmpty();