Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Tools/SqlBrowser/AddLine.cpp
T
berrux-dev e4743d631d Reduce qt6-after tree to release validation scope
Kept: TetraIF/, Z/src, Lts/Common, Lts/Proxies/TrainingAreaBase
(tabTelegrams dependency of TetraIF) plus build scaffolding
(cmake/, include/, external/, doxygen/, tests/, translations/,
lts-cc.conf, CTestCustom.ctest, new_docker_build.sh, rti_license.dat).
Removed: out-of-scope Lts modules (Application, DDS, Plugins, Projects,
Services, Tools, Viewer, all Proxies except TrainingAreaBase),
top-level src/, specs/, Qt5 tree (qt5-before + .gitmodules entry),
migration reports and leftover scripts.
2026-10-13 17:24:34 +02:00

81 lines
1.5 KiB
C++
Executable File

#include "AddLine.h"
#include "ui_AddLinesUi.h"
#include <QtCore/QDebug>
AddLines::AddLines(QWidget* parent)
: QDialog(parent)
, m_ui(new Ui::AddLines)
{
qRegisterMetaType<AddModel*>("AddModel*");
m_ui->setupUi(this);
m_ui->dataView->setModel(&addModel);
connect(m_ui->pbDone, &QPushButton::clicked,
this, &AddLines::slotAddLines);
connect(m_ui->pbAbort, &QPushButton::clicked,
this, &AddLines::close);
connect(m_ui->pbDelete, &QPushButton::clicked,
this, &AddLines::slotDeleteLines);
connect(m_ui->pbClear, &QPushButton::clicked,
this, &AddLines::slotClear);
}
AddLines::~AddLines()
{
delete m_ui;
}
void AddLines::slotDeleteLines()
{
//qWarning() << "slotDeleteLines";
while (m_ui->dataView->selectionModel()->selectedRows().count())
{
const QModelIndexList selectedRows = m_ui->dataView->selectionModel()->selectedRows();
if (selectedRows.at(0).row() == addModel.rowCount()-1) // do not delete empty row!
{
return; // In hope that the selectedRows list is sorted.....
}
addModel.removeRow(selectedRows.at(0).row());
}
}
void AddLines::slotClear()
{
//qWarning() << "slotClear";
addModel.clear();
}
void AddLines::reject()
{
emit signalAddLines(nullptr);
}
void AddLines::copyDataFromModel(DataModel* dataModel)
{
addModel.setHeaderList(dataModel->getHeaderList());
addModel.setTablename(dataModel->getTableName());
}
void AddLines::slotAddLines()
{
this->hide(); // hide until in work..
emit signalAddLines(&addModel);
}