Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
This commit is contained in:
+44
-2
@@ -24,6 +24,7 @@ public:
|
||||
:ITableModel(parent)
|
||||
{
|
||||
filtered = false;
|
||||
m_checkboxSelect = false;
|
||||
}
|
||||
|
||||
virtual ~AutoTableModel() {}
|
||||
@@ -50,6 +51,21 @@ public:
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.column() == 0 && m_checkboxSelect)
|
||||
{
|
||||
if (role == Qt::CheckStateRole)
|
||||
{
|
||||
if (m_selectedRows.contains(index.row()))
|
||||
{
|
||||
return Qt::Checked;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Qt::Unchecked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QSharedPointer<T> entity = m_list.at(index.row());
|
||||
QObject *rawEntity = (QObject*)entity.data();
|
||||
|
||||
@@ -189,6 +205,21 @@ public:
|
||||
m_translations = translations;
|
||||
}
|
||||
|
||||
QList<int> selectedRows() const
|
||||
{
|
||||
return m_selectedRows;
|
||||
}
|
||||
|
||||
QList<QSharedPointer<T> > selectedItems()
|
||||
{
|
||||
QList<QSharedPointer<T> > ret;
|
||||
foreach (int row, m_selectedRows) {
|
||||
ret.append(m_list[row]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected:
|
||||
void handleFilter(const QString &filter) override
|
||||
{
|
||||
@@ -220,10 +251,10 @@ protected:
|
||||
private:
|
||||
QList<QSharedPointer<T> > m_list;
|
||||
QList<QSharedPointer<T> > m_fullList;
|
||||
QList<int> m_selectedRows;
|
||||
QMap<QString, QString> m_translations;
|
||||
bool filtered;
|
||||
|
||||
|
||||
// QAbstractItemModel interface
|
||||
public:
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override
|
||||
@@ -236,10 +267,21 @@ public:
|
||||
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), value);
|
||||
}
|
||||
|
||||
if (role == Qt::CheckStateRole)
|
||||
{
|
||||
if (m_selectedRows.contains(index.row()))
|
||||
{
|
||||
m_selectedRows.removeOne(index.row());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_selectedRows.append(index.row());
|
||||
}
|
||||
}
|
||||
|
||||
emit editCompleted();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // ODBTABLEMODEL_H
|
||||
|
||||
|
||||
@@ -65,6 +65,10 @@ void Context::loadPlugins()
|
||||
m_plugins.append(plugin);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << pluginLoader.errorString();
|
||||
}
|
||||
}
|
||||
|
||||
QString dbPath = m_settings->value("db/path", "").toString();
|
||||
|
||||
@@ -3,7 +3,17 @@
|
||||
ITableModel::ITableModel(QObject *parent)
|
||||
:QAbstractTableModel(parent)
|
||||
{
|
||||
m_checkboxSelect = false;
|
||||
}
|
||||
|
||||
bool ITableModel::checkboxSelect() const
|
||||
{
|
||||
return m_checkboxSelect;
|
||||
}
|
||||
|
||||
void ITableModel::setCheckboxSelect(bool checkboxSelect)
|
||||
{
|
||||
m_checkboxSelect = checkboxSelect;
|
||||
}
|
||||
|
||||
void ITableModel::filter(const QString &filter)
|
||||
@@ -18,6 +28,11 @@ void ITableModel::restore()
|
||||
|
||||
Qt::ItemFlags ITableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (index.column() == 0 && m_checkboxSelect)
|
||||
{
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled;
|
||||
}
|
||||
|
||||
if (m_editableCols.contains(index.column()))
|
||||
{
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
protected:
|
||||
virtual void handleFilter(const QString &filter) = 0;
|
||||
virtual void handleRestore() = 0;
|
||||
bool m_checkboxSelect;
|
||||
|
||||
public slots:
|
||||
void filter(const QString &filter);
|
||||
@@ -29,6 +30,9 @@ public:
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
void setEditableCols(const QList<int> cols);
|
||||
|
||||
bool checkboxSelect() const;
|
||||
void setCheckboxSelect(bool checkboxSelect);
|
||||
|
||||
private:
|
||||
QList<int> m_editableCols;
|
||||
};
|
||||
|
||||
@@ -126,86 +126,132 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="20"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="33"/>
|
||||
<source>Base settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="121"/>
|
||||
<source>Company info</source>
|
||||
<translation>Informace o společnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="29"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="130"/>
|
||||
<source>IC</source>
|
||||
<translation>IČO</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="39"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="140"/>
|
||||
<source>VAT number</source>
|
||||
<translation>DIČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="49"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="150"/>
|
||||
<source>VAT payer</source>
|
||||
<translation>Plátce DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="62"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="163"/>
|
||||
<source>VAT rates</source>
|
||||
<translation>Sazby DPH</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="68"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="169"/>
|
||||
<source>High</source>
|
||||
<translation>Vysoká</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="82"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="183"/>
|
||||
<source>First lower</source>
|
||||
<translation>První snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="96"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="197"/>
|
||||
<source>Second lower</source>
|
||||
<translation>Druhá snížená</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="116"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="218"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="279"/>
|
||||
<source>Number series</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="247"/>
|
||||
<source>Edit name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="258"/>
|
||||
<source>Season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="265"/>
|
||||
<source>Create new</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="39"/>
|
||||
<source>Contact</source>
|
||||
<translation>Kontaktní údaje</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="122"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="45"/>
|
||||
<source>Firm Name</source>
|
||||
<translation>Název společnosti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="132"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="55"/>
|
||||
<source>Street</source>
|
||||
<translation>Ulice</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="142"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="65"/>
|
||||
<source>House Number</source>
|
||||
<translation>Číslo popisné</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="152"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="75"/>
|
||||
<source>City</source>
|
||||
<translation>Město</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="162"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="85"/>
|
||||
<source>ZIP code</source>
|
||||
<translation>PSČ</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="175"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="181"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="98"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="104"/>
|
||||
<source>Logo</source>
|
||||
<translation>Logo</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.ui" line="188"/>
|
||||
<location filename="../settings/globalsettingsform.ui" line="111"/>
|
||||
<source>Select file</source>
|
||||
<translation>Vyber soubor</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="77"/>
|
||||
<source>Switch season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="77"/>
|
||||
<source>Realy switch active season?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="138"/>
|
||||
<source>New season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/globalsettingsform.cpp" line="138"/>
|
||||
<source>Realy create new season and switch to it?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GridForm</name>
|
||||
@@ -314,6 +360,19 @@
|
||||
<translation>Název filtru</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SeasonNameDialog</name>
|
||||
<message>
|
||||
<location filename="../settings/seasonnamedialog.ui" line="14"/>
|
||||
<source>Season</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../settings/seasonnamedialog.ui" line="23"/>
|
||||
<source>Season name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsForm</name>
|
||||
<message>
|
||||
|
||||
Reference in New Issue
Block a user