enable/disable button
This commit is contained in:
parent
5de88ef7a9
commit
609003fc06
3 changed files with 28 additions and 9 deletions
|
@ -6,19 +6,14 @@
|
|||
|
||||
#include <regex>
|
||||
|
||||
#include <QItemSelectionModel>
|
||||
|
||||
constexpr int STATUSBAR_TIMEOUT = 5000;
|
||||
|
||||
MainWindow::MainWindow()
|
||||
{
|
||||
ui_.setupUi(this);
|
||||
|
||||
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::quit);
|
||||
connect(ui_.actionEditSeller, &QAction::triggered, this,
|
||||
&MainWindow::on_actionEditSeller_triggered);
|
||||
connect(ui_.sellerNoEdit, &QLineEdit::returnPressed, this,
|
||||
&MainWindow::on_sellerNoEdit_checkSellerNo);
|
||||
connect(ui_.paidButton, &QPushButton::clicked, this, &MainWindow::on_paidButton_triggered);
|
||||
|
||||
marketplace_ = std::make_unique<Marketplace>();
|
||||
marketplace_->loadFromDb();
|
||||
statusBar()->showMessage("Gespeicherte Daten wurden geladen.", STATUSBAR_TIMEOUT);
|
||||
|
@ -26,6 +21,16 @@ MainWindow::MainWindow()
|
|||
BasketModel* model = new BasketModel(getMarketplace(), ui_.basketView);
|
||||
ui_.basketView->setModel(model);
|
||||
ui_.basketView->setColumnHidden(0, true); // hide the uuid
|
||||
|
||||
connect(ui_.actionQuit, &QAction::triggered, qApp, QApplication::quit);
|
||||
connect(ui_.actionEditSeller, &QAction::triggered, this,
|
||||
&MainWindow::on_actionEditSeller_triggered);
|
||||
connect(ui_.sellerNoEdit, &QLineEdit::returnPressed, this,
|
||||
&MainWindow::on_sellerNoEdit_checkSellerNo);
|
||||
connect(ui_.paidButton, &QPushButton::clicked, this, &MainWindow::on_paidButton_triggered);
|
||||
|
||||
connect(ui_.basketView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
||||
&MainWindow::onBasketViewSelectionChanged);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEditSeller_triggered()
|
||||
|
@ -86,3 +91,13 @@ void MainWindow::on_sellerNoEdit_checkSellerNo()
|
|||
|
||||
ui_.sellerNoEdit->clear();
|
||||
}
|
||||
|
||||
void MainWindow::onBasketViewSelectionChanged(const QItemSelection& selected,
|
||||
[[maybe_unused]] const QItemSelection& deselected)
|
||||
{
|
||||
if (selected.size() > 0) {
|
||||
ui_.cancelArticleButton->setEnabled(true);
|
||||
} else {
|
||||
ui_.cancelArticleButton->setEnabled(false);
|
||||
}
|
||||
}
|
|
@ -17,6 +17,10 @@ class MainWindow : public QMainWindow
|
|||
MainWindow();
|
||||
Marketplace* getMarketplace() { return marketplace_.get(); }
|
||||
|
||||
private slots:
|
||||
void onBasketViewSelectionChanged(const QItemSelection& selected,
|
||||
const QItemSelection& deselected);
|
||||
|
||||
private:
|
||||
void on_actionEditSeller_triggered();
|
||||
void on_sellerNoEdit_checkSellerNo();
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<widget class="QPushButton" name="cancelArticleButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -204,7 +204,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<widget class="QPushButton" name="cancleAllArticlesButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
|
Loading…
Reference in a new issue