You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/postregister/postregistergrid.cpp

46 lines
1.1 KiB
C++

#include "postregistergrid.h"
#include <QHBoxLayout>
#include <QToolButton>
#include "postregister-odb.hxx"
#include "importdialog.h"
PostRegisterGrid::PostRegisterGrid(QWidget *parent)
:GridForm<PostData>(parent)
{
setTableModel(new AutoTableModel<PostData>());
QHBoxLayout *tbLayout = qobject_cast<QHBoxLayout*>(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;
}