#include "attributeSelector.h" #include "ui_attributeSelector.h" #include "mainwindow.h" #include "attributeView.h" #include "attributeTableModel.h" #include "attributeTableDelegate.h" AttributeSelector::AttributeSelector(const QString& connection, QWidget *parent) : QWidget(parent) , ui(new Ui::AttributeSelector) , m_connection(connection) { ui->setupUi(this); //隐藏一些功能按钮 ui->btnAdd->setVisible(false); ui->btnRemove->setVisible(false); ui->btnSave->setVisible(false); ui->btnCancle->setVisible(false); ModelAttributeGroup attributeGroup(-1, -1, "" ,""); m_attributeView = new AttributeView(attributeGroup, ui->attributeViewContainer, connection); ui->layoutTableView->addWidget(m_attributeView); // m_attributeTableModel = new AttributeTableModel(attributeGroup, this, m_connection); // m_tableView->setModel(m_attributeTableModel); // m_attributeTableDelegate = new AttributeTableDelegate(m_tableView, m_connection, m_tableView); // m_tableView->setItemDelegate(m_attributeTableDelegate); connect(ui->btnRefresh, &QPushButton::clicked, this, &AttributeSelector::onBtnClicked_refreshData); } AttributeSelector::~AttributeSelector() { delete ui; } void AttributeSelector::setMainWindow(MainWindow* window) { m_pMainWindow = window; } void AttributeSelector::onBtnClicked_refreshData() { } void AttributeSelector::onSyncDataStatus(bool hasModifiedData, const PaginationInfo& paginationInfo) { ui->btnSave->setEnabled(!hasModifiedData); ui->btnCancle->setEnabled(!hasModifiedData); QString recordInfo = QString::fromWCharArray(L"共 %1 条记录").arg(paginationInfo.totalEntries); ui->recordInfo->setText(recordInfo); ui->lineEdit->setText(QString::number(paginationInfo.currentPage)); ui->lineEdit->setEnabled(true); }