SelectionEditorFactory + ItemModel + ItemModelFactory combination is working

in new EditTableWidget

(EditTableWidget is very much WIP)
This commit is contained in:
eelke 2018-12-15 20:27:40 +01:00
parent e44f73166f
commit 742fd0a4d3
19 changed files with 419 additions and 80 deletions

44
pglab/EditTableWidget.cpp Normal file
View file

@ -0,0 +1,44 @@
#include "EditTableWidget.h"
#include "EditColumnTableModel.h"
#include "PgLabItemDelegate.h"
#include <QVBoxLayout>
#include <QTableView>
#include "OpenDatabase.h"
#include "PgDatabaseCatalog.h"
#include "SelectionEditorFactory.h"
#include "TypeModelFactory.h"
EditTableWidget::EditTableWidget(std::shared_ptr<OpenDatabase> database, QWidget *parent)
: QWidget(parent)
, m_database(database)
{
// Table
auto table = new QTableView(this);
// Dialogbutton
auto mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(table);
setLayout(mainLayout);
auto model = new EditColumnTableModel(this);
table->setModel(model);
table->setItemDelegate(new PgLabItemDelegate(this));
auto types = database->catalog()->types();
auto type_delegate = new PgLabItemDelegate(this);
type_delegate->setEditorFactory(
new SelectionEditorFactory(this, new TypeModelFactory(this, types), 0, 1)
);
table->setItemDelegateForColumn(EditColumnTableModel::TypeCol, type_delegate);
// if (opendb) {
// m_typeDelegate.setTypeSelectionModel(opendb->typeSelectionModel());
// }
// paramTableView->setModel(&m_paramList);
// paramTableView->setItemDelegateForColumn(1, &m_typeDelegate);
}