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>
|
<item>
|
||||||
<widget class="QPushButton" name="cancleAllArticlesButton">
|
<widget class="QPushButton" name="cancleAllArticlesButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Alles stornieren</string>
|
<string>Alles stornieren</string>
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
SellerDialog::SellerDialog(QWidget* parent, Qt::WindowFlags f) : QDialog(parent, f)
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_.setupUi(this);
|
||||||
|
ui_.editButton->setVisible(false);
|
||||||
SellerModel* model =
|
SellerModel* model =
|
||||||
new SellerModel(dynamic_cast<MainWindow*>(parent)->getMarketplace(), ui_.tableView);
|
new SellerModel(dynamic_cast<MainWindow*>(parent)->getMarketplace(), ui_.tableView);
|
||||||
ui_.tableView->setModel(model);
|
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(ui_.deleteButton, &QPushButton::clicked, this, &SellerDialog::on_deleteButton_clicked);
|
||||||
connect(model, &SellerModel::duplicateSellerNo, this,
|
connect(model, &SellerModel::duplicateSellerNo, this,
|
||||||
&SellerDialog::on_model_duplicateSellerNo);
|
&SellerDialog::on_model_duplicateSellerNo);
|
||||||
|
connect(ui_.tableView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||||
|
&SellerDialog::onSellerViewSelectionChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SellerDialog::on_newButton_clicked()
|
void SellerDialog::on_newButton_clicked()
|
||||||
|
@ -73,3 +76,13 @@ void SellerDialog::accept()
|
||||||
}
|
}
|
||||||
QDialog::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,
|
SellerDialog(QWidget* parent = nullptr,
|
||||||
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
Qt::WindowFlags f = Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onSellerViewSelectionChanged(const QItemSelection& selected,
|
||||||
|
const QItemSelection& deselected);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void on_newButton_clicked();
|
void on_newButton_clicked();
|
||||||
void on_deleteButton_clicked();
|
void on_deleteButton_clicked();
|
||||||
|
|
|
@ -65,6 +65,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="deleteButton">
|
<widget class="QPushButton" name="deleteButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Löschen</string>
|
<string>Löschen</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Reference in a new issue