#include "postregistergrid.h" #include #include #include "postregister-odb.hxx" #include "importdialog.h" PostRegisterGrid::PostRegisterGrid(QWidget *parent) :GridForm(parent) { setTableModel(new AutoTableModel()); QHBoxLayout *tbLayout = qobject_cast(this->toolbar()->layout()); if (tbLayout != NULL) { QToolButton *btnImport = new QToolButton(this->toolbar()); btnImport->setIcon(QIcon(":/icons/import.svg")); btnImport->setAutoRaise(true); btnImport->setIconSize(QSize(24, 24)); btnImport->setToolTip(tr("Import")); tbLayout->insertWidget(tbLayout->count() - 1, btnImport); connect(btnImport, &QToolButton::clicked, [this](){ ImportDialog *dlg = new ImportDialog(this); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->show(); }); } } bool PostRegisterGrid::canAddRecord() { return false; } bool PostRegisterGrid::canEditRecord() { return false; } bool PostRegisterGrid::canDeleteRecord() { return false; }