enable/disable delete button
This commit is contained in:
parent
609003fc06
commit
42c5f35576
4 changed files with 21 additions and 1 deletions
|
@ -206,7 +206,7 @@
|
|||
<item>
|
||||
<widget class="QPushButton" name="cancleAllArticlesButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Alles stornieren</string>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||
{
|
||||
ui_.setupUi(this);
|
||||
ui_.editButton->setVisible(false);
|
||||
SellerModel* model =
|
||||
new SellerModel(dynamic_cast<MainWindow*>(parent)->getMarketplace(), ui_.tableView);
|
||||
ui_.tableView->setModel(model);
|
||||
|
@ -16,6 +17,8 @@ SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent,
|
|||
connect(ui_.deleteButton, &QPushButton::clicked, this, &SellerDialog::on_deleteButton_clicked);
|
||||
connect(model, &SellerModel::duplicateSellerNo, this,
|
||||
&SellerDialog::on_model_duplicateSellerNo);
|
||||
connect(ui_.tableView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
&SellerDialog::onSellerViewSelectionChanged);
|
||||
}
|
||||
|
||||
void SellerDialog::on_newButton_clicked()
|
||||
|
@ -73,3 +76,13 @@ void SellerDialog::accept()
|
|||
}
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
void SellerDialog::onSellerViewSelectionChanged(const QItemSelection& selected,
|
||||
[[maybe_unused]] const QItemSelection& deselected)
|
||||
{
|
||||
if (selected.size() > 0) {
|
||||
ui_.deleteButton->setEnabled(true);
|
||||
} else {
|
||||
ui_.deleteButton->setEnabled(false);
|
||||
}
|
||||
}
|
|
@ -15,6 +15,10 @@ class SellerDialog : public QDialog
|
|||
SellerDialog(QWidget* parent = nullptr,
|
||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
|
||||
private slots:
|
||||
void onSellerViewSelectionChanged(const QItemSelection& selected,
|
||||
const QItemSelection& deselected);
|
||||
|
||||
private:
|
||||
void on_newButton_clicked();
|
||||
void on_deleteButton_clicked();
|
||||
|
|
|
@ -65,6 +65,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Löschen</string>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue