Added setting for hide control for item count on shop form.
This commit is contained in:
@@ -20,6 +20,8 @@ ShopSettings::ShopSettings(QObject *parent) : QObject(parent)
|
||||
m_defaultVat = Enums::NONE;
|
||||
|
||||
m_doublePrint = false;
|
||||
|
||||
m_showCount = true;
|
||||
}
|
||||
|
||||
QString ShopSettings::output() const
|
||||
@@ -231,3 +233,13 @@ void ShopSettings::setDefaultVat(const Enums::VatType &defaultVat)
|
||||
{
|
||||
m_defaultVat = defaultVat;
|
||||
}
|
||||
|
||||
bool ShopSettings::showCount() const
|
||||
{
|
||||
return m_showCount;
|
||||
}
|
||||
|
||||
void ShopSettings::setShowCount(bool showCount)
|
||||
{
|
||||
m_showCount = showCount;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ class ShopSettings : public QObject
|
||||
|
||||
Q_PROPERTY(Enums::VatType defaultVat READ defaultVat WRITE setDefaultVat)
|
||||
|
||||
Q_PROPERTY(bool showCount READ showCount WRITE setShowCount)
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -105,6 +107,9 @@ public:
|
||||
Enums::VatType defaultVat() const;
|
||||
void setDefaultVat(const Enums::VatType &defaultVat);
|
||||
|
||||
bool showCount() const;
|
||||
void setShowCount(bool showCount);
|
||||
|
||||
private:
|
||||
QString m_output;
|
||||
CODEPAGE m_codepage;
|
||||
@@ -132,6 +137,8 @@ private:
|
||||
QString m_roundingItem;
|
||||
|
||||
Enums::VatType m_defaultVat;
|
||||
|
||||
bool m_showCount;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<ShopSettings> ShopSettingsPtr;
|
||||
|
||||
@@ -48,6 +48,8 @@ ShopSettingsForm::ShopSettingsForm(QWidget *parent) :
|
||||
registerBinding(ui->doublePrint);
|
||||
registerBinding(ui->doublePrintItem);
|
||||
|
||||
registerBinding(ui->showCount);
|
||||
|
||||
QList<ComboData> listVatTypes;
|
||||
listVatTypes
|
||||
<< ComboData(Enums::NONE, tr("None"))
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -355,6 +355,13 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="showCount">
|
||||
<property name="text">
|
||||
<string>Show field for item count</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
+2
-3
@@ -32,9 +32,8 @@ QWidget *Shop::ui()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qobject_cast<ShopForm*>(uiWidget)->loadLast();
|
||||
qobject_cast<ShopForm*>(uiWidget)->fillRaceiptCombo();
|
||||
qobject_cast<ShopForm*>(uiWidget)->loadButtons();
|
||||
qobject_cast<ShopForm*>(uiWidget)->setupForm();
|
||||
|
||||
return uiWidget;
|
||||
}
|
||||
|
||||
|
||||
+14
-4
@@ -155,11 +155,8 @@ void ShopForm::loadLast()
|
||||
}
|
||||
}
|
||||
|
||||
void ShopForm::loadButtons()
|
||||
void ShopForm::loadButtons(const ShopSettingsPtr& settings)
|
||||
{
|
||||
SettingsService srv("SHOP");
|
||||
ShopSettingsPtr settings = srv.loadSettings<ShopSettings>();
|
||||
|
||||
Service<FavoritItem> srvFav;
|
||||
QMap<QString, FavoritItemPtr> btnMap;
|
||||
|
||||
@@ -234,6 +231,19 @@ void ShopForm::setEetStatusText(const QString &statusText)
|
||||
ui->lblEetState->setText(statusText);
|
||||
}
|
||||
|
||||
void ShopForm::setupForm()
|
||||
{
|
||||
SettingsService srv("SHOP");
|
||||
ShopSettingsPtr settings = srv.loadSettings<ShopSettings>();
|
||||
|
||||
ui->spnCount->setVisible(settings->showCount());
|
||||
ui->lblCount->setVisible(settings->showCount());
|
||||
|
||||
loadLast();
|
||||
fillRaceiptCombo();
|
||||
loadButtons(settings);
|
||||
}
|
||||
|
||||
void ShopForm::on_directSale_clicked()
|
||||
{
|
||||
SettingsService srv("SHOP");
|
||||
|
||||
+6
-3
@@ -5,6 +5,7 @@
|
||||
#include <QList>
|
||||
#include "data/shop-data.h"
|
||||
#include <autotablemodel.h>
|
||||
#include "settings/shopsettings.h"
|
||||
|
||||
class ShopItem;
|
||||
class IShopItem;
|
||||
@@ -20,10 +21,9 @@ class ShopForm : public QWidget
|
||||
public:
|
||||
explicit ShopForm(QWidget *parent = 0);
|
||||
~ShopForm();
|
||||
void loadLast();
|
||||
void loadButtons();
|
||||
void fillRaceiptCombo();
|
||||
|
||||
void setEetStatusText(const QString &statusText);
|
||||
void setupForm();
|
||||
|
||||
private slots:
|
||||
void on_directSale_clicked();
|
||||
@@ -57,6 +57,9 @@ private:
|
||||
AutoTableModel<ShopItem> *m_commodityModel;
|
||||
bool m_itemFound;
|
||||
|
||||
void loadLast();
|
||||
void loadButtons(const ShopSettingsPtr& settings);
|
||||
void fillRaceiptCombo();
|
||||
void createVoucher();
|
||||
void doTempSave(bool comboChanged);
|
||||
void changeReceipt();
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@
|
||||
<widget class="QWidget" name="widget_8" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="lblCount">
|
||||
<property name="text">
|
||||
<string>Count</string>
|
||||
</property>
|
||||
|
||||
Reference in New Issue
Block a user