Working on the connection manager.
Made a list model for displaying them in a list. Also added controles to edit the most important properties.
This commit is contained in:
parent
be1892ac52
commit
f5eab84c24
14 changed files with 1100 additions and 9 deletions
57
connectionmanagerwindow.cpp
Normal file
57
connectionmanagerwindow.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
#include "connectionmanagerwindow.h"
|
||||
#include "ui_connectionmanagerwindow.h"
|
||||
|
||||
#include "connectionlistmodel.h"
|
||||
|
||||
ConnectionManagerWindow::ConnectionManagerWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::ConnectionManagerWindow)
|
||||
, m_listModel(new ConnectionListModel(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ConnectionConfig c;
|
||||
c.setDescription("test");
|
||||
m_listModel->add(c);
|
||||
|
||||
ui->listView->setModel(m_listModel);
|
||||
|
||||
connect(ui->listView->selectionModel(),
|
||||
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(on_currentChanged(QModelIndex,QModelIndex)));
|
||||
}
|
||||
|
||||
ConnectionManagerWindow::~ConnectionManagerWindow()
|
||||
{
|
||||
delete ui;
|
||||
delete m_listModel;
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionAdd_Connection_triggered()
|
||||
{
|
||||
ConnectionConfig c;
|
||||
c.setDescription("new");
|
||||
m_listModel->add(c);
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_currentChanged(const QModelIndex ¤t,
|
||||
const QModelIndex &previous)
|
||||
{
|
||||
int currow = current.row();
|
||||
int prevrow = previous.row();
|
||||
ui->lineEdit->setText(QString::number(currow));
|
||||
ui->lineEdit_2->setText(QString::number(prevrow));
|
||||
// if(selection.indexes().isEmpty()) {
|
||||
// clearMyView();
|
||||
// } else {
|
||||
// displayModelIndexInMyView(selection.indexes().first());
|
||||
// }
|
||||
}
|
||||
|
||||
void ConnectionManagerWindow::on_actionDelete_connection_triggered()
|
||||
{
|
||||
auto ci = ui->listView->selectionModel()->currentIndex();
|
||||
if (ci.isValid()) {
|
||||
//m_listModel->removeRow(ci.row());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue