Compare commits
No commits in common. "42c5f35576f2fd741390d4006ced09842ad522f9" and "5de88ef7a9e532771db78b3bc18dc233ba25081d" have entirely different histories.
42c5f35576
...
5de88ef7a9
6 changed files with 10 additions and 49 deletions
|
@ -6,22 +6,12 @@
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
|
||||||
#include <QItemSelectionModel>
|
|
||||||
|
|
||||||
constexpr int STATUSBAR_TIMEOUT = 5000;
|
constexpr int STATUSBAR_TIMEOUT = 5000;
|
||||||
|
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
{
|
{
|
||||||
ui_.setupUi(this);
|
ui_.setupUi(this);
|
||||||
|
|
||||||
marketplace_ = std::make_unique<Marketplace>();
|
|
||||||
marketplace_->loadFromDb();
|
|
||||||
statusBar()->showMessage("Gespeicherte Daten wurden geladen.", STATUSBAR_TIMEOUT);
|
|
||||||
|
|
||||||
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_.actionQuit, &QAction::triggered, qApp, QApplication::quit);
|
||||||
connect(ui_.actionEditSeller, &QAction::triggered, this,
|
connect(ui_.actionEditSeller, &QAction::triggered, this,
|
||||||
&MainWindow::on_actionEditSeller_triggered);
|
&MainWindow::on_actionEditSeller_triggered);
|
||||||
|
@ -29,8 +19,13 @@ MainWindow::MainWindow()
|
||||||
&MainWindow::on_sellerNoEdit_checkSellerNo);
|
&MainWindow::on_sellerNoEdit_checkSellerNo);
|
||||||
connect(ui_.paidButton, &QPushButton::clicked, this, &MainWindow::on_paidButton_triggered);
|
connect(ui_.paidButton, &QPushButton::clicked, this, &MainWindow::on_paidButton_triggered);
|
||||||
|
|
||||||
connect(ui_.basketView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
|
marketplace_ = std::make_unique<Marketplace>();
|
||||||
&MainWindow::onBasketViewSelectionChanged);
|
marketplace_->loadFromDb();
|
||||||
|
statusBar()->showMessage("Gespeicherte Daten wurden geladen.", STATUSBAR_TIMEOUT);
|
||||||
|
|
||||||
|
BasketModel* model = new BasketModel(getMarketplace(), ui_.basketView);
|
||||||
|
ui_.basketView->setModel(model);
|
||||||
|
ui_.basketView->setColumnHidden(0, true); // hide the uuid
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionEditSeller_triggered()
|
void MainWindow::on_actionEditSeller_triggered()
|
||||||
|
@ -91,13 +86,3 @@ void MainWindow::on_sellerNoEdit_checkSellerNo()
|
||||||
|
|
||||||
ui_.sellerNoEdit->clear();
|
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,10 +17,6 @@ class MainWindow : public QMainWindow
|
||||||
MainWindow();
|
MainWindow();
|
||||||
Marketplace* getMarketplace() { return marketplace_.get(); }
|
Marketplace* getMarketplace() { return marketplace_.get(); }
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onBasketViewSelectionChanged(const QItemSelection& selected,
|
|
||||||
const QItemSelection& deselected);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void on_actionEditSeller_triggered();
|
void on_actionEditSeller_triggered();
|
||||||
void on_sellerNoEdit_checkSellerNo();
|
void on_sellerNoEdit_checkSellerNo();
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cancelArticleButton">
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -204,9 +204,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="cancleAllArticlesButton">
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Alles stornieren</string>
|
<string>Alles stornieren</string>
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
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);
|
||||||
|
@ -17,8 +16,6 @@ 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()
|
||||||
|
@ -76,13 +73,3 @@ 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,10 +15,6 @@ 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,9 +65,6 @@
|
||||||
</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