PowerModeler/source/attributeView.cpp

36 lines
1.2 KiB
C++

#include "attributeView.h"
#include "attributeTableDelegate.h"
#include <QHeaderView>
#include <QVBoxLayout>
AttributeView::AttributeView(const ModelAttributeGroup& modelAttributeGroup, QWidget* parent, const QString& connection, const QString& tableName)
: QWidget(parent)
, m_connection(connection)
, m_attributeTable(tableName)
, m_modelAttributeGroup(modelAttributeGroup)
{
m_tableView = new QTableView(this);
m_tableView->verticalHeader()->setVisible(false);
m_tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
m_attributeTableModel = new AttributeTableModel(m_modelAttributeGroup, this, m_connection, m_attributeTable);
m_tableView->setModel(m_attributeTableModel);
AttributeTableDelegate* delegate = new AttributeTableDelegate(m_tableView, m_tableView);
m_tableView->setItemDelegate(delegate);
m_vLayout = new QVBoxLayout(this);
m_vLayout->setSpacing(0);
m_vLayout->setContentsMargins(0, 0, 0, 0);
m_vLayout->addWidget(m_tableView);
this->setLayout(m_vLayout);
}
AttributeView::~AttributeView()
{}
void AttributeView::active()
{
m_attributeTableModel->triggerSyncSignal();
}