PowerModeler/source/attributeView.cpp

36 lines
1.2 KiB
C++
Raw Normal View History

#include "attributeView.h"
2025-03-27 21:01:25 +08:00
#include "attributeTableDelegate.h"
#include <QHeaderView>
#include <QVBoxLayout>
2025-03-25 17:58:48 +08:00
AttributeView::AttributeView(const ModelAttributeGroup& modelAttributeGroup, QWidget* parent, const QString& connection, const QString& tableName)
: QWidget(parent)
, m_connection(connection)
, m_attributeTable(tableName)
2025-03-25 17:58:48 +08:00
, m_modelAttributeGroup(modelAttributeGroup)
{
m_tableView = new QTableView(this);
2025-03-27 21:01:25 +08:00
m_tableView->verticalHeader()->setVisible(false);
m_tableView->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft | Qt::AlignVCenter);
2025-03-25 17:58:48 +08:00
m_attributeTableModel = new AttributeTableModel(m_modelAttributeGroup, this, m_connection, m_attributeTable);
m_tableView->setModel(m_attributeTableModel);
2025-03-27 21:01:25 +08:00
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()
{}
2025-03-25 17:58:48 +08:00
void AttributeView::active()
{
m_attributeTableModel->triggerSyncSignal();
2025-03-25 17:58:48 +08:00
}