Disable add/edit/delete buttons now possible.
This commit is contained in:
@@ -111,6 +111,7 @@ public slots:
|
||||
|
||||
connect(tableView()->horizontalHeader(), SIGNAL(sectionResized(int,int,int)), this, SLOT(widthChanged(int,int,int)));
|
||||
hideColumns(hide);
|
||||
enableButtons();
|
||||
|
||||
return !m_permissionDenied;
|
||||
}
|
||||
|
||||
+7
-2
@@ -71,6 +71,11 @@ QWidget *IGridForm::filterWidget()
|
||||
return ui->filterWidget;
|
||||
}
|
||||
|
||||
void IGridForm::enableButtons()
|
||||
{
|
||||
ui->btnNew->setEnabled(canAddRecord());
|
||||
}
|
||||
|
||||
|
||||
void IGridForm::on_btnNew_clicked()
|
||||
{
|
||||
@@ -143,8 +148,8 @@ void IGridForm::on_tableView_clicked(const QModelIndex &)
|
||||
{
|
||||
if (ui->tableView->currentIndex().isValid())
|
||||
{
|
||||
ui->btnEdit->setEnabled(true);
|
||||
ui->btnDelete->setEnabled(true);
|
||||
ui->btnEdit->setEnabled(canEditRecord());
|
||||
ui->btnDelete->setEnabled(canDeleteRecord());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,8 +41,12 @@ protected:
|
||||
virtual void handleNewRecord() = 0;
|
||||
virtual void handleEditRecord() = 0;
|
||||
virtual void handleDeleteRecord() = 0;
|
||||
virtual bool canAddRecord() { return true; }
|
||||
virtual bool canEditRecord() { return true; }
|
||||
virtual bool canDeleteRecord() { return true; }
|
||||
void hideColumns(const QList<int> &cols);
|
||||
QWidget *filterWidget();
|
||||
void enableButtons();
|
||||
|
||||
private slots:
|
||||
void on_btnNew_clicked();
|
||||
|
||||
Reference in New Issue
Block a user