#include "EditTableWidget.h" #include "EditColumnTableModel.h" #include "PgLabItemDelegate.h" #include #include #include "OpenDatabase.h" #include "PgDatabaseCatalog.h" #include "SelectionEditorFactory.h" #include "TypeModelFactory.h" EditTableWidget::EditTableWidget(std::shared_ptr 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); }