diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a6ea03698..56ff39aca 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -39,4 +39,4 @@ jobs:
- name: Run clazy
uses: ./.github/actions/run-linter
with:
- lint_program_with_args: clazy-standalone --checks=level1,no-fully-qualified-moc-types,no-non-pod-global-static,no-qstring-arg,no-qproperty-without-notify,no-range-loop-detach,no-lambda-unique-connection
+ lint_program_with_args: clazy-standalone --checks=level1,no-fully-qualified-moc-types,no-non-pod-global-static,no-qstring-arg,no-qproperty-without-notify,no-range-loop-detach,no-lambda-unique-connection,no-qstring-ref
diff --git a/libqf/libqfcore/CMakeLists.txt b/libqf/libqfcore/CMakeLists.txt
index 6bdab83fb..7501d285f 100644
--- a/libqf/libqfcore/CMakeLists.txt
+++ b/libqf/libqfcore/CMakeLists.txt
@@ -5,11 +5,6 @@ add_library(libqfcore SHARED
src/core/stacktrace.cpp
src/core/string.cpp
src/core/utils.cpp
- src/model/datadocument.cpp
- src/model/logtablemodel.cpp
- src/model/sqldatadocument.cpp
- src/model/sqltablemodel.cpp
- src/model/tablemodel.cpp
src/network/networkaccessmanager.cpp
src/network/networkreply.cpp
src/sql/catalog.cpp
diff --git a/libqf/libqfcore/src/core/utils.cpp b/libqf/libqfcore/src/core/utils.cpp
index 5e62a301e..5b591a1f6 100644
--- a/libqf/libqfcore/src/core/utils.cpp
+++ b/libqf/libqfcore/src/core/utils.cpp
@@ -9,12 +9,6 @@
namespace qf::core {
-const QString& Utils::nullValueString()
-{
- static QString n = QStringLiteral("null");
- return n;
-}
-
void qf::core::Utils::parseFieldName(const QString &full_field_name, QString *pfield_name, QString *ptable_name, QString *pdb_name)
{
QString s = full_field_name;
@@ -269,6 +263,9 @@ QStringList Utils::parseProgramAndArgumentsList(const QString &command_line)
QVariant Utils::jsonToQVariant(const QString &json)
{
+ if (json.isEmpty()) {
+ return {};
+ }
QJsonParseError error;
auto doc = QJsonDocument::fromJson(json.toUtf8(), &error);
if (error.error != QJsonParseError::NoError) {
diff --git a/libqf/libqfcore/src/core/utils.h b/libqf/libqfcore/src/core/utils.h
index 8f1633edb..68adb2599 100644
--- a/libqf/libqfcore/src/core/utils.h
+++ b/libqf/libqfcore/src/core/utils.h
@@ -156,7 +156,6 @@ namespace core {
class QFCORE_DECL_EXPORT Utils
{
public:
- static const QString &nullValueString();
static void parseFieldName(const QString& full_field_name, QString *pfield_name = nullptr, QString *ptable_name = nullptr, QString *pdb_name = nullptr);
static QString composeFieldName(const QString &field_name, const QString &table_name = QString(), const QString &db_name = QString());
/// @returns: True if @a field_name1 ends with @a field_name2. Comparision is case insensitive
diff --git a/libqf/libqfcore/src/sql/connection.cpp b/libqf/libqfcore/src/sql/connection.cpp
index 9f827224a..11a9b232b 100644
--- a/libqf/libqfcore/src/sql/connection.cpp
+++ b/libqf/libqfcore/src/sql/connection.cpp
@@ -87,9 +87,11 @@ void Connection::close()
Connection Connection::forName(const QString &connection_name)
{
QString cn = connection_name;
- if(cn.isEmpty())
+ if(cn.isEmpty()) {
cn = QSqlDatabase::defaultConnection;
- Connection ret(QSqlDatabase::database(cn, false));
+ }
+ auto db = QSqlDatabase::database(cn, false);
+ Connection ret(db);
return ret;
}
diff --git a/libqf/libqfqmlwidgets/CMakeLists.txt b/libqf/libqfqmlwidgets/CMakeLists.txt
index 726da81f1..28ddb9c22 100644
--- a/libqf/libqfqmlwidgets/CMakeLists.txt
+++ b/libqf/libqfqmlwidgets/CMakeLists.txt
@@ -7,6 +7,13 @@ add_library(libqfqmlwidgets SHARED
src/dateedit.cpp
src/datetimeedit.cpp
src/dialogbuttonbox.cpp
+
+ src/model/datadocument.cpp
+ src/model/logtablemodel.cpp
+ src/model/sqldatadocument.cpp
+ src/model/sqltablemodel.cpp
+ src/model/tablemodel.cpp
+
src/dialogs/dialog.cpp
src/dialogs/filedialog.cpp
src/dialogs/getiteminputdialog.cpp
@@ -98,8 +105,10 @@ add_library(libqfqmlwidgets SHARED
src/timeedit.cpp
src/toolbar.cpp
style/qf_qmlwidgets_style.qrc
+
images/qf_qmlwidgets_images.qrc
images/flat/qf_qmlwidgets_images_flat.qrc
+ images/dark/qf_qmlwidgets_images_dark.qrc
src/reports/widgets/printtableviewwidget/reports/qf_qmlwidgets_printtablewidget_reports.qrc
)
diff --git a/libqf/libqfqmlwidgets/images/dark/clone-row.svg b/libqf/libqfqmlwidgets/images/dark/clone-row.svg
new file mode 100644
index 000000000..dcc039720
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/clone-row.svg
@@ -0,0 +1,68 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/copy.svg b/libqf/libqfqmlwidgets/images/dark/copy.svg
new file mode 100644
index 000000000..dbfda77b5
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/copy.svg
@@ -0,0 +1,59 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/cut.svg b/libqf/libqfqmlwidgets/images/dark/cut.svg
new file mode 100644
index 000000000..1d9551ada
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/cut.svg
@@ -0,0 +1,60 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/delete-column.svg b/libqf/libqfqmlwidgets/images/dark/delete-column.svg
new file mode 100644
index 000000000..06dabb9bf
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/delete-column.svg
@@ -0,0 +1,66 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/delete-row.svg b/libqf/libqfqmlwidgets/images/dark/delete-row.svg
new file mode 100644
index 000000000..a5780ec4c
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/delete-row.svg
@@ -0,0 +1,65 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/delete.svg b/libqf/libqfqmlwidgets/images/dark/delete.svg
new file mode 100644
index 000000000..aacf76fd4
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/delete.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/down.svg b/libqf/libqfqmlwidgets/images/dark/down.svg
new file mode 100644
index 000000000..b41df834f
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/down.svg
@@ -0,0 +1,56 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/find.svg b/libqf/libqfqmlwidgets/images/dark/find.svg
new file mode 100644
index 000000000..a8253e7ab
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/find.svg
@@ -0,0 +1,57 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/home.svg b/libqf/libqfqmlwidgets/images/dark/home.svg
new file mode 100644
index 000000000..3d7aac369
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/home.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/insert-column.svg b/libqf/libqfqmlwidgets/images/dark/insert-column.svg
new file mode 100644
index 000000000..6558fe049
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/insert-column.svg
@@ -0,0 +1,63 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/insert-row.svg b/libqf/libqfqmlwidgets/images/dark/insert-row.svg
new file mode 100644
index 000000000..ceb1857d0
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/insert-row.svg
@@ -0,0 +1,63 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/left.svg b/libqf/libqfqmlwidgets/images/dark/left.svg
new file mode 100644
index 000000000..9d9e0f7c5
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/left.svg
@@ -0,0 +1,56 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-pause.svg b/libqf/libqfqmlwidgets/images/dark/media-pause.svg
new file mode 100644
index 000000000..0fc5cd17d
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-pause.svg
@@ -0,0 +1,39 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-play.svg b/libqf/libqfqmlwidgets/images/dark/media-play.svg
new file mode 100644
index 000000000..f4e9c6c6d
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-play.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-record.svg b/libqf/libqfqmlwidgets/images/dark/media-record.svg
new file mode 100644
index 000000000..a9db4e83a
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-record.svg
@@ -0,0 +1,39 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-skip-backward.svg b/libqf/libqfqmlwidgets/images/dark/media-skip-backward.svg
new file mode 100644
index 000000000..9a90de2e5
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-skip-backward.svg
@@ -0,0 +1,38 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-skip-forward.svg b/libqf/libqfqmlwidgets/images/dark/media-skip-forward.svg
new file mode 100644
index 000000000..5b1bb0e74
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-skip-forward.svg
@@ -0,0 +1,38 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-step-backward.svg b/libqf/libqfqmlwidgets/images/dark/media-step-backward.svg
new file mode 100644
index 000000000..b03ef89e0
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-step-backward.svg
@@ -0,0 +1,47 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-step-forward.svg b/libqf/libqfqmlwidgets/images/dark/media-step-forward.svg
new file mode 100644
index 000000000..82bf89945
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-step-forward.svg
@@ -0,0 +1,47 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/media-stop.svg b/libqf/libqfqmlwidgets/images/dark/media-stop.svg
new file mode 100644
index 000000000..5ecfe9d64
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/media-stop.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/menu.svg b/libqf/libqfqmlwidgets/images/dark/menu.svg
new file mode 100644
index 000000000..6572dfc9c
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/menu.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/new.svg b/libqf/libqfqmlwidgets/images/dark/new.svg
new file mode 100644
index 000000000..4552f293f
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/new.svg
@@ -0,0 +1,54 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/open.svg b/libqf/libqfqmlwidgets/images/dark/open.svg
new file mode 100644
index 000000000..c38436459
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/open.svg
@@ -0,0 +1,55 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/paste.svg b/libqf/libqfqmlwidgets/images/dark/paste.svg
new file mode 100644
index 000000000..49c5e7153
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/paste.svg
@@ -0,0 +1,61 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/printer.svg b/libqf/libqfqmlwidgets/images/dark/printer.svg
new file mode 100644
index 000000000..979e7b0fc
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/printer.svg
@@ -0,0 +1,59 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/qf_qmlwidgets_images_dark.qrc b/libqf/libqfqmlwidgets/images/dark/qf_qmlwidgets_images_dark.qrc
new file mode 100644
index 000000000..4d8871627
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/qf_qmlwidgets_images_dark.qrc
@@ -0,0 +1,40 @@
+
+
+ home.svg
+ new.svg
+ open.svg
+ save.svg
+ reload.svg
+ revert.svg
+ delete.svg
+ find.svg
+ sort-asc.svg
+ sort-desc.svg
+ insert-row.svg
+ insert-column.svg
+ clone-row.svg
+ delete-row.svg
+ delete-column.svg
+ copy.svg
+ cut.svg
+ paste.svg
+ printer.svg
+ settings.svg
+ left.svg
+ right.svg
+ up.svg
+ down.svg
+ menu.svg
+ zoom_fitall.svg
+ zoom_fitwidth.svg
+ zoom_fitheight.svg
+ media-pause.svg
+ media-play.svg
+ media-record.svg
+ media-skip-backward.svg
+ media-skip-forward.svg
+ media-step-backward.svg
+ media-step-forward.svg
+ media-stop.svg
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/reload.svg b/libqf/libqfqmlwidgets/images/dark/reload.svg
new file mode 100644
index 000000000..3332d7d0c
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/reload.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/revert.svg b/libqf/libqfqmlwidgets/images/dark/revert.svg
new file mode 100644
index 000000000..daa54b040
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/revert.svg
@@ -0,0 +1,62 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/right.svg b/libqf/libqfqmlwidgets/images/dark/right.svg
new file mode 100644
index 000000000..d45e9fa91
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/right.svg
@@ -0,0 +1,86 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/save.svg b/libqf/libqfqmlwidgets/images/dark/save.svg
new file mode 100644
index 000000000..6ed35b326
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/save.svg
@@ -0,0 +1,121 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/settings.svg b/libqf/libqfqmlwidgets/images/dark/settings.svg
new file mode 100644
index 000000000..ec2aa8575
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/settings.svg
@@ -0,0 +1,66 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/sort-asc.svg b/libqf/libqfqmlwidgets/images/dark/sort-asc.svg
new file mode 100644
index 000000000..06716ba50
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/sort-asc.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/sort-desc.svg b/libqf/libqfqmlwidgets/images/dark/sort-desc.svg
new file mode 100644
index 000000000..c272e952b
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/sort-desc.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/up.svg b/libqf/libqfqmlwidgets/images/dark/up.svg
new file mode 100644
index 000000000..0aa13f6d1
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/up.svg
@@ -0,0 +1,56 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/zoom_fitall.svg b/libqf/libqfqmlwidgets/images/dark/zoom_fitall.svg
new file mode 100644
index 000000000..4e132b3ff
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/zoom_fitall.svg
@@ -0,0 +1,87 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/zoom_fitheight.svg b/libqf/libqfqmlwidgets/images/dark/zoom_fitheight.svg
new file mode 100644
index 000000000..9c0c9b2e0
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/zoom_fitheight.svg
@@ -0,0 +1,71 @@
+
+
+
+
diff --git a/libqf/libqfqmlwidgets/images/dark/zoom_fitwidth.svg b/libqf/libqfqmlwidgets/images/dark/zoom_fitwidth.svg
new file mode 100644
index 000000000..a80a7394d
--- /dev/null
+++ b/libqf/libqfqmlwidgets/images/dark/zoom_fitwidth.svg
@@ -0,0 +1,71 @@
+
+
+
+
diff --git a/libqf/libqfcore/include/qf/core/model/datadocument.h b/libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/datadocument.h
similarity index 100%
rename from libqf/libqfcore/include/qf/core/model/datadocument.h
rename to libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/datadocument.h
diff --git a/libqf/libqfcore/include/qf/core/model/logtablemodel.h b/libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/logtablemodel.h
similarity index 100%
rename from libqf/libqfcore/include/qf/core/model/logtablemodel.h
rename to libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/logtablemodel.h
diff --git a/libqf/libqfcore/include/qf/core/model/sqldatadocument.h b/libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/sqldatadocument.h
similarity index 100%
rename from libqf/libqfcore/include/qf/core/model/sqldatadocument.h
rename to libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/sqldatadocument.h
diff --git a/libqf/libqfcore/include/qf/core/model/sqltablemodel.h b/libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/sqltablemodel.h
similarity index 100%
rename from libqf/libqfcore/include/qf/core/model/sqltablemodel.h
rename to libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/sqltablemodel.h
diff --git a/libqf/libqfcore/include/qf/core/model/tablemodel.h b/libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/tablemodel.h
similarity index 100%
rename from libqf/libqfcore/include/qf/core/model/tablemodel.h
rename to libqf/libqfqmlwidgets/include/qf/qmlwidgets/model/tablemodel.h
diff --git a/libqf/libqfqmlwidgets/src/combobox.cpp b/libqf/libqfqmlwidgets/src/combobox.cpp
index b6a8dfee4..2f09ca494 100644
--- a/libqf/libqfqmlwidgets/src/combobox.cpp
+++ b/libqf/libqfqmlwidgets/src/combobox.cpp
@@ -259,7 +259,7 @@ void DbEnumComboBox::loadItems(bool force)
QColor c = dbe.color();
if(c.isValid()) {
setItemData(count() - 1, c, Qt::BackgroundRole);
- setItemData(count() - 1, qf::core::model::TableModel::contrastTextColor(c), Qt::ForegroundRole);
+ setItemData(count() - 1, qf::qmlwidgets::model::TableModel::contrastTextColor(c), Qt::ForegroundRole);
}
}
}
diff --git a/libqf/libqfqmlwidgets/src/datacontroller.cpp b/libqf/libqfqmlwidgets/src/datacontroller.cpp
index 2dc73625b..4feba93db 100644
--- a/libqf/libqfqmlwidgets/src/datacontroller.cpp
+++ b/libqf/libqfqmlwidgets/src/datacontroller.cpp
@@ -15,20 +15,20 @@ DataController::DataController(QObject *parent)
DataController::~DataController()
= default;
-qf::core::model::DataDocument *DataController::document(bool throw_exc) const
+qf::qmlwidgets::model::DataDocument *DataController::document(bool throw_exc) const
{
if(!m_document && throw_exc)
QF_EXCEPTION("DataDocument is NULL!");
return m_document;
}
-void DataController::setDocument(qf::core::model::DataDocument *doc)
+void DataController::setDocument(qf::qmlwidgets::model::DataDocument *doc)
{
if(m_document != doc) {
m_document = doc;
- connect(doc, &qf::core::model::DataDocument::loaded, this, &DataController::documentLoaded);
- connect(doc, &qf::core::model::DataDocument::valueChanged, this, &DataController::documentValueChanged);
- connect(doc, &qf::core::model::DataDocument::aboutToSave, this, &DataController::documentAboutToSave);
+ connect(doc, &qf::qmlwidgets::model::DataDocument::loaded, this, &DataController::documentLoaded);
+ connect(doc, &qf::qmlwidgets::model::DataDocument::valueChanged, this, &DataController::documentValueChanged);
+ connect(doc, &qf::qmlwidgets::model::DataDocument::aboutToSave, this, &DataController::documentAboutToSave);
emit documentChanged(doc);
}
}
diff --git a/libqf/libqfqmlwidgets/src/datacontroller.h b/libqf/libqfqmlwidgets/src/datacontroller.h
index b8edc21e9..c82669189 100644
--- a/libqf/libqfqmlwidgets/src/datacontroller.h
+++ b/libqf/libqfqmlwidgets/src/datacontroller.h
@@ -2,9 +2,9 @@
#define QF_QMLWIDGETS_DATACONTROLLER_H
#include "qmlwidgetsglobal.h"
+#include "model/datadocument.h"
#include
-#include
#include
#include
@@ -17,7 +17,7 @@ class IDataWidget;
class QFQMLWIDGETS_DECL_EXPORT DataController : public QObject
{
Q_OBJECT
- Q_PROPERTY(qf::core::model::DataDocument* document READ document WRITE setDocument NOTIFY documentChanged)
+ Q_PROPERTY(qf::qmlwidgets::model::DataDocument* document READ document WRITE setDocument NOTIFY documentChanged)
Q_PROPERTY(QWidget* widget READ widget WRITE setWidget NOTIFY widgetChanged)
//Q_PROPERTY(QString dbConnectionName READ dbConnectionName WRITE setDbConnectionName)
public:
@@ -26,9 +26,9 @@ class QFQMLWIDGETS_DECL_EXPORT DataController : public QObject
//QF_PROPERTY_IMPL2(QString, d, D, bConnectionName, QSqlDatabase::defaultConnection)
- qf::core::model::DataDocument* document(bool throw_exc = qf::core::Exception::Throw) const;
- void setDocument(qf::core::model::DataDocument *doc);
- Q_SIGNAL void documentChanged(qf::core::model::DataDocument *doc);
+ qf::qmlwidgets::model::DataDocument* document(bool throw_exc = qf::core::Exception::Throw) const;
+ void setDocument(qf::qmlwidgets::model::DataDocument *doc);
+ Q_SIGNAL void documentChanged(qf::qmlwidgets::model::DataDocument *doc);
QWidget* widget() const { return m_dataWidgetsParent;}
void setWidget(QWidget *w)
@@ -49,7 +49,7 @@ class QFQMLWIDGETS_DECL_EXPORT DataController : public QObject
Q_SLOT void documentValueChanged(const QString &data_id, const QVariant &old_val, const QVariant &new_val);
Q_SLOT void documentAboutToSave();
protected:
- qf::core::model::DataDocument *m_document = nullptr;
+ qf::qmlwidgets::model::DataDocument *m_document = nullptr;
QWidget *m_dataWidgetsParent = nullptr;
QList m_dataWidgets;
};
diff --git a/libqf/libqfqmlwidgets/src/dialogs/dialog.cpp b/libqf/libqfqmlwidgets/src/dialogs/dialog.cpp
index fc943f3c4..7321f815b 100644
--- a/libqf/libqfqmlwidgets/src/dialogs/dialog.cpp
+++ b/libqf/libqfqmlwidgets/src/dialogs/dialog.cpp
@@ -133,7 +133,7 @@ void Dialog::setRecordEditMode(int mode)
if(m_dialogButtonBox) {
auto bt_save = m_dialogButtonBox->button(QDialogButtonBox::Save);
if(bt_save) {
- if(mode == qf::core::model::DataDocument::ModeDelete) {
+ if(mode == qf::qmlwidgets::model::DataDocument::ModeDelete) {
bt_save->setText(tr("Delete"));
}
else {
diff --git a/libqf/libqfqmlwidgets/src/dialogs/internal/captionframe.cpp b/libqf/libqfqmlwidgets/src/dialogs/internal/captionframe.cpp
index 78cace2d1..c562530e7 100644
--- a/libqf/libqfqmlwidgets/src/dialogs/internal/captionframe.cpp
+++ b/libqf/libqfqmlwidgets/src/dialogs/internal/captionframe.cpp
@@ -4,7 +4,7 @@
#include "../../style.h"
#include
-#include
+#include
#include
#include
@@ -95,7 +95,7 @@ QIcon CaptionFrame::createIcon()
void CaptionFrame::setRecordEditMode(int mode)
{
- qfLogFuncFrame() << "mode:" << qf::core::model::DataDocument::recordEditModeToString(qf::core::model::DataDocument::RecordEditMode(mode));
+ qfLogFuncFrame() << "mode:" << qf::qmlwidgets::model::DataDocument::recordEditModeToString(qf::qmlwidgets::model::DataDocument::RecordEditMode(mode));
m_recordEditMode = mode;
update();
}
@@ -105,12 +105,12 @@ void CaptionFrame::update()
qfLogFuncFrame() << "text:" << text();
QString label_text = text();
if(m_recordEditMode >= 0) {
- auto mode = qf::core::model::DataDocument::RecordEditMode(m_recordEditMode);
- if(mode == qf::core::model::DataDocument::ModeDelete) {
+ auto mode = qf::qmlwidgets::model::DataDocument::RecordEditMode(m_recordEditMode);
+ if(mode == qf::qmlwidgets::model::DataDocument::ModeDelete) {
label_text = tr("Delete ") + label_text;
setAlert(true);
}
- else if(mode == qf::core::model::DataDocument::ModeEdit) {
+ else if(mode == qf::qmlwidgets::model::DataDocument::ModeEdit) {
label_text = tr("Edit ") + label_text;
}
}
diff --git a/libqf/libqfqmlwidgets/src/exportcsvtableviewwidget.cpp b/libqf/libqfqmlwidgets/src/exportcsvtableviewwidget.cpp
index 202b5b294..57454f8cd 100644
--- a/libqf/libqfqmlwidgets/src/exportcsvtableviewwidget.cpp
+++ b/libqf/libqfqmlwidgets/src/exportcsvtableviewwidget.cpp
@@ -1,8 +1,7 @@
#include "exportcsvtableviewwidget.h"
#include "ui_exporttableviewwidget.h"
-#include
-
+#include
namespace qf::qmlwidgets {
diff --git a/libqf/libqfqmlwidgets/src/framework/datadialogwidget.cpp b/libqf/libqfqmlwidgets/src/framework/datadialogwidget.cpp
index a7206c05d..151c063f6 100644
--- a/libqf/libqfqmlwidgets/src/framework/datadialogwidget.cpp
+++ b/libqf/libqfqmlwidgets/src/framework/datadialogwidget.cpp
@@ -1,10 +1,10 @@
#include "datadialogwidget.h"
#include "../dialogs/dialog.h"
-#include
+#include
#include
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
using namespace qf::qmlwidgets::framework;
DataDialogWidget::DataDialogWidget(QWidget *parent)
@@ -28,7 +28,7 @@ void DataDialogWidget::setDataController(qf::qmlwidgets::DataController *dc)
m_dataController = dc;
}
-qf::core::model::DataDocument *DataDialogWidget::dataDocument(bool throw_exc)
+qf::qmlwidgets::model::DataDocument *DataDialogWidget::dataDocument(bool throw_exc)
{
qf::qmlwidgets::DataController *dc = dataController();
return dc->document(throw_exc);
@@ -36,13 +36,10 @@ qf::core::model::DataDocument *DataDialogWidget::dataDocument(bool throw_exc)
bool DataDialogWidget::load(const QVariant &id, int mode)
{
- core::model::DataDocument *doc = dataDocument(!qf::core::Exception::Throw);
+ auto *doc = dataDocument(!qf::core::Exception::Throw);
if(doc) {
- //connect(doc, &qfm::DataDocument::saved, this, &DataDialogWidget::dataSaved, Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));
- //qfInfo() << "============" << (bool)c;
connect(doc, &qfm::DataDocument::saved, this, &DataDialogWidget::dataSaved, Qt::UniqueConnection);
- bool ok = doc->load(id, qf::core::model::DataDocument::RecordEditMode(mode));
- //qfInfo() << "emit ...";
+ bool ok = doc->load(id, qf::qmlwidgets::model::DataDocument::RecordEditMode(mode));
if(ok)
emit recordEditModeChanged(mode);
return ok;
@@ -56,12 +53,12 @@ bool DataDialogWidget::acceptDialogDone(int result)
bool ret = true;
if(result == qf::qmlwidgets::dialogs::Dialog::ResultAccept) {
auto mode = recordEditMode();
- if(mode == qf::core::model::DataDocument::ModeDelete) {
+ if(mode == qf::qmlwidgets::model::DataDocument::ModeDelete) {
ret = dropData();
}
- else if(mode == qf::core::model::DataDocument::ModeEdit
- || mode == qf::core::model::DataDocument::ModeInsert
- || mode == qf::core::model::DataDocument::ModeCopy) {
+ else if(mode == qf::qmlwidgets::model::DataDocument::ModeEdit
+ || mode == qf::qmlwidgets::model::DataDocument::ModeInsert
+ || mode == qf::qmlwidgets::model::DataDocument::ModeCopy) {
ret = saveData();
}
}
diff --git a/libqf/libqfqmlwidgets/src/framework/datadialogwidget.h b/libqf/libqfqmlwidgets/src/framework/datadialogwidget.h
index 1dea10058..e0b69b49f 100644
--- a/libqf/libqfqmlwidgets/src/framework/datadialogwidget.h
+++ b/libqf/libqfqmlwidgets/src/framework/datadialogwidget.h
@@ -5,7 +5,7 @@
#include "../datacontroller.h"
#include "dialogwidget.h"
-#include
+#include "../model/datadocument.h"
namespace qf {
namespace qmlwidgets {
@@ -24,9 +24,9 @@ class QFQMLWIDGETS_DECL_EXPORT DataDialogWidget : public DialogWidget
qf::qmlwidgets::DataController *dataController();
void setDataController(qf::qmlwidgets::DataController *dc);
- core::model::DataDocument* dataDocument(bool throw_exc = qf::core::Exception::Throw);
+ qf::qmlwidgets::model::DataDocument* dataDocument(bool throw_exc = qf::core::Exception::Throw);
- Q_SLOT virtual bool load(const QVariant &id = QVariant(), int mode = qf::core::model::DataDocument::ModeEdit);
+ Q_SLOT virtual bool load(const QVariant &id = QVariant(), int mode = qf::qmlwidgets::model::DataDocument::ModeEdit);
bool acceptDialogDone(int result) Q_DECL_OVERRIDE;
diff --git a/libqf/libqfqmlwidgets/src/framework/logwidget.cpp b/libqf/libqfqmlwidgets/src/framework/logwidget.cpp
index 6d07036c4..54ad1e894 100644
--- a/libqf/libqfqmlwidgets/src/framework/logwidget.cpp
+++ b/libqf/libqfqmlwidgets/src/framework/logwidget.cpp
@@ -7,7 +7,7 @@
#include
#include
#include
-#include
+#include
#include
#include
@@ -18,9 +18,7 @@
#include
#include
-namespace qfm = qf::core::model;
-
-
+namespace qfm = qf::qmlwidgets::model;
namespace qf::qmlwidgets::framework {
@@ -100,7 +98,7 @@ LogWidget::LogWidget(QWidget *parent)
{
auto *a = new QAction(tr("Maximal log length"), this);
connect(a, &QAction::triggered, this, [this]() {
- qf::core::model::LogTableModel *m = this->logTableModel();
+ qf::qmlwidgets::model::LogTableModel *m = this->logTableModel();
int max_rows = m->maximumRowCount();
bool ok;
max_rows = QInputDialog::getInt(this, tr("Get number"), tr("Maximal log row count:"), max_rows, 0, std::numeric_limits::max(), 100, &ok);
@@ -147,13 +145,13 @@ void LogWidget::clear()
m_logTableModel->clear();
}
-void LogWidget::setLogTableModel(core::model::LogTableModel *m)
+void LogWidget::setLogTableModel(qmlwidgets::model::LogTableModel *m)
{
if(m_logTableModel != m) {
m_logTableModel = m;
m_filterModel->setSourceModel(m_logTableModel);
if(m_logTableModel) {
- connect(m_logTableModel, &core::model::LogTableModel::logEntryInserted, this, &LogWidget::checkScrollToLastEntry, Qt::UniqueConnection);
+ connect(m_logTableModel, &qmlwidgets::model::LogTableModel::logEntryInserted, this, &LogWidget::checkScrollToLastEntry, Qt::UniqueConnection);
QScrollBar *sb = ui->tableView->verticalScrollBar();
if(sb)
connect(sb, &QScrollBar::valueChanged, this, &LogWidget::onVerticalScrollBarValueChanged, Qt::UniqueConnection);
@@ -172,7 +170,7 @@ void LogWidget::addLogEntry(const qf::core::LogEntryMap &le)
addLog(le.level(), le.category(), le.file(), le.line(), le.message(), le.timeStamp(), le.function());
}
-qf::core::model::LogTableModel *LogWidget::logTableModel()
+qf::qmlwidgets::model::LogTableModel *LogWidget::logTableModel()
{
if(!m_logTableModel) {
auto *m = new qfm::LogTableModel(this);
@@ -223,7 +221,7 @@ bool LogWidget::isAutoScroll()
{
QScrollBar *sb = ui->tableView->verticalScrollBar();
if(sb) {
- if(logTableModel()->direction() == qf::core::model::LogTableModel::Direction::AppendToBottom) {
+ if(logTableModel()->direction() == qf::qmlwidgets::model::LogTableModel::Direction::AppendToBottom) {
//fprintf(stderr, "BOTTOM scrollbar min: %d max: %d value: %d\n", sb->minimum(), sb->maximum(), sb->value());
return (sb->value() == sb->maximum());
}
@@ -355,7 +353,7 @@ void LogWidget::checkScrollToLastEntry()
ui->tableView->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
}
if(isAutoScroll()) {
- if(logTableModel()->direction() == qf::core::model::LogTableModel::Direction::AppendToBottom) {
+ if(logTableModel()->direction() == qf::qmlwidgets::model::LogTableModel::Direction::AppendToBottom) {
ui->tableView->scrollToBottom();
}
else {
diff --git a/libqf/libqfqmlwidgets/src/framework/logwidget.h b/libqf/libqfqmlwidgets/src/framework/logwidget.h
index e8978ff3b..497535c7b 100644
--- a/libqf/libqfqmlwidgets/src/framework/logwidget.h
+++ b/libqf/libqfqmlwidgets/src/framework/logwidget.h
@@ -9,16 +9,10 @@
class QAbstractButton;
-namespace qf {
-namespace core {
-class LogEntryMap;
-namespace model { class LogTableModel; }
-}
-}
+namespace qf::core { class LogEntryMap; }
+namespace qf::qmlwidgets::model { class LogTableModel; }
-namespace qf {
-namespace qmlwidgets {
-namespace framework {
+namespace qf::qmlwidgets::framework {
class LogFilterProxyModel;
@@ -54,8 +48,8 @@ class QFQMLWIDGETS_DECL_EXPORT LogWidget : public qf::qmlwidgets::framework::Doc
Q_SLOT void checkScrollToLastEntry();
void clear();
- virtual void setLogTableModel(qf::core::model::LogTableModel *m);
- qf::core::model::LogTableModel* logTableModel();
+ virtual void setLogTableModel(qf::qmlwidgets::model::LogTableModel *m);
+ qf::qmlwidgets::model::LogTableModel* logTableModel();
Q_SIGNAL void severityTresholdChanged(NecroLog::Level lvl);
void setSeverityTreshold(NecroLog::Level lvl);
@@ -80,7 +74,7 @@ class QFQMLWIDGETS_DECL_EXPORT LogWidget : public qf::qmlwidgets::framework::Doc
bool isAutoScroll();
protected:
- qf::core::model::LogTableModel* m_logTableModel = nullptr;
+ qf::qmlwidgets::model::LogTableModel* m_logTableModel = nullptr;
LogFilterProxyModel* m_filterModel = nullptr;
private:
Ui::LogWidget *ui;
@@ -91,8 +85,6 @@ class QFQMLWIDGETS_DECL_EXPORT LogWidget : public qf::qmlwidgets::framework::Doc
bool m_columnsResized = false;
};
+}
-} // namespace framework
-} // namespace qmlwiggets
-} // namespace qf
#endif // QF_QMLWIDGETS_FRAMEWORK_LOGWIDGET_H
diff --git a/libqf/libqfqmlwidgets/src/idatawidget.cpp b/libqf/libqfqmlwidgets/src/idatawidget.cpp
index 67d37cab0..236f71a7d 100644
--- a/libqf/libqfqmlwidgets/src/idatawidget.cpp
+++ b/libqf/libqfqmlwidgets/src/idatawidget.cpp
@@ -2,11 +2,12 @@
#include "datacontroller.h"
-#include
+#include
#include
-namespace qfm = qf::core::model;
-using namespace qf::qmlwidgets;
+namespace qfm = qf::qmlwidgets::model;
+
+namespace qf::qmlwidgets {
IDataWidget::IDataWidget(QWidget *data_widget)
: m_dataWidget(data_widget)
@@ -69,3 +70,4 @@ bool IDataWidget::checkSetDataValueFirstTime()
return false;
}
+}
diff --git a/libqf/libqfqmlwidgets/src/idatawidget.h b/libqf/libqfqmlwidgets/src/idatawidget.h
index 438817028..6d4344ea9 100644
--- a/libqf/libqfqmlwidgets/src/idatawidget.h
+++ b/libqf/libqfqmlwidgets/src/idatawidget.h
@@ -3,6 +3,8 @@
#include "qmlwidgetsglobal.h"
+#include "model/datadocument.h"
+
#include
#include
@@ -41,7 +43,7 @@ class QFQMLWIDGETS_DECL_EXPORT IDataWidget
QWidget* dataWidget() {return m_dataWidget;}
protected:
- qf::core::model::DataDocument* dataDocument(bool throw_exc = qf::core::Exception::Throw);
+ qf::qmlwidgets::model::DataDocument* dataDocument(bool throw_exc = qf::core::Exception::Throw);
bool checkSetDataValueFirstTime();
protected:
QPointer m_dataController;
diff --git a/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.cpp b/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.cpp
index a363a39f1..5a5458816 100644
--- a/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.cpp
+++ b/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.cpp
@@ -1,7 +1,7 @@
#include "tableviewchoosecolumnswidget.h"
#include "ui_tableviewchoosecolumnswidget.h"
-#include
+#include
#include
#include
@@ -42,7 +42,7 @@ TableViewChooseColumnsWidget::~TableViewChooseColumnsWidget()
delete ui;
}
-void TableViewChooseColumnsWidget::loadColumns(qf::core::model::TableModel *model)
+void TableViewChooseColumnsWidget::loadColumns(qf::qmlwidgets::model::TableModel *model)
{
if(model) {
{
diff --git a/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.h b/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.h
index d28a4c5b0..4676e886d 100644
--- a/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.h
+++ b/libqf/libqfqmlwidgets/src/internal/tableviewchoosecolumnswidget.h
@@ -2,20 +2,13 @@
#define QF_QMLWIDGETS_INTERNAL_TABLEVIEWCHOOSECOLUMNSWIDGET_H
#include
-//#include
class QStandardItemModel;
-namespace qf {
-namespace core {
-namespace model {
-class TableModel;
-}
-}
+namespace qf::qmlwidgets::model { class TableModel; }
-namespace qmlwidgets {
-namespace internal {
+namespace qf::qmlwidgets::internal {
namespace Ui {
class TableViewChooseColumnsWidget;
@@ -30,7 +23,7 @@ class TableViewChooseColumnsWidget : public QWidget
protected:
QStandardItemModel *f_exportedColumnsModel;
public:
- void loadColumns(qf::core::model::TableModel *model);
+ void loadColumns(qf::qmlwidgets::model::TableModel *model);
protected slots:
void onColumnsAllClicked();
void onColumnsNoneClicked();
@@ -47,7 +40,7 @@ protected slots:
Ui::TableViewChooseColumnsWidget *ui;
};
-}}}
+}
#endif // QF_QMLWIDGETS_INTERNAL_TABLEVIEWCHOOSECOLUMNSWIDGET_H
diff --git a/libqf/libqfqmlwidgets/src/internal/tableviewcopytodialogwidget.cpp b/libqf/libqfqmlwidgets/src/internal/tableviewcopytodialogwidget.cpp
index ee038879f..dafeb7c91 100644
--- a/libqf/libqfqmlwidgets/src/internal/tableviewcopytodialogwidget.cpp
+++ b/libqf/libqfqmlwidgets/src/internal/tableviewcopytodialogwidget.cpp
@@ -3,9 +3,9 @@
#include "../tableview.h"
#include
-#include
+#include
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
using namespace qf::qmlwidgets::internal;
TableViewCopyToDialogWidget::TableViewCopyToDialogWidget(QWidget *parent)
diff --git a/libqf/libqfcore/src/model/datadocument.cpp b/libqf/libqfqmlwidgets/src/model/datadocument.cpp
similarity index 98%
rename from libqf/libqfcore/src/model/datadocument.cpp
rename to libqf/libqfqmlwidgets/src/model/datadocument.cpp
index 188bb5030..81952d399 100644
--- a/libqf/libqfcore/src/model/datadocument.cpp
+++ b/libqf/libqfqmlwidgets/src/model/datadocument.cpp
@@ -1,10 +1,11 @@
#include "datadocument.h"
-#include "../core/log.h"
-#include "../core/assert.h"
-#include "../utils/table.h"
+#include
-using namespace qf::core::model;
+#include
+#include
+
+namespace qf::qmlwidgets::model {
DataDocument::DataDocument(QObject *parent)
: QObject(parent)
@@ -311,3 +312,4 @@ bool DataDocument::copyData()
return model()->prepareForCopyRow(ix);
}
+}
diff --git a/libqf/libqfcore/src/model/datadocument.h b/libqf/libqfqmlwidgets/src/model/datadocument.h
similarity index 88%
rename from libqf/libqfcore/src/model/datadocument.h
rename to libqf/libqfqmlwidgets/src/model/datadocument.h
index 59ddcd767..fb43c0dd0 100644
--- a/libqf/libqfcore/src/model/datadocument.h
+++ b/libqf/libqfqmlwidgets/src/model/datadocument.h
@@ -1,21 +1,19 @@
-#ifndef QF_CORE_MODEL_DATADOCUMENT_H
-#define QF_CORE_MODEL_DATADOCUMENT_H
+#pragma once
-#include "../core/coreglobal.h"
#include "tablemodel.h"
#include
#include
namespace qf {
-namespace core {
+namespace qmlwidgets {
namespace model {
-class QFCORE_DECL_EXPORT DataDocument : public QObject
+class QFQMLWIDGETS_DECL_EXPORT DataDocument : public QObject
{
Q_OBJECT
- Q_PROPERTY(qf::core::model::DataDocument::RecordEditMode mode READ mode WRITE setMode NOTIFY modeChanged)
- Q_PROPERTY(qf::core::model::TableModel* model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(qf::qmlwidgets::model::DataDocument::RecordEditMode mode READ mode WRITE setMode NOTIFY modeChanged)
+ Q_PROPERTY(qf::qmlwidgets::model::TableModel* model READ model WRITE setModel NOTIFY modelChanged)
Q_PROPERTY(QVariant dataId READ dataId WRITE setDataId NOTIFY dataIdChanged)
Q_PROPERTY(QString idFieldName READ idFieldName WRITE setIdFieldName NOTIFY idFieldNameChanged)
public:
@@ -94,4 +92,3 @@ class QFCORE_DECL_EXPORT DataDocument : public QObject
}}}
-#endif // QF_CORE_MODEL_DATADOCUMENT_H
diff --git a/libqf/libqfcore/src/model/logtablemodel.cpp b/libqf/libqfqmlwidgets/src/model/logtablemodel.cpp
similarity index 96%
rename from libqf/libqfcore/src/model/logtablemodel.cpp
rename to libqf/libqfqmlwidgets/src/model/logtablemodel.cpp
index 36583b401..08516d9c7 100644
--- a/libqf/libqfcore/src/model/logtablemodel.cpp
+++ b/libqf/libqfqmlwidgets/src/model/logtablemodel.cpp
@@ -1,14 +1,14 @@
#include "logtablemodel.h"
-#include "../core/logentrymap.h"
-#include "../core/log.h"
+#include
+#include
#include
#include
Q_DECLARE_METATYPE(NecroLog::Level)
-namespace qf::core::model {
+namespace qf::qmlwidgets::model {
LogTableModel::Row::Row(NecroLog::Level severity, const QString &domain, const QString &file, int line, const QString &msg, const QDateTime &time_stamp, const QString &function, const QVariant &user_data)
{
@@ -135,7 +135,7 @@ LogTableModel::Row LogTableModel::rowAt(int row) const
return m_rows.value(row);
}
-void LogTableModel::addLogEntry(const LogEntryMap &le)
+void LogTableModel::addLogEntry(const qf::core::LogEntryMap &le)
{
addLog(le.level(), le.category(), le.file(), le.line(), le.message(), le.timeStamp(), le.function());
}
diff --git a/libqf/libqfcore/src/model/logtablemodel.h b/libqf/libqfqmlwidgets/src/model/logtablemodel.h
similarity index 81%
rename from libqf/libqfcore/src/model/logtablemodel.h
rename to libqf/libqfqmlwidgets/src/model/logtablemodel.h
index c98de5492..89107c195 100644
--- a/libqf/libqfcore/src/model/logtablemodel.h
+++ b/libqf/libqfqmlwidgets/src/model/logtablemodel.h
@@ -1,26 +1,28 @@
-#ifndef QF_CORE_MODEL_LOGTABLEMODEL_H
-#define QF_CORE_MODEL_LOGTABLEMODEL_H
+#pragma once
-#include "../core/coreglobal.h"
-#include "../core/utils.h"
+#include "../qmlwidgetsglobal.h"
+
+#include
+#include
#include
#include
+namespace qf::core { class LogEntryMap; }
+
namespace qf {
-namespace core {
-class LogEntryMap;
+namespace qmlwidgets {
namespace model {
-class QFCORE_DECL_EXPORT LogTableModel : public QAbstractTableModel
+class QFQMLWIDGETS_DECL_EXPORT LogTableModel : public QAbstractTableModel
{
Q_OBJECT
private:
using Super = QAbstractTableModel;
public:
enum Cols {TimeStamp, Severity, Category, Message, File, Line, Function, UserData, Count};
- class QFCORE_DECL_EXPORT Row {
+ class QFQMLWIDGETS_DECL_EXPORT Row {
public:
explicit Row() {}
explicit Row(NecroLogLevel severity, const QString& domain, const QString& file, int line, const QString& msg, const QDateTime& time_stamp, const QString& function = QString(), const QVariant &user_data = QVariant());
@@ -45,7 +47,7 @@ class QFCORE_DECL_EXPORT LogTableModel : public QAbstractTableModel
virtual void clear();
Row rowAt(int row) const;
- Q_SLOT void addLogEntry(const qf::core::LogEntryMap &le);
+ Q_SLOT void addLogEntry(const core::LogEntryMap &le);
void addLog(NecroLogLevel severity, const QString& category, const QString &file, int line, const QString& msg, const QDateTime& time_stamp, const QString &function = QString(), const QVariant &user_data = QVariant());
void addRow(const Row &row);
Q_SIGNAL void logEntryInserted(int row_no);
@@ -57,4 +59,3 @@ class QFCORE_DECL_EXPORT LogTableModel : public QAbstractTableModel
}}}
-#endif // QF_CORE_MODEL_LOGTABLEMODEL_H
diff --git a/libqf/libqfcore/src/model/sqldatadocument.cpp b/libqf/libqfqmlwidgets/src/model/sqldatadocument.cpp
similarity index 95%
rename from libqf/libqfcore/src/model/sqldatadocument.cpp
rename to libqf/libqfqmlwidgets/src/model/sqldatadocument.cpp
index 9d476fec6..f9f6dc742 100644
--- a/libqf/libqfcore/src/model/sqldatadocument.cpp
+++ b/libqf/libqfqmlwidgets/src/model/sqldatadocument.cpp
@@ -1,7 +1,8 @@
#include "sqldatadocument.h"
-#include "../core/assert.h"
-using namespace qf::core::model;
+#include
+
+namespace qf::qmlwidgets::model {
SqlDataDocument::SqlDataDocument(QObject *parent)
: Super(parent)
@@ -68,3 +69,4 @@ bool SqlDataDocument::loadData()
return ret;
}
+}
diff --git a/libqf/libqfcore/src/model/sqldatadocument.h b/libqf/libqfqmlwidgets/src/model/sqldatadocument.h
similarity index 79%
rename from libqf/libqfcore/src/model/sqldatadocument.h
rename to libqf/libqfqmlwidgets/src/model/sqldatadocument.h
index 6c056ac96..e725d9c90 100644
--- a/libqf/libqfcore/src/model/sqldatadocument.h
+++ b/libqf/libqfqmlwidgets/src/model/sqldatadocument.h
@@ -1,14 +1,13 @@
-#ifndef QF_CORE_MODEL_SQLDATADOCUMENT_H
-#define QF_CORE_MODEL_SQLDATADOCUMENT_H
+#pragma once
#include "datadocument.h"
#include "sqltablemodel.h"
namespace qf {
-namespace core {
+namespace qmlwidgets {
namespace model {
-class QFCORE_DECL_EXPORT SqlDataDocument : public DataDocument
+class QFQMLWIDGETS_DECL_EXPORT SqlDataDocument : public DataDocument
{
Q_OBJECT
public:
@@ -38,4 +37,3 @@ class QFCORE_DECL_EXPORT SqlDataDocument : public DataDocument
}}}
-#endif // QF_CORE_MODEL_SQLDATADOCUMENT_H
diff --git a/libqf/libqfcore/src/model/sqltablemodel.cpp b/libqf/libqfqmlwidgets/src/model/sqltablemodel.cpp
similarity index 97%
rename from libqf/libqfcore/src/model/sqltablemodel.cpp
rename to libqf/libqfqmlwidgets/src/model/sqltablemodel.cpp
index 4d574ae84..7dcd9bbf3 100644
--- a/libqf/libqfcore/src/model/sqltablemodel.cpp
+++ b/libqf/libqfqmlwidgets/src/model/sqltablemodel.cpp
@@ -1,11 +1,12 @@
#include "sqltablemodel.h"
-#include "../core/assert.h"
-#include "../core/utils.h"
-#include "../core/exception.h"
-#include "../sql/connection.h"
-#include "../sql/dbenum.h"
-#include "../sql/dbenumcache.h"
-#include "../sql/query.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
#include
#include
@@ -18,7 +19,7 @@
namespace qfs = qf::core::sql;
namespace qfu = qf::core::utils;
-using namespace qf::core::model;
+namespace qf::qmlwidgets::model {
SqlTableModel::SqlTableModel(QObject *parent)
: Super(parent)
@@ -38,9 +39,9 @@ QVariant SqlTableModel::data(const QModelIndex &index, int role) const
QString group_name = props.groupName();
if(!group_name.isEmpty()) {
QVariant v = data(index, Qt::EditRole);
- sql::DbEnumCache& db_enum_cache = qf::core::sql::DbEnumCache::instanceForConnection(connectionName());
+ qf::core::sql::DbEnumCache& db_enum_cache = qf::core::sql::DbEnumCache::instanceForConnection(connectionName());
QString group_id = v.toString();
- sql::DbEnum dbe = db_enum_cache.dbEnum(group_name, group_id);
+ qf::core::sql::DbEnum dbe = db_enum_cache.dbEnum(group_name, group_id);
QString caption_format = props.captionFormat();
QString caption = dbe.fillInPlaceholders(caption_format);
return caption;
@@ -57,8 +58,8 @@ QVariant SqlTableModel::data(const QModelIndex &index, int role) const
QVariant v = data(index, Qt::EditRole);
QString group_id = v.toString();
if(!group_id.isEmpty()) {
- sql::DbEnumCache& db_enum_cache = qf::core::sql::DbEnumCache::instanceForConnection(connectionName());
- sql::DbEnum dbe = db_enum_cache.dbEnum(group_name, group_id);
+ qf::core::sql::DbEnumCache& db_enum_cache = qf::core::sql::DbEnumCache::instanceForConnection(connectionName());
+ qf::core::sql::DbEnum dbe = db_enum_cache.dbEnum(group_name, group_id);
QColor color = dbe.color();
if(color.isValid())
return color;
@@ -699,7 +700,7 @@ QString compose_table_id(const QString &table_name, const QString &schema_name)
}
}
-QStringList SqlTableModel::tableIds(const qf::core::utils::Table::FieldList &table_fields)
+QStringList SqlTableModel::tableIds(const core::utils::Table::FieldList &table_fields)
{
QStringList ret;
int fld_cnt = table_fields.count();
@@ -863,3 +864,4 @@ QStringList SqlTableModel::tableIdsSortedAccordingToForeignKeys()
return ret;
}
+}
diff --git a/libqf/libqfcore/src/model/sqltablemodel.h b/libqf/libqfqmlwidgets/src/model/sqltablemodel.h
similarity index 90%
rename from libqf/libqfcore/src/model/sqltablemodel.h
rename to libqf/libqfqmlwidgets/src/model/sqltablemodel.h
index e9c52828e..a7727b7c7 100644
--- a/libqf/libqfcore/src/model/sqltablemodel.h
+++ b/libqf/libqfqmlwidgets/src/model/sqltablemodel.h
@@ -1,21 +1,23 @@
-#ifndef QF_CORE_MODEL_SQLTABLEMODEL_H
-#define QF_CORE_MODEL_SQLTABLEMODEL_H
+#pragma once
#include "tablemodel.h"
-#include "../core/utils.h"
-#include "../sql/querybuilder.h"
+
+#include
+#include
+#include
+#include
#include
#include
namespace qf {
-namespace core {
+namespace qmlwidgets {
namespace sql {
class Connection;
}
namespace model {
-class QFCORE_DECL_EXPORT SqlTableModel : public TableModel
+class QFQMLWIDGETS_DECL_EXPORT SqlTableModel : public TableModel
{
Q_OBJECT
Q_PROPERTY(QString query READ query WRITE setQuery NOTIFY queryChanged)
@@ -79,7 +81,7 @@ class QFCORE_DECL_EXPORT SqlTableModel : public TableModel
bool reloadQuery(const QString &query_str);
virtual bool reloadTable(const QString &query_str);
- QStringList tableIds(const utils::Table::FieldList &table_fields);
+ QStringList tableIds(const qf::core::utils::Table::FieldList &table_fields);
void setSqlFlags(qf::core::utils::Table::FieldList &table_fields, const QString &query_str) const;
QSet referencedForeignTables();
@@ -99,4 +101,3 @@ class QFCORE_DECL_EXPORT SqlTableModel : public TableModel
}}}
-#endif // QF_CORE_MODEL_SQLTABLEMODEL_H
diff --git a/libqf/libqfcore/src/model/tablemodel.cpp b/libqf/libqfqmlwidgets/src/model/tablemodel.cpp
similarity index 98%
rename from libqf/libqfcore/src/model/tablemodel.cpp
rename to libqf/libqfqmlwidgets/src/model/tablemodel.cpp
index 05b12cf81..5e88d811e 100644
--- a/libqf/libqfcore/src/model/tablemodel.cpp
+++ b/libqf/libqfqmlwidgets/src/model/tablemodel.cpp
@@ -1,8 +1,10 @@
#include "tablemodel.h"
-#include "../core/log.h"
-#include "../core/assert.h"
-#include "../core/utils.h"
-#include "../utils/treetable.h"
+#include "../style.h"
+
+#include
+#include
+#include
+#include
#include
#include
@@ -13,7 +15,7 @@
namespace qfc = qf::core;
namespace qfu = qf::core::utils;
-using namespace qf::core::model;
+namespace qf::qmlwidgets::model {
//=========================================
// TableModel::ColumnDefinition
@@ -210,11 +212,14 @@ QVariant TableModel::data(const QModelIndex &index, int role) const
}
}
else if(role == Qt::ForegroundRole) {
+ static const auto blue_color = isDarkTheme()? QColor(0x99ccff): QColor(Qt::blue);
+
int type = columnType(index.column());
- if(type == QMetaType::QByteArray)
- return QColor(Qt::blue);
+ if(type == QMetaType::QByteArray) {
+ return blue_color;
+ }
if(data(index, ValueIsNullRole).toBool()) {
- return QColor(Qt::blue);
+ return blue_color;
}
ret = QVariant();
}
@@ -730,7 +735,7 @@ void TableModel::clearColumns(int new_column_count)
m_columnsAutoGenerated = false;
}
-qf::core::model::TableModel::ColumnDefinition& TableModel::addColumn(const QString &field_name, const QString &caption)
+qf::qmlwidgets::model::TableModel::ColumnDefinition& TableModel::addColumn(const QString &field_name, const QString &caption)
{
return insertColumn(m_columns.count(), field_name, caption);
}
@@ -937,3 +942,5 @@ TableModel::ColumnDefinition TableModel::columnDefinition(int ix) const
{
return m_columns.value(ix);
}
+
+}
diff --git a/libqf/libqfcore/src/model/tablemodel.h b/libqf/libqfqmlwidgets/src/model/tablemodel.h
similarity index 95%
rename from libqf/libqfcore/src/model/tablemodel.h
rename to libqf/libqfqmlwidgets/src/model/tablemodel.h
index 8999e801f..c9d425505 100644
--- a/libqf/libqfcore/src/model/tablemodel.h
+++ b/libqf/libqfqmlwidgets/src/model/tablemodel.h
@@ -1,14 +1,14 @@
-#ifndef QF_CORE_MODEL_TABLEMODEL_H
-#define QF_CORE_MODEL_TABLEMODEL_H
+#pragma once
-#include "../core/coreglobal.h"
-#include "../utils/table.h"
-#include "../core/utils.h"
+#include "../qmlwidgetsglobal.h"
+
+#include
+#include
#include
namespace qf {
-namespace core {
+namespace qmlwidgets {
namespace utils {
class TreeTable;
@@ -16,7 +16,7 @@ class TreeTable;
namespace model {
-class QFCORE_DECL_EXPORT TableModel : public QAbstractTableModel
+class QFQMLWIDGETS_DECL_EXPORT TableModel : public QAbstractTableModel
{
Q_OBJECT
Q_PROPERTY(bool nullReportedAsString READ isNullReportedAsString WRITE setNullReportedAsString NOTIFY nullReportedAsStringChanged)
@@ -32,7 +32,7 @@ class QFCORE_DECL_EXPORT TableModel : public QAbstractTableModel
FirstUnusedRole };
//enum RecordEditMode {ModeView, ModeEdit, ModeInsert, ModeCopy, ModeDelete};
public:
- class QFCORE_DECL_EXPORT ColumnDefinition
+ class QFQMLWIDGETS_DECL_EXPORT ColumnDefinition
{
private:
class SharedDummyHelper {};
@@ -186,7 +186,7 @@ class QFCORE_DECL_EXPORT TableModel : public QAbstractTableModel
qf::core::utils::TableRow& tableRowRef(int row_no);
qf::core::utils::TableRow tableRow(int row_no) const;
- class QFCORE_DECL_EXPORT TreeTableExportOptions : public QVariantMap
+ class QFQMLWIDGETS_DECL_EXPORT TreeTableExportOptions : public QVariantMap
{
QF_VARIANTMAP_FIELD2(bool, is, set, ExportRawValues, true)
public:
@@ -223,6 +223,5 @@ class QFCORE_DECL_EXPORT TableModel : public QAbstractTableModel
}}}
-Q_DECLARE_METATYPE(qf::core::model::TableModel::ColumnDefinition)
+Q_DECLARE_METATYPE(qf::qmlwidgets::model::TableModel::ColumnDefinition)
-#endif // QF_CORE_MODEL_TABLEMODEL_H
diff --git a/libqf/libqfqmlwidgets/src/reports/widgets/printtableviewwidget/printtableviewwidget.cpp b/libqf/libqfqmlwidgets/src/reports/widgets/printtableviewwidget/printtableviewwidget.cpp
index c3923b919..242f5d9fb 100644
--- a/libqf/libqfqmlwidgets/src/reports/widgets/printtableviewwidget/printtableviewwidget.cpp
+++ b/libqf/libqfqmlwidgets/src/reports/widgets/printtableviewwidget/printtableviewwidget.cpp
@@ -7,7 +7,6 @@
#include
-namespace qfc = qf::core;
namespace qfu = qf::core::utils;
using namespace qf::qmlwidgets::reports;
@@ -27,7 +26,7 @@ PrintTableViewWidget::PrintTableViewWidget(TableView *table_view, QWidget *paren
connect(cbx, &QComboBox::activated, this, &PrintTableViewWidget::onLstQrcReportsActivated);
}
- qfc::model::TableModel *model = table_view->tableModel();
+ auto *model = table_view->tableModel();
ui->columnsChooser->setVisible(model);
ui->columnsChooser->loadColumns(model);
diff --git a/libqf/libqfqmlwidgets/src/sqltableitemdelegate.cpp b/libqf/libqfqmlwidgets/src/sqltableitemdelegate.cpp
index 367e915e4..c23b1747f 100644
--- a/libqf/libqfqmlwidgets/src/sqltableitemdelegate.cpp
+++ b/libqf/libqfqmlwidgets/src/sqltableitemdelegate.cpp
@@ -1,7 +1,7 @@
#include "sqltableitemdelegate.h"
#include "tableview.h"
-#include
+#include
#include
#include
#include
@@ -27,13 +27,13 @@ QString SqlTableItemDelegate::displayText(const QVariant &value, const QLocale &
*/
QWidget *SqlTableItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- QVariant v = index.data(qf::core::model::TableModel::ColumnDefinitionRole);
- auto cd = v.value();
+ QVariant v = index.data(qf::qmlwidgets::model::TableModel::ColumnDefinitionRole);
+ auto cd = v.value();
if(cd.castType() == qMetaTypeId()) {
auto *editor = new QComboBox(parent);
- auto m = qobject_cast(view()->tableModel());
+ auto m = qobject_cast(view()->tableModel());
if(m) {
- qf::core::model::SqlTableModel::DbEnumCastProperties props(cd.castProperties());
+ qf::qmlwidgets::model::SqlTableModel::DbEnumCastProperties props(cd.castProperties());
qf::core::sql::DbEnumCache& db_enum_cache = qf::core::sql::DbEnumCache::instanceForConnection(m->connectionName());
Q_FOREACH(auto dbe, db_enum_cache.dbEnumsForGroup(props.groupName())) {
QString cap = dbe.fillInPlaceholders(props.captionFormat());
@@ -41,7 +41,7 @@ QWidget *SqlTableItemDelegate::createEditor(QWidget *parent, const QStyleOptionV
QColor c = dbe.color();
if(c.isValid()) {
editor->setItemData(editor->count() - 1, c, Qt::BackgroundRole);
- editor->setItemData(editor->count() - 1, qf::core::model::TableModel::contrastTextColor(c), Qt::ForegroundRole);
+ editor->setItemData(editor->count() - 1, qf::qmlwidgets::model::TableModel::contrastTextColor(c), Qt::ForegroundRole);
}
}
}
@@ -54,8 +54,8 @@ QWidget *SqlTableItemDelegate::createEditor(QWidget *parent, const QStyleOptionV
void SqlTableItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
- QVariant v = index.data(qf::core::model::TableModel::ColumnDefinitionRole);
- auto cd = v.value();
+ QVariant v = index.data(qf::qmlwidgets::model::TableModel::ColumnDefinitionRole);
+ auto cd = v.value();
if(cd.castType() == qMetaTypeId()) {
auto cbx = qobject_cast(editor);
if(cbx) {
@@ -72,8 +72,8 @@ void SqlTableItemDelegate::setEditorData(QWidget *editor, const QModelIndex &ind
void SqlTableItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
- QVariant v = index.data(qf::core::model::TableModel::ColumnDefinitionRole);
- auto cd = v.value();
+ QVariant v = index.data(qf::qmlwidgets::model::TableModel::ColumnDefinitionRole);
+ auto cd = v.value();
if(cd.castType() == qMetaTypeId()) {
auto cbx = qobject_cast(editor);
if(cbx) {
diff --git a/libqf/libqfqmlwidgets/src/style.cpp b/libqf/libqfqmlwidgets/src/style.cpp
index 5e3a71cfa..51ce03efb 100644
--- a/libqf/libqfqmlwidgets/src/style.cpp
+++ b/libqf/libqfqmlwidgets/src/style.cpp
@@ -8,8 +8,21 @@
#include
#include
#include
+#include
+#include
-using namespace qf::qmlwidgets;
+namespace qf::qmlwidgets {
+
+bool isDarkTheme()
+{
+ // MUST be called after QApplication instance is created
+ QColor window_color = QApplication::palette().color(QPalette::Window);
+ QColor text_color = QApplication::palette().color(QPalette::WindowText);
+ // qDebug() << "window:" << window_color << window_color.value() << colorDarknes(window_color);
+ // qDebug() << "text:" << text_color << text_color.value() << colorDarknes(text_color);
+ // Simple heuristic: if background is darker than text, assume dark theme
+ return window_color.value() < text_color.value();
+}
static const char *PROPERTY_STYLE_INSTANCE = "qf::qmlwidget::Style::instance";
@@ -125,18 +138,22 @@ QFileInfo Style::findFile(const QString &path, const QString &default_extension)
}
QFileInfo fi(fn);
if(fi.isAbsolute()) {
- if(fi.isReadable())
+ if(fi.isReadable()) {
return fi;
+ }
}
else {
for(const auto &prefix : m_iconSearchPaths) {
auto fn2 = prefix + '/' + fn;
QFileInfo fi2(fn2);
- //qfInfo() << "checking:" << fn2;
- if(fi2.isReadable())
+ // qfInfo() << "checking:" << fn2;
+ if(fi2.isReadable()) {
+ // qfInfo() << "\t\tHHIITT" << fn2;
return fi2;
+ }
}
}
return {};
}
+}
diff --git a/libqf/libqfqmlwidgets/src/style.h b/libqf/libqfqmlwidgets/src/style.h
index edc0200ca..6e3698e0d 100644
--- a/libqf/libqfqmlwidgets/src/style.h
+++ b/libqf/libqfqmlwidgets/src/style.h
@@ -13,6 +13,8 @@ class QFileInfo;
namespace qf {
namespace qmlwidgets {
+QFQMLWIDGETS_DECL_EXPORT bool isDarkTheme();
+
class QFQMLWIDGETS_DECL_EXPORT Style : public QObject
{
Q_OBJECT
diff --git a/libqf/libqfqmlwidgets/src/tableitemdelegate.cpp b/libqf/libqfqmlwidgets/src/tableitemdelegate.cpp
index 2d2c63703..dad4d9e74 100644
--- a/libqf/libqfqmlwidgets/src/tableitemdelegate.cpp
+++ b/libqf/libqfqmlwidgets/src/tableitemdelegate.cpp
@@ -1,5 +1,6 @@
#include "tableitemdelegate.h"
+#include "style.h"
#include "tableview.h"
#include
@@ -22,18 +23,6 @@ TableView * TableItemDelegate::view() const
void TableItemDelegate::paintBackground(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
- /**
- Protoze z nepochopitelnyho duvodu neni funkce drawBackground() virtualni, musim patchovat QItemDelegate::drawBackground() v QT, kdyz chci podsvitit aktivni radek
- qtitemdelegate.cpp:823
-
- #if 1/// QF_PATCH patch pro podsviceni radku se selekci
- QVariant value = index.data(Qt::BackgroundRole);
- if(!value.isValid()) value = property("qfSelectedRowHighlightColor");
- #else
- QVariant value = index.data(Qt::BackgroundRole);
- #endif
-
- */
TableView *v = view();
if(v) {
QModelIndex ix = v->currentIndex();
@@ -41,8 +30,8 @@ void TableItemDelegate::paintBackground(QPainter *painter, const QStyleOptionVie
/// fill current row background
/// da se to udelat i takhle bez patchovani QT
/// pozor, aby to fungovalo musi se jeste v TableView::currentChanged() volat updateRow() na radky u kterych se meni selekce
- static const QColor sel_row_background1(245, 245, 184);
- static const QColor sel_row_background2(210, 240, 184);
+ static const auto sel_row_background1 = isDarkTheme()? QColor(0x707010): QColor(245, 245, 184); // khaki
+ static const auto sel_row_background2 = isDarkTheme()? QColor(0x284125): QColor(245, 245, 184); // lime
painter->fillRect(option.rect, (v->inlineEditSaveStrategy() == TableView::OnEditedValueCommit)? sel_row_background2: sel_row_background1);
}
else {
@@ -50,7 +39,7 @@ void TableItemDelegate::paintBackground(QPainter *painter, const QStyleOptionVie
Qt::ItemFlags flags = index.flags();
//qfInfo() << "col:" << index.column() << "editable:" << f.contains(Qt::ItemIsEditable);
if(!(flags & Qt::ItemIsEditable)) {
- static const QColor ro_cell_background(0xeeeeff);
+ static const auto ro_cell_background = isDarkTheme()? QColor(0x00264d): QColor(0xeeeeff);
painter->fillRect(option.rect, ro_cell_background);
}
}
diff --git a/libqf/libqfqmlwidgets/src/tableview.cpp b/libqf/libqfqmlwidgets/src/tableview.cpp
index 098f78f48..731bdfde8 100644
--- a/libqf/libqfqmlwidgets/src/tableview.cpp
+++ b/libqf/libqfqmlwidgets/src/tableview.cpp
@@ -24,8 +24,8 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
#include
@@ -49,7 +49,7 @@
namespace qfc = qf::core;
namespace qfu = qf::core::utils;
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
using namespace qf::qmlwidgets;
TableView::TableView(QWidget *parent) :
@@ -155,19 +155,19 @@ void TableView::setModel(QAbstractItemModel *model)
Super::setModel(model);
}
-qf::core::model::TableModel *TableView::tableModel() const
+qf::qmlwidgets::model::TableModel *TableView::tableModel() const
{
- auto *ret = qobject_cast(lastProxyModel()->sourceModel());
+ auto *ret = qobject_cast(lastProxyModel()->sourceModel());
return ret;
}
-void TableView::setTableModel(core::model::TableModel *m)
+void TableView::setTableModel(qmlwidgets::model::TableModel *m)
{
- qf::core::model::TableModel *old_m = tableModel();
+ qf::qmlwidgets::model::TableModel *old_m = tableModel();
if (old_m != m) {
QAbstractProxyModel *pxm = lastProxyModel();
pxm->setSourceModel(m);
- m_proxyModel->setSortRole(qf::core::model::TableModel::SortRole);
+ m_proxyModel->setSortRole(qf::qmlwidgets::model::TableModel::SortRole);
if(pxm->columnCount() > 0) {
qfDebug() << persistentSettingsPath() << "Load persistent settings.";
// it does not make sense to load column widths unless we have table columns
@@ -182,7 +182,7 @@ void TableView::refreshActions()
{
qfLogFuncFrame() << "model:" << model();
enableAllActions(false);
- qfc::model::TableModel *m = tableModel();
+ auto *m = tableModel();
if(!m)
return;
action("filter")->setEnabled(true);
@@ -284,7 +284,7 @@ void TableView::reload(bool preserve_sorting)
sort_order = horizontalHeader()->sortIndicatorOrder();
horizontalHeader()->setSortIndicator(-1, Qt::AscendingOrder);
}
- qf::core::model::TableModel *table_model = tableModel();
+ qf::qmlwidgets::model::TableModel *table_model = tableModel();
if(table_model) {
QModelIndex ix = currentIndex();
int r = ix.row();
@@ -395,7 +395,7 @@ void TableView::cloneRowInline()
if(ix.row() < 0)
return;
int tri1 = toTableModelRowNo(ix.row());
- core::model::TableModel *tm = tableModel();
+ qmlwidgets::model::TableModel *tm = tableModel();
tm->cloneRow(tri1);
m_proxyModel->sort();
setCurrentIndex(m_proxyModel->index(ix.row() + 1, ix.column()));
@@ -451,7 +451,7 @@ bool TableView::postRowImpl(int row_no)
if(row_no < 0)
return false;
bool ret = false;
- qfc::model::TableModel *m = tableModel();
+ auto *m = tableModel();
if(m) {
ret = m->postRow(toTableModelRowNo(row_no), true);
if(ret)
@@ -480,7 +480,7 @@ void TableView::revertRow(int row_no)
row_no = currentIndex().row();
if(row_no < 0)
return;
- qfc::model::TableModel *m = tableModel();
+ auto *m = tableModel();
if(m) {
m->revertRow(toTableModelRowNo(row_no));
}
@@ -494,7 +494,7 @@ int TableView::reloadRow(int row_no)
row_no = currentIndex().row();
if(row_no < 0)
return 0;
- qfc::model::TableModel *m = tableModel();
+ auto *m = tableModel();
if(m) {
return m->reloadRow(toTableModelRowNo(row_no));
}
@@ -646,7 +646,7 @@ void TableView::setValueInSelection_helper(const QVariant &new_val)
}
else if(selected_row_indexes.count() > 1) {
qfc::sql::Connection conn;
- auto *sql_m = qobject_cast(tableModel());
+ auto *sql_m = qobject_cast(tableModel());
if(sql_m) {
try {
conn = sql_m->sqlConnection();
@@ -740,7 +740,7 @@ void TableView::editCellContentInEditor()
void TableView::exportCSV()
{
- core::model::TableModel *m = tableModel();
+ qmlwidgets::model::TableModel *m = tableModel();
if(!m)
return;
@@ -820,14 +820,14 @@ void TableView::selectCurrentRow()
selectRow(ix.row());
}
-qf::core::utils::TreeTable TableView::toTreeTable(const QString &table_name, const QVariantList &_exported_columns, const qf::core::model::TableModel::TreeTableExportOptions &opts) const
+qf::core::utils::TreeTable TableView::toTreeTable(const QString &table_name, const QVariantList &_exported_columns, const qf::qmlwidgets::model::TableModel::TreeTableExportOptions &opts) const
{
qfu::TreeTable ret(table_name);
QVariantList exported_columns = _exported_columns;
QAbstractItemModel *proxy_model = model();
if(!proxy_model)
return ret;
- core::model::TableModel *table_model = tableModel();
+ qmlwidgets::model::TableModel *table_model = tableModel();
if(!table_model)
return ret;
const core::utils::Table &table = table_model->table();
@@ -859,12 +859,12 @@ qf::core::utils::TreeTable TableView::toTreeTable(const QString &table_name, con
//qfWarning() << fld.toString();
}
else {
- t = proxy_model->headerData(ix, Qt::Horizontal, core::model::TableModel::FieldTypeRole).toInt();
+ t = proxy_model->headerData(ix, Qt::Horizontal, qmlwidgets::model::TableModel::FieldTypeRole).toInt();
}
- cd.setName(proxy_model->headerData(ix, Qt::Horizontal, core::model::TableModel::FieldNameRole).toString());
+ cd.setName(proxy_model->headerData(ix, Qt::Horizontal, qmlwidgets::model::TableModel::FieldNameRole).toString());
cd.setType(t);
cd.setHeader(cap);
- //ret.appendColumn(proxy_model->headerData(ix, Qt::Horizontal, core::model::TableModel::FieldNameRole).toString(), t, cap);
+ //ret.appendColumn(proxy_model->headerData(ix, Qt::Horizontal, qmlwidgets::model::TableModel::FieldNameRole).toString(), t, cap);
}
cd.setWidth(col.value("width"));
ret.appendColumn(cd);
@@ -886,7 +886,7 @@ qf::core::utils::TreeTable TableView::toTreeTable(const QString &table_name, con
else {
QModelIndex mix = proxy_model->index(i, ix);
if(raw_values) {
- val = proxy_model->data(mix, core::model::TableModel::RawValueRole);
+ val = proxy_model->data(mix, qmlwidgets::model::TableModel::RawValueRole);
//qfWarning() << col << val.typeName() << "val:" << val.toString();
}
else {
@@ -912,7 +912,7 @@ void TableView::exportReport_helper(const QVariant& _options)
qfu::TreeTable ttable;
{
- qfc::model::TableModel::TreeTableExportOptions opts;
+ qf::qmlwidgets::model::TableModel::TreeTableExportOptions opts;
//opts.setExportRawValues(true);
ttable = toTreeTable("data", exported_columns, opts);
}
@@ -1085,7 +1085,7 @@ int TableView::logicalColumnIndex(const QString &field_name) const
{
auto *m = model();
if(m) for (int i = 0; i < m->columnCount(); ++i) {
- QString fldn = m->headerData(i, Qt::Horizontal, qf::core::model::TableModel::FieldNameRole).toString();
+ QString fldn = m->headerData(i, Qt::Horizontal, qf::qmlwidgets::model::TableModel::FieldNameRole).toString();
if(qf::core::Utils::fieldNameEndsWith(fldn, field_name))
return i;
}
@@ -1317,7 +1317,7 @@ void TableView::loadPersistentSettings()
qfDebug() << path << "Cannot load persistent settings, horizontal header does not exist or it is empty.";
return;
}
- qf::core::model::TableModel *mod = tableModel();
+ qf::qmlwidgets::model::TableModel *mod = tableModel();
if(!mod || mod->columnCount() == 0) {
qfDebug() << path << "Cannot load persistent settings, table model does not exist or it is empty.";
return;
@@ -1973,7 +1973,7 @@ void TableView::copySpecial_helper(const QTableView *table_view, const QString &
for (auto col : cols) {
QModelIndex ix = m->index(row, col);
QString s;
- if(!ix.data(qf::core::model::TableModel::ValueIsNullRole).toBool()) {
+ if(!ix.data(qf::qmlwidgets::model::TableModel::ValueIsNullRole).toBool()) {
s = ix.data(Qt::DisplayRole).toString();
if(s.isEmpty()) {
QVariant v = ix.data(Qt::CheckStateRole);
@@ -2211,7 +2211,7 @@ bool TableView::edit(const QModelIndex& index, EditTrigger trigger, QEvent* even
bool read_only = isReadOnly();
/*
if(!read_only) {
- qfc::model::TableModel *m = tableModel();
+ auto *m = tableModel();
read_only = (!m || m->isReadOnly());
}
*/
diff --git a/libqf/libqfqmlwidgets/src/tableview.h b/libqf/libqfqmlwidgets/src/tableview.h
index da868f2fd..4ee530c56 100644
--- a/libqf/libqfqmlwidgets/src/tableview.h
+++ b/libqf/libqfqmlwidgets/src/tableview.h
@@ -3,10 +3,10 @@
#include "qmlwidgetsglobal.h"
#include "framework/ipersistentsettings.h"
+#include "model/datadocument.h"
#include
#include
-#include
#include
@@ -25,7 +25,7 @@ class QFQMLWIDGETS_DECL_EXPORT TableView : public QTableView, public framework::
Q_OBJECT
Q_PROPERTY(QString persistentSettingsId READ persistentSettingsId WRITE setPersistentSettingsId)
- Q_PROPERTY(qf::core::model::TableModel* model READ tableModel WRITE setTableModel)
+ Q_PROPERTY(qf::qmlwidgets::model::TableModel* model READ tableModel WRITE setTableModel)
Q_PROPERTY(RowEditorMode rowEditorMode READ rowEditorMode WRITE setRowEditorMode NOTIFY rowEditorModeChanged)
Q_PROPERTY(InlineEditSaveStrategy inlineEditSaveStrategy READ inlineEditSaveStrategy WRITE setInlineEditSaveStrategy NOTIFY inlineEditSaveStrategyChanged)
Q_PROPERTY(QString idColumnName READ idColumnName WRITE setIdColumnName)
@@ -52,11 +52,11 @@ class QFQMLWIDGETS_DECL_EXPORT TableView : public QTableView, public framework::
EditRowsMixed
};
enum RecordEditMode {
- ModeView = qf::core::model::DataDocument::ModeView,
- ModeEdit = qf::core::model::DataDocument::ModeEdit,
- ModeInsert = qf::core::model::DataDocument::ModeInsert,
- ModeCopy = qf::core::model::DataDocument::ModeCopy,
- ModeDelete = qf::core::model::DataDocument::ModeDelete
+ ModeView = qf::qmlwidgets::model::DataDocument::ModeView,
+ ModeEdit = qf::qmlwidgets::model::DataDocument::ModeEdit,
+ ModeInsert = qf::qmlwidgets::model::DataDocument::ModeInsert,
+ ModeCopy = qf::qmlwidgets::model::DataDocument::ModeCopy,
+ ModeDelete = qf::qmlwidgets::model::DataDocument::ModeDelete
};
QF_PROPERTY_IMPL2(InlineEditSaveStrategy, i, I, nlineEditSaveStrategy, OnEditedValueCommit)
@@ -67,8 +67,8 @@ class QFQMLWIDGETS_DECL_EXPORT TableView : public QTableView, public framework::
public:
QSortFilterProxyModel* sortFilterProxyModel() const;
- qf::core::model::TableModel* tableModel() const;
- void setTableModel(qf::core::model::TableModel* m);
+ qf::qmlwidgets::model::TableModel* tableModel() const;
+ void setTableModel(qf::qmlwidgets::model::TableModel* m);
//Q_SIGNAL void tableModelChanged();
Q_SIGNAL void currentRowChanged(int current_row);
@@ -169,7 +169,7 @@ class QFQMLWIDGETS_DECL_EXPORT TableView : public QTableView, public framework::
void seek(const QString &prefix_str);
void cancelSeek();
- qf::core::utils::TreeTable toTreeTable(const QString& table_name = QString(), const QVariantList& exported_columns = QVariantList(), const qf::core::model::TableModel::TreeTableExportOptions &opts = qf::core::model::TableModel::TreeTableExportOptions()) const;
+ qf::core::utils::TreeTable toTreeTable(const QString& table_name = QString(), const QVariantList& exported_columns = QVariantList(), const qf::qmlwidgets::model::TableModel::TreeTableExportOptions &opts = qf::qmlwidgets::model::TableModel::TreeTableExportOptions()) const;
void exportReport_helper(const QVariant& _options);
void exportCSV_helper(const QVariant& export_options);
protected:
diff --git a/libqf/libqfqmlwidgets/src/tableviewproxymodel.cpp b/libqf/libqfqmlwidgets/src/tableviewproxymodel.cpp
index 520a694dd..8892ef049 100644
--- a/libqf/libqfqmlwidgets/src/tableviewproxymodel.cpp
+++ b/libqf/libqfqmlwidgets/src/tableviewproxymodel.cpp
@@ -2,18 +2,18 @@
#include
#include
-#include
+#include
#include
#include
-//namespace qfm = qf::core::model;
+//namespace qfm = qf::qmlwidgets::model;
using namespace qf::qmlwidgets;
TableViewProxyModel::TableViewProxyModel(QObject *parent)
: Super(parent)
{
- setSortRole(qf::core::model::TableModel::SortRole);
+ setSortRole(qf::qmlwidgets::model::TableModel::SortRole);
}
TableViewProxyModel::~TableViewProxyModel()
diff --git a/libqf/plugins/qf/core/CMakeLists.txt b/libqf/plugins/qf/core/CMakeLists.txt
index fde7900fe..de6d0546c 100644
--- a/libqf/plugins/qf/core/CMakeLists.txt
+++ b/libqf/plugins/qf/core/CMakeLists.txt
@@ -37,7 +37,7 @@ target_link_libraries(qfcoreplugin PUBLIC
Qt::Core
# Qt::Gui
Qt::Qml
- libqfcore
+ libqfqmlwidgets
)
set(PLUGIN_DEST_DIR ${CMAKE_INSTALL_BINDIR}/qml/qf/core)
diff --git a/libqf/plugins/qf/core/src/model/sqldatadocument.cpp b/libqf/plugins/qf/core/src/model/sqldatadocument.cpp
index 27e8ab418..46957a627 100644
--- a/libqf/plugins/qf/core/src/model/sqldatadocument.cpp
+++ b/libqf/plugins/qf/core/src/model/sqldatadocument.cpp
@@ -2,11 +2,11 @@
#include "../sql/sqlquerybuilder.h"
-#include
+#include
#include
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
using namespace qf::core::qml;
SqlDataDocument::SqlDataDocument(QObject *parent)
diff --git a/libqf/plugins/qf/core/src/model/sqldatadocument.h b/libqf/plugins/qf/core/src/model/sqldatadocument.h
index a122722cd..1b5f713b0 100644
--- a/libqf/plugins/qf/core/src/model/sqldatadocument.h
+++ b/libqf/plugins/qf/core/src/model/sqldatadocument.h
@@ -3,7 +3,7 @@
#include "../sql/sqlquerybuilder.h"
-#include
+#include
namespace qf {
namespace core {
@@ -11,12 +11,12 @@ namespace qml {
//class SqlQueryBuilder;
-class SqlDataDocument : public qf::core::model::SqlDataDocument
+class SqlDataDocument : public qf::qmlwidgets::model::SqlDataDocument
{
Q_OBJECT
Q_PROPERTY(qf::core::qml::SqlQueryBuilder* queryBuilder READ qmlSqlQueryBuilder)
private:
- typedef qf::core::model::SqlDataDocument Super;
+ typedef qf::qmlwidgets::model::SqlDataDocument Super;
public:
SqlDataDocument(QObject *parent = nullptr);
~SqlDataDocument() Q_DECL_OVERRIDE;
diff --git a/libqf/plugins/qf/core/src/model/sqltablemodel.h b/libqf/plugins/qf/core/src/model/sqltablemodel.h
index d48130972..e2bbe3363 100644
--- a/libqf/plugins/qf/core/src/model/sqltablemodel.h
+++ b/libqf/plugins/qf/core/src/model/sqltablemodel.h
@@ -3,7 +3,7 @@
#include "tablemodelcolumn.h"
-#include
+#include
#include
@@ -14,14 +14,14 @@ namespace qml {
class SqlQueryBuilder;
class TableModelColumn;
-class SqlTableModel : public qf::core::model::SqlTableModel
+class SqlTableModel : public qf::qmlwidgets::model::SqlTableModel
{
Q_OBJECT
Q_PROPERTY(qf::core::qml::SqlQueryBuilder* queryBuilder READ sqlQueryBuilder /*NOTIFY queryBuilderChanged*/)
Q_PROPERTY(QQmlListProperty columns READ columns /*NOTIFY columnsChanged*/)
Q_CLASSINFO("DefaultProperty", "columns")
private:
- typedef qf::core::model::SqlTableModel Super;
+ typedef qf::qmlwidgets::model::SqlTableModel Super;
public:
explicit SqlTableModel(QObject *parent = nullptr);
~SqlTableModel() Q_DECL_OVERRIDE;
diff --git a/libqf/plugins/qf/core/src/model/tablemodelcolumn.cpp b/libqf/plugins/qf/core/src/model/tablemodelcolumn.cpp
index 468072925..d2539ea47 100644
--- a/libqf/plugins/qf/core/src/model/tablemodelcolumn.cpp
+++ b/libqf/plugins/qf/core/src/model/tablemodelcolumn.cpp
@@ -38,7 +38,7 @@ void TableModelColumn::setReadOnly(bool arg)
void TableModelColumn::setCastType(int arg)
{
- //qf::core::model::TableModel *m = qobject_cast(parent());
+ //qf::qmlwidgets::model::TableModel *m = qobject_cast(parent());
//qfWarning() << arg << m;
m_columnDefinition.setCastType(arg);
if(m_columnIndex >= 0)
diff --git a/libqf/plugins/qf/core/src/model/tablemodelcolumn.h b/libqf/plugins/qf/core/src/model/tablemodelcolumn.h
index af154f0a1..512275802 100644
--- a/libqf/plugins/qf/core/src/model/tablemodelcolumn.h
+++ b/libqf/plugins/qf/core/src/model/tablemodelcolumn.h
@@ -1,7 +1,7 @@
#ifndef TABLEMODELCOLUMN_H
#define TABLEMODELCOLUMN_H
-#include
+#include
#include
@@ -20,7 +20,7 @@ class TableModelColumn : public QObject
explicit TableModelColumn(QObject *parent = nullptr);
~TableModelColumn() Q_DECL_OVERRIDE;
- const qf::core::model::TableModel::ColumnDefinition& columnDefinition() {return m_columnDefinition; }
+ const qf::qmlwidgets::model::TableModel::ColumnDefinition& columnDefinition() {return m_columnDefinition; }
QString fieldName() const { return m_columnDefinition.fieldName(); }
void setFieldName(QString arg);
@@ -38,7 +38,7 @@ class TableModelColumn : public QObject
signals:
void updated(int column_index);
private:
- qf::core::model::TableModel::ColumnDefinition m_columnDefinition;
+ qf::qmlwidgets::model::TableModel::ColumnDefinition m_columnDefinition;
int m_columnIndex = -1;
};
diff --git a/libqf/plugins/qf/core/src/qfcore_plugin.cpp b/libqf/plugins/qf/core/src/qfcore_plugin.cpp
index fb2ac803e..cafd7cbee 100644
--- a/libqf/plugins/qf/core/src/qfcore_plugin.cpp
+++ b/libqf/plugins/qf/core/src/qfcore_plugin.cpp
@@ -18,8 +18,8 @@
//#include
//#include
-//#include
-//#include
+//#include
+//#include
//#include
@@ -44,10 +44,10 @@ void QFCorePlugin::registerTypes(const char *uri)
qmlRegisterType(uri, 1, 0, "SqlRecord");
qmlRegisterType(uri, 1, 0, "SqlQueryBuilder");
qmlRegisterType(uri, 1, 0, "SqlTableModel");
- qmlRegisterType(uri, 1, 0, "TableModel");
+ qmlRegisterType(uri, 1, 0, "TableModel");
qmlRegisterType(uri, 1, 0, "ModelColumn");
- qmlRegisterType(uri, 1, 0, "DataDocument");
+ qmlRegisterType(uri, 1, 0, "DataDocument");
qmlRegisterType(uri, 1, 0, "SqlDataDocument");
qmlRegisterType(uri, 1, 0, "Settings");
diff --git a/libqf/plugins/qf/core/src/settings.h b/libqf/plugins/qf/core/src/settings.h
index 16b382e1f..1367c9418 100644
--- a/libqf/plugins/qf/core/src/settings.h
+++ b/libqf/plugins/qf/core/src/settings.h
@@ -15,16 +15,15 @@ class Settings : public qf::core::utils::Settings
public:
explicit Settings(QObject *parent = nullptr);
~Settings() Q_DECL_OVERRIDE;
-public slots:
- void beginGroup(const QString & prefix) {Super::beginGroup(prefix);}
- int beginReadArray(const QString & prefix) {return Super::beginReadArray(prefix);}
- void beginWriteArray(const QString & prefix, int size = -1) {Super::beginWriteArray(prefix, size);}
- void endArray() {Super::endArray();}
- void endGroup() {Super::endGroup();}
- void setArrayIndex(int i) {Super::setArrayIndex(i);}
- QString group() const {return Super::group();}
-
- void sync() {Super::sync();}
+public:
+ Q_INVOKABLE void beginGroup(const QString & prefix) {Super::beginGroup(prefix);}
+ Q_INVOKABLE int beginReadArray(const QString & prefix) {return Super::beginReadArray(prefix);}
+ Q_INVOKABLE void beginWriteArray(const QString & prefix, int size = -1) {Super::beginWriteArray(prefix, size);}
+ Q_INVOKABLE void endArray() {Super::endArray();}
+ Q_INVOKABLE void endGroup() {Super::endGroup();}
+ Q_INVOKABLE void setArrayIndex(int i) {Super::setArrayIndex(i);}
+ Q_INVOKABLE QString group() const {return Super::group();}
+ Q_INVOKABLE void sync() {Super::sync();}
};
}}}
diff --git a/libquickevent/libquickeventcore/CMakeLists.txt b/libquickevent/libquickeventcore/CMakeLists.txt
index 190413e90..56ad7bb06 100644
--- a/libquickevent/libquickeventcore/CMakeLists.txt
+++ b/libquickevent/libquickeventcore/CMakeLists.txt
@@ -6,7 +6,6 @@ add_library(libquickeventcore SHARED
src/exporters/stageresultscsvexporter.cpp
src/exporters/stageresultshtmlexporter.cpp
src/exporters/stagestartlisthtmlexporter.cpp
- src/og/sqltablemodel.cpp
src/og/timems.cpp
src/runstatus.cpp
src/si/checkedcard.cpp
diff --git a/libquickevent/libquickeventcore/include/quickevent/core/og/sqltablemodel.h b/libquickevent/libquickeventcore/include/quickevent/core/og/sqltablemodel.h
deleted file mode 100644
index 97631f790..000000000
--- a/libquickevent/libquickeventcore/include/quickevent/core/og/sqltablemodel.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../../src/og/sqltablemodel.h"
diff --git a/libquickevent/libquickeventcore/src/og/sqltablemodel.cpp b/libquickevent/libquickeventcore/src/og/sqltablemodel.cpp
deleted file mode 100644
index ce2c1ff9d..000000000
--- a/libquickevent/libquickeventcore/src/og/sqltablemodel.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "sqltablemodel.h"
-#include "timems.h"
-#include "../si/siid.h"
-
-#include
-
-#include
-
-
-
-namespace quickevent::core::og {
-
-SqlTableModel::SqlTableModel(QObject *parent)
- : Super(parent)
-{
-}
-
-SqlTableModel::~SqlTableModel()
-= default;
-
-QVariant SqlTableModel::data(const QModelIndex &index, int role) const
-{
- if(role == Qt::DisplayRole) {
- QVariant v = Super::data(index, Qt::EditRole);
- int type = v.userType();
- if(type == qMetaTypeId()) {
- auto t = v.value();
- return t.toString();
- }
- if(type == qMetaTypeId()) {
- int id = (int)v.value();
- if(id == 0)
- return QString();// QStringLiteral("null");
- return id;
- }
- }
- else if(role == SortRole) {
- QVariant v = Super::data(index, Qt::EditRole);
- int type = v.userType();
- if(type == qMetaTypeId()) {
- auto t = v.value();
- return t.msec();
- }
- return Super::data(index, role);
- }
- else if(role == Qt::TextAlignmentRole) {
- QVariant v = Super::data(index, Qt::EditRole);
- if(v.userType() == qMetaTypeId()) {
- return Qt::AlignRight;
- }
- }
- return Super::data(index, role);
-}
-
-QVariant SqlTableModel::rawValueToEdit(int column_index, const QVariant &val) const
-{
- QVariant ret = val;
- int type = columnType(column_index);
- if(type == qMetaTypeId()) {
- TimeMs t;
- if(!ret.isNull()) {
- t = TimeMs(ret.toInt());
- }
- ret = QVariant::fromValue(t);
- }
- else if(type == qMetaTypeId()) {
- si::SiId id(val.toInt());
- ret = QVariant::fromValue(id);
- }
- return ret;
-}
-
-QVariant SqlTableModel::editValueToRaw(int column_index, const QVariant &val) const
-{
- QVariant ret = val;
- int type = columnType(column_index);
- if(type == qMetaTypeId()) {
- auto t = val.value();
-#if QT_VERSION_MAJOR >= 6
- ret = t.isValid()? t.msec(): QVariant(QMetaType(QMetaType::Int));
-#else
- ret = t.isValid()? t.msec(): QVariant(QVariant::Int);
-#endif
- }
- else if(type == qMetaTypeId()) {
- auto id = (int)val.value();
- if(id == 0)
-#if QT_VERSION_MAJOR >= 6
- ret = QVariant(QMetaType(QMetaType::Int));
-#else
- ret = QVariant(QVariant::Int);
-#endif
- else
- ret = id;
- }
- //qfInfo() << val << ret;
- return ret;
-}
-
-}
diff --git a/libquickevent/libquickeventcore/src/og/sqltablemodel.h b/libquickevent/libquickeventcore/src/og/sqltablemodel.h
deleted file mode 100644
index 92c2b597c..000000000
--- a/libquickevent/libquickeventcore/src/og/sqltablemodel.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef QUICKEVENTCORE_OG_SQLTABLEMODEL_H
-#define QUICKEVENTCORE_OG_SQLTABLEMODEL_H
-
-#include "../quickeventcoreglobal.h"
-
-#include
-
-namespace quickevent {
-namespace core {
-namespace og {
-
-class QUICKEVENTCORE_DECL_EXPORT SqlTableModel : public qf::core::model::SqlTableModel
-{
- Q_OBJECT
-private:
- typedef qf::core::model::SqlTableModel Super;
-public:
- SqlTableModel(QObject *parent = nullptr);
- ~SqlTableModel();
-public:
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const Q_DECL_OVERRIDE;
-protected:
- QVariant rawValueToEdit(int column_index, const QVariant &val) const Q_DECL_OVERRIDE;
- QVariant editValueToRaw(int column_index, const QVariant &val) const Q_DECL_OVERRIDE;
-};
-
-}}}
-
-#endif // QUICKEVENTCORE_OG_SQLTABLEMODEL_H
diff --git a/libquickevent/libquickeventgui/include/quickevent/gui/og/sqltablemodel.h b/libquickevent/libquickeventgui/include/quickevent/gui/og/sqltablemodel.h
index 937cedff9..97631f790 100644
--- a/libquickevent/libquickeventgui/include/quickevent/gui/og/sqltablemodel.h
+++ b/libquickevent/libquickeventgui/include/quickevent/gui/og/sqltablemodel.h
@@ -1 +1 @@
-#include "../../../src/og/sqltablemodel.h"
+#include "../../../../src/og/sqltablemodel.h"
diff --git a/libquickevent/libquickeventgui/src/og/sqltablemodel.h b/libquickevent/libquickeventgui/src/og/sqltablemodel.h
index 0bbd9f076..4f65db683 100644
--- a/libquickevent/libquickeventgui/src/og/sqltablemodel.h
+++ b/libquickevent/libquickeventgui/src/og/sqltablemodel.h
@@ -3,17 +3,17 @@
#include "../quickeventguiglobal.h"
-#include
+#include
namespace quickevent {
namespace gui {
namespace og {
-class QUICKEVENTGUI_DECL_EXPORT SqlTableModel : public qf::core::model::SqlTableModel
+class QUICKEVENTGUI_DECL_EXPORT SqlTableModel : public qf::qmlwidgets::model::SqlTableModel
{
Q_OBJECT
private:
- typedef qf::core::model::SqlTableModel Super;
+ typedef qf::qmlwidgets::model::SqlTableModel Super;
public:
SqlTableModel(QObject *parent = nullptr);
~SqlTableModel();
diff --git a/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.cpp b/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.cpp
index c0e670802..bc9207b9a 100644
--- a/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.cpp
+++ b/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.cpp
@@ -9,7 +9,7 @@
#include
#include
-#include
+#include
#include
#include
#include
@@ -39,7 +39,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -73,11 +73,11 @@ using Receipts::ReceiptsPlugin;
using Runs::RunsPlugin;
namespace {
-class Model : public quickevent::core::og::SqlTableModel
+class Model : public quickevent::gui::og::SqlTableModel
{
Q_OBJECT
private:
- typedef quickevent::core::og::SqlTableModel Super;
+ typedef quickevent::gui::og::SqlTableModel Super;
public:
enum Columns {
col_cards_id = 0,
diff --git a/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.h b/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.h
index 5b3746bb4..353bc55c9 100644
--- a/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.h
+++ b/quickevent/app/quickevent/plugins/CardReader/src/cardreaderwidget.h
@@ -16,7 +16,7 @@ namespace Ui {
class CardReaderWidget;
}
-namespace quickevent::core::og { class SqlTableModel; }
+namespace quickevent::gui::og { class SqlTableModel; }
namespace qf {
namespace qmlwidgets {
@@ -109,7 +109,7 @@ private slots:
private:
Ui::CardReaderWidget *ui;
qf::qmlwidgets::Action *m_actAssignCard = nullptr;
- quickevent::core::og::SqlTableModel *m_cardsModel = nullptr;
+ quickevent::gui::og::SqlTableModel *m_cardsModel = nullptr;
quickevent::gui::audio::Player *m_audioPlayer = nullptr;
siut::DeviceDriver *f_siDriver = nullptr;
siut::CommPort *m_commPort = nullptr;
diff --git a/quickevent/app/quickevent/plugins/CardReader/src/services/mqttpunches.cpp b/quickevent/app/quickevent/plugins/CardReader/src/services/mqttpunches.cpp
index 8bcb0ba79..d1fb43788 100644
--- a/quickevent/app/quickevent/plugins/CardReader/src/services/mqttpunches.cpp
+++ b/quickevent/app/quickevent/plugins/CardReader/src/services/mqttpunches.cpp
@@ -28,7 +28,7 @@
#include
#endif
-//namespace qfm = qf::core::model;
+//namespace qfm = qf::qmlwidgets::model;
using qf::qmlwidgets::framework::getPlugin;
using CardReader::CardReaderPlugin;
diff --git a/quickevent/app/quickevent/plugins/CardReader/src/services/racomclient.cpp b/quickevent/app/quickevent/plugins/CardReader/src/services/racomclient.cpp
index 1be203989..4ea375b0e 100644
--- a/quickevent/app/quickevent/plugins/CardReader/src/services/racomclient.cpp
+++ b/quickevent/app/quickevent/plugins/CardReader/src/services/racomclient.cpp
@@ -31,7 +31,7 @@
#include
#endif
-//namespace qfm = qf::core::model;
+//namespace qfm = qf::qmlwidgets::model;
using qf::qmlwidgets::framework::getPlugin;
using Event::EventPlugin;
using CardReader::CardReaderPlugin;
diff --git a/quickevent/app/quickevent/plugins/Classes/src/classdefdocument.h b/quickevent/app/quickevent/plugins/Classes/src/classdefdocument.h
index 93b5e6801..47bd20287 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/classdefdocument.h
+++ b/quickevent/app/quickevent/plugins/Classes/src/classdefdocument.h
@@ -1,13 +1,13 @@
#ifndef CLASSDEFDOCUMENT_H
#define CLASSDEFDOCUMENT_H
-#include
+#include
-class ClassDefDocument : public qf::core::model::SqlDataDocument
+class ClassDefDocument : public qf::qmlwidgets::model::SqlDataDocument
{
Q_OBJECT
private:
- typedef qf::core::model::SqlDataDocument Super;
+ typedef qf::qmlwidgets::model::SqlDataDocument Super;
public:
ClassDefDocument(QObject *parent = nullptr);
};
diff --git a/quickevent/app/quickevent/plugins/Classes/src/classdefwidget.h b/quickevent/app/quickevent/plugins/Classes/src/classdefwidget.h
index 5f4a28b30..062b3a350 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/classdefwidget.h
+++ b/quickevent/app/quickevent/plugins/Classes/src/classdefwidget.h
@@ -16,7 +16,7 @@ class ClassDefWidget : public qf::qmlwidgets::framework::DataDialogWidget
ClassDefWidget(QWidget *parent = nullptr);
~ClassDefWidget() Q_DECL_OVERRIDE;
- bool load(const QVariant &id = QVariant(), int mode = qf::core::model::DataDocument::ModeEdit) Q_DECL_OVERRIDE;
+ bool load(const QVariant &id = QVariant(), int mode = qf::qmlwidgets::model::DataDocument::ModeEdit) Q_DECL_OVERRIDE;
private:
Ui::ClassDefWidget *ui;
};
diff --git a/quickevent/app/quickevent/plugins/Classes/src/classdocument.h b/quickevent/app/quickevent/plugins/Classes/src/classdocument.h
index da396daeb..32fd92933 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/classdocument.h
+++ b/quickevent/app/quickevent/plugins/Classes/src/classdocument.h
@@ -1,15 +1,15 @@
#ifndef CLASSES_CLASSDOCUMENT_H
#define CLASSES_CLASSDOCUMENT_H
-#include
+#include
namespace Classes {
-class ClassDocument : public qf::core::model::SqlDataDocument
+class ClassDocument : public qf::qmlwidgets::model::SqlDataDocument
{
Q_OBJECT
private:
- typedef qf::core::model::SqlDataDocument Super;
+ typedef qf::qmlwidgets::model::SqlDataDocument Super;
public:
ClassDocument(QObject *parent = nullptr);
protected:
diff --git a/quickevent/app/quickevent/plugins/Classes/src/classeswidget.cpp b/quickevent/app/quickevent/plugins/Classes/src/classeswidget.cpp
index dbe559878..08bc96d11 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/classeswidget.cpp
+++ b/quickevent/app/quickevent/plugins/Classes/src/classeswidget.cpp
@@ -22,7 +22,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
@@ -42,7 +42,7 @@ static const auto SkipEmptyParts = Qt::SkipEmptyParts;
namespace qfc = qf::core;
namespace qfw = qf::qmlwidgets;
namespace qfd = qf::qmlwidgets::dialogs;
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
namespace qfs = qf::core::sql;
using qf::qmlwidgets::framework::getPlugin;
using Event::EventPlugin;
@@ -193,11 +193,9 @@ ClassesWidget::ClassesWidget(QWidget *parent) :
m->addColumn("courses.length", tr("Length"));
m->addColumn("courses.climb", tr("Climb"));
- if (auto is_relays = getPlugin()->eventConfig()->isRelays(); is_relays) {
- m->addColumn("relaysCount", tr("Rel. count")).setToolTip(tr("Relays count"));
- m->addColumn("classdefs.relayStartNumber", tr("Rel. num")).setToolTip(tr("Relay start number"));
- m->addColumn("classdefs.relayLegCount", tr("Legs")).setToolTip(tr("Relay leg count"));
- }
+ m->addColumn("relaysCount", tr("Rel. count")).setToolTip(tr("Relays count"));
+ m->addColumn("classdefs.relayStartNumber", tr("Rel. num")).setToolTip(tr("Relay start number"));
+ m->addColumn("classdefs.relayLegCount", tr("Legs")).setToolTip(tr("Relay leg count"));
ui->tblClasses->setTableModel(m);
diff --git a/quickevent/app/quickevent/plugins/Classes/src/classeswidget.h b/quickevent/app/quickevent/plugins/Classes/src/classeswidget.h
index 40a866be4..6a6cc8c7d 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/classeswidget.h
+++ b/quickevent/app/quickevent/plugins/Classes/src/classeswidget.h
@@ -11,10 +11,8 @@ namespace Ui {
class ClassesWidget;
}
-namespace qf {
-namespace core { namespace model { class SqlTableModel; } }
-namespace qmlwidgets { class ForeignKeyComboBox; }
-}
+namespace qf::qmlwidgets { class ForeignKeyComboBox; }
+namespace qf::qmlwidgets::model { class SqlTableModel; }
namespace quickevent { namespace core { class CodeDef; }}
@@ -50,8 +48,8 @@ class ClassesWidget : public QFrame
void importCourses(const QList &course_defs, const QList &code_defs);
private:
Ui::ClassesWidget *ui;
- qf::core::model::SqlTableModel *m_classesModel;
- qf::core::model::SqlTableModel *m_courseCodesModel;
+ qf::qmlwidgets::model::SqlTableModel *m_classesModel;
+ qf::qmlwidgets::model::SqlTableModel *m_courseCodesModel;
QComboBox *m_cbxStage = nullptr;
CourseItemDelegate *m_courseItemDelegate = nullptr;
};
diff --git a/quickevent/app/quickevent/plugins/Classes/src/drawing/classitem.cpp b/quickevent/app/quickevent/plugins/Classes/src/drawing/classitem.cpp
index eb14b9b6f..93cd2838a 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/drawing/classitem.cpp
+++ b/quickevent/app/quickevent/plugins/Classes/src/drawing/classitem.cpp
@@ -23,7 +23,7 @@
namespace qfd = qf::qmlwidgets::dialogs;
namespace qfc = qf::core;
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
namespace drawing {
@@ -462,7 +462,7 @@ void ClassItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
bool ok = dlg.exec();
if(ok) {
//qfInfo() << "OK";
- qf::core::model::DataDocument *doc = w->dataDocument();
+ qf::qmlwidgets::model::DataDocument *doc = w->dataDocument();
ClassData dt = data();
dt.setStartTimeMin(doc->value("startTimeMin").toInt());
dt.setStartIntervalMin(doc->value("startIntervalMin").toInt());
diff --git a/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.cpp b/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.cpp
index 70f6f02c4..ccf8e4360 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.cpp
+++ b/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.cpp
@@ -1,9 +1,9 @@
#include "editcodeswidget.h"
#include "ui_editcodeswidget.h"
-#include
+#include
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
namespace qfs = qf::core::sql;
EditCodesWidget::EditCodesWidget(QWidget *parent)
diff --git a/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.h b/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.h
index 2ce421a6d..820319bf4 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.h
+++ b/quickevent/app/quickevent/plugins/Classes/src/editcodeswidget.h
@@ -7,9 +7,7 @@ namespace Ui {
class EditCodesWidget;
}
-namespace qf {
-namespace core { namespace model { class SqlTableModel; } }
-}
+namespace qf::qmlwidgets::model { class SqlTableModel; }
class EditCodesWidget : public qf::qmlwidgets::framework::DialogWidget
{
@@ -21,7 +19,7 @@ class EditCodesWidget : public qf::qmlwidgets::framework::DialogWidget
~EditCodesWidget() Q_DECL_OVERRIDE;
private:
Ui::EditCodesWidget *ui;
- qf::core::model::SqlTableModel *m_tableModel;
+ qf::qmlwidgets::model::SqlTableModel *m_tableModel;
};
#endif // EDITCODESWIDGET_H
diff --git a/quickevent/app/quickevent/plugins/Classes/src/editcoursecodeswidget.cpp b/quickevent/app/quickevent/plugins/Classes/src/editcoursecodeswidget.cpp
index fac74ae69..7190baeee 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/editcoursecodeswidget.cpp
+++ b/quickevent/app/quickevent/plugins/Classes/src/editcoursecodeswidget.cpp
@@ -1,7 +1,7 @@
#include "editcoursecodeswidget.h"
#include "ui_editcoursecodeswidget.h"
-#include
+#include
#include
#include
diff --git a/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.cpp b/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.cpp
index 516e1aa5b..49fb61c22 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.cpp
+++ b/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.cpp
@@ -3,16 +3,15 @@
#include "ui_editcourseswidget.h"
#include
-#include
+#include
#include
#include
#include
#include
-namespace qfc = qf::core;
namespace qfw = qf::qmlwidgets;
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
namespace qfs = qf::core::sql;
class CoursesTableModel : public qfm::SqlTableModel
@@ -37,15 +36,15 @@ class CoursesTableModel : public qfm::SqlTableModel
CoursesTableModel(QObject *parent) : Super(parent)
{
clearColumns(Col_COUNT);
- setColumn(Col_id, qf::core::model::TableModel::ColumnDefinition("id", tr("Id")).setReadOnly(true));
- setColumn(Col_name, qf::core::model::TableModel::ColumnDefinition("courses.name", tr("Name")));
- setColumn(Col_length, qf::core::model::TableModel::ColumnDefinition("courses.length", tr("Length")));
- setColumn(Col_climb, qf::core::model::TableModel::ColumnDefinition("courses.climb", tr("Climb")));
- setColumn(Col_mapCount, qf::core::model::TableModel::ColumnDefinition("courses.mapCount", tr("Maps")));
- setColumn(Col_runCount, qf::core::model::TableModel::ColumnDefinition("run_count", tr("Runners")));
- setColumn(Col_note, qf::core::model::TableModel::ColumnDefinition("courses.note", tr("Note")));
- setColumn(Col_codeCount, qf::core::model::TableModel::ColumnDefinition("code_count", tr("Code count")).setReadOnly(true));
- setColumn(Col_codeList, qf::core::model::TableModel::ColumnDefinition("code_list", tr("Codes")).setReadOnly(true));
+ setColumn(Col_id, qf::qmlwidgets::model::TableModel::ColumnDefinition("id", tr("Id")).setReadOnly(true));
+ setColumn(Col_name, qf::qmlwidgets::model::TableModel::ColumnDefinition("courses.name", tr("Name")));
+ setColumn(Col_length, qf::qmlwidgets::model::TableModel::ColumnDefinition("courses.length", tr("Length")));
+ setColumn(Col_climb, qf::qmlwidgets::model::TableModel::ColumnDefinition("courses.climb", tr("Climb")));
+ setColumn(Col_mapCount, qf::qmlwidgets::model::TableModel::ColumnDefinition("courses.mapCount", tr("Maps")));
+ setColumn(Col_runCount, qf::qmlwidgets::model::TableModel::ColumnDefinition("run_count", tr("Runners")));
+ setColumn(Col_note, qf::qmlwidgets::model::TableModel::ColumnDefinition("courses.note", tr("Note")));
+ setColumn(Col_codeCount, qf::qmlwidgets::model::TableModel::ColumnDefinition("code_count", tr("Code count")).setReadOnly(true));
+ setColumn(Col_codeList, qf::qmlwidgets::model::TableModel::ColumnDefinition("code_list", tr("Codes")).setReadOnly(true));
}
public:
QVariant data(const QModelIndex &index, int role) const override
@@ -139,7 +138,7 @@ EditCoursesWidget::~EditCoursesWidget()
void EditCoursesWidget::editCourseCodes(const QModelIndex &ix)
{
- qfc::model::TableModel *m = ui->tblCourses->tableModel();
+ auto *m = ui->tblCourses->tableModel();
if(!m)
return;
int row_no = ui->tblCourses->toTableModelRowNo(ix.row());
diff --git a/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.h b/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.h
index 08d7fe1b0..ae4bf2996 100644
--- a/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.h
+++ b/quickevent/app/quickevent/plugins/Classes/src/editcourseswidget.h
@@ -7,9 +7,7 @@ namespace Ui {
class EditCoursesWidget;
}
-namespace qf {
-namespace core { namespace model { class SqlTableModel; } }
-}
+namespace qf::qmlwidgets::model { class SqlTableModel; }
class EditCoursesWidget : public qf::qmlwidgets::framework::DialogWidget
{
@@ -23,7 +21,7 @@ class EditCoursesWidget : public qf::qmlwidgets::framework::DialogWidget
void editCourseCodes(const QModelIndex &ix);
private:
Ui::EditCoursesWidget *ui;
- qf::core::model::SqlTableModel *m_coursesModel;
+ qf::qmlwidgets::model::SqlTableModel *m_coursesModel;
};
#endif // EDITCOURSESWIDGET_H
diff --git a/quickevent/app/quickevent/plugins/Competitors/src/competitordocument.h b/quickevent/app/quickevent/plugins/Competitors/src/competitordocument.h
index 3ecea5bab..04a764da7 100644
--- a/quickevent/app/quickevent/plugins/Competitors/src/competitordocument.h
+++ b/quickevent/app/quickevent/plugins/Competitors/src/competitordocument.h
@@ -1,17 +1,17 @@
#ifndef COMPETITORS_COMPETITORDOCUMENT_H
#define COMPETITORS_COMPETITORDOCUMENT_H
-#include
+#include
#include
namespace Competitors {
-class CompetitorDocument : public qf::core::model::SqlDataDocument
+class CompetitorDocument : public qf::qmlwidgets::model::SqlDataDocument
{
Q_OBJECT
private:
- typedef qf::core::model::SqlDataDocument Super;
+ typedef qf::qmlwidgets::model::SqlDataDocument Super;
public:
CompetitorDocument(QObject *parent = nullptr);
diff --git a/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.cpp b/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.cpp
index f6ab41c6c..c9f6b95ae 100644
--- a/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.cpp
+++ b/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.cpp
@@ -10,7 +10,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -40,11 +40,11 @@ using Event::EventPlugin;
namespace {
-class CompetitorRunsModel : public quickevent::core::og::SqlTableModel
+class CompetitorRunsModel : public quickevent::gui::og::SqlTableModel
{
Q_DECLARE_TR_FUNCTIONS(CompetitorRunsModel)
private:
- using Super = quickevent::core::og::SqlTableModel;
+ using Super = quickevent::gui::og::SqlTableModel;
public:
CompetitorRunsModel(QObject *parent = nullptr);
@@ -256,7 +256,7 @@ CompetitorWidget::~CompetitorWidget()
bool CompetitorWidget::loadRunsTable()
{
//bool is_relays = getPlugin()->eventConfig()->isRelays();
- qf::core::model::DataDocument *doc = dataController()->document();
+ qf::qmlwidgets::model::DataDocument *doc = dataController()->document();
qf::core::sql::QueryBuilder qb;
qb.select2("runs", "*")
.select2("classes", "name")
@@ -311,11 +311,11 @@ void CompetitorWidget::onRunsTableCustomContextMenuRequest(const QPoint &pos)
*/
bool CompetitorWidget::load(const QVariant &id, int mode)
{
- ui->chkFind->setChecked(mode == qf::core::model::DataDocument::ModeInsert);
- if(mode == qf::core::model::DataDocument::ModeInsert) {
+ ui->chkFind->setChecked(mode == qf::qmlwidgets::model::DataDocument::ModeInsert);
+ if(mode == qf::qmlwidgets::model::DataDocument::ModeInsert) {
ui->edFind->setFocus();
}
- else if(mode == qf::core::model::DataDocument::ModeView || mode == qf::core::model::DataDocument::ModeDelete) {
+ else if(mode == qf::qmlwidgets::model::DataDocument::ModeView || mode == qf::qmlwidgets::model::DataDocument::ModeDelete) {
ui->frmFind->hide();
}
if(Super::load(id, mode))
@@ -469,7 +469,7 @@ QList CompetitorWidget::possibleStartTimesMs(int run_id)
// if(!saveData())
// return;
-// qf::core::model::DataDocument*doc = dataController()->document();
+// qf::qmlwidgets::model::DataDocument*doc = dataController()->document();
// int competitor_id = doc->value("competitors.id").toInt();
// int class_id = ui->cbxClass->currentData().toInt();
// QString sort_col = QStringLiteral("runs.startTimeMs");
diff --git a/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.h b/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.h
index 9d06b6482..9a5668d9d 100644
--- a/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.h
+++ b/quickevent/app/quickevent/plugins/Competitors/src/competitorwidget.h
@@ -19,7 +19,7 @@ class CompetitorWidget : public qf::qmlwidgets::framework::DataDialogWidget
explicit CompetitorWidget(QWidget *parent = nullptr);
~CompetitorWidget() override;
- bool load(const QVariant &id = QVariant(), int mode = qf::core::model::DataDocument::ModeEdit) override;
+ bool load(const QVariant &id = QVariant(), int mode = qf::qmlwidgets::model::DataDocument::ModeEdit) override;
void loadFromRegistrations(int siid);
void save();
private slots:
@@ -36,6 +36,6 @@ private slots:
static QList possibleStartTimesMs(int run_id);
private:
Ui::CompetitorWidget *ui;
- quickevent::core::og::SqlTableModel *m_runsModel;
+ quickevent::gui::og::SqlTableModel *m_runsModel;
};
diff --git a/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.cpp b/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.cpp
index 8882f5216..68892e634 100644
--- a/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.cpp
@@ -23,6 +23,7 @@ ConnectDbDialogWidget::ConnectDbDialogWidget(QWidget *parent) :
if(checked)
ui->dataStorageStackedWidget->setCurrentWidget(ui->pgSingleFile);
});
+ connect(ui->btSingleWorkingDirectory, &QAbstractButton::clicked, this, &ConnectDbDialogWidget::onSingleWorkingDirectoryClicked);
}
ConnectDbDialogWidget::~ConnectDbDialogWidget()
@@ -103,7 +104,7 @@ void ConnectDbDialogWidget::saveSettings()
settings.setSingleWorkingDir(ui->edSingleWorkingDir->text());
}
-void ConnectDbDialogWidget::on_btSingleWorkingDirectory_clicked()
+void ConnectDbDialogWidget::onSingleWorkingDirectoryClicked()
{
//qf::qmlwidgets::framework::MainWindow *fwk = qf::qmlwidgets::framework::MainWindow::frameWork();
QString wd = qf::qmlwidgets::dialogs::FileDialog::getExistingDirectory(this, tr("Event files directory"), ui->edSingleWorkingDir->text());
diff --git a/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.h b/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.h
index 62eb8cb81..52c953371 100644
--- a/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.h
+++ b/quickevent/app/quickevent/plugins/Event/src/connectdbdialogwidget.h
@@ -13,7 +13,7 @@ class ConnectDbDialogWidget : public qf::qmlwidgets::framework::DialogWidget
{
Q_OBJECT
private:
- typedef qf::qmlwidgets::framework::DialogWidget Super;
+ using Super = qf::qmlwidgets::framework::DialogWidget;
public:
explicit ConnectDbDialogWidget(QWidget *parent = nullptr);
~ConnectDbDialogWidget();
@@ -29,7 +29,7 @@ class ConnectDbDialogWidget : public qf::qmlwidgets::framework::DialogWidget
void loadSettings();
void saveSettings();
private:
- Q_SLOT void on_btSingleWorkingDirectory_clicked();
+ void onSingleWorkingDirectoryClicked();
private:
Ui::ConnectDbDialogWidget *ui;
};
diff --git a/quickevent/app/quickevent/plugins/Event/src/eventconfig.cpp b/quickevent/app/quickevent/plugins/Event/src/eventconfig.cpp
index abe4d8c07..8988b6792 100644
--- a/quickevent/app/quickevent/plugins/Event/src/eventconfig.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/eventconfig.cpp
@@ -64,17 +64,19 @@ void EventConfig::load()
Query q(conn);
QueryBuilder qb;
qb.select("ckey, cvalue, ctype").from("config").orderBy("ckey");
- if(q.exec(qb.toString())) while(q.next()) {
- QString key = q.value(0).toString();
- /*
- if(!knownKeys().contains(key)) {
- qfWarning() << "Config key" << key << "is not known to the QuickEvent config system";
+ if(q.exec(qb.toString(), qf::core::Exception::Throw)) {
+ while(q.next()) {
+ QString key = q.value(0).toString();
+ /*
+ if(!knownKeys().contains(key)) {
+ qfWarning() << "Config key" << key << "is not known to the QuickEvent config system";
+ }
+ */
+ QVariant val = q.value(1);
+ QString type = q.value(2).toString();
+ QVariant v = qf::core::Utils::retypeStringValue(val.toString(), type);
+ setValue(key, v);
}
- */
- QVariant val = q.value(1);
- QString type = q.value(2).toString();
- QVariant v = qf::core::Utils::retypeStringValue(val.toString(), type);
- setValue(key, v);
}
// checkApiKey();
}
diff --git a/quickevent/app/quickevent/plugins/Event/src/eventplugin.cpp b/quickevent/app/quickevent/plugins/Event/src/eventplugin.cpp
index d482d0243..830f9d0ad 100644
--- a/quickevent/app/quickevent/plugins/Event/src/eventplugin.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/eventplugin.cpp
@@ -1367,10 +1367,10 @@ void EventPlugin::reloadRegistrationsModel()
m_registrationsTable = qf::core::utils::Table();
}
-qf::core::model::SqlTableModel* EventPlugin::registrationsModel()
+qf::qmlwidgets::model::SqlTableModel* EventPlugin::registrationsModel()
{
if(!m_registrationsModel) {
- m_registrationsModel = new qf::core::model::SqlTableModel(this);
+ m_registrationsModel = new qf::qmlwidgets::model::SqlTableModel(this);
m_registrationsModel->addColumn("competitorName", tr("Name"));
m_registrationsModel->addColumn("registration", tr("Reg"));
m_registrationsModel->addColumn("licence", tr("Lic"));
@@ -1389,7 +1389,7 @@ qf::core::model::SqlTableModel* EventPlugin::registrationsModel()
const qf::core::utils::Table &EventPlugin::registrationsTable()
{
- qf::core::model::SqlTableModel *m = registrationsModel();
+ qf::qmlwidgets::model::SqlTableModel *m = registrationsModel();
if(m_registrationsTable.isNull() && !m->table().isNull()) {
m_registrationsTable = m->table();
auto c_nsk = QStringLiteral("competitorNameAscii7");
diff --git a/quickevent/app/quickevent/plugins/Event/src/eventplugin.h b/quickevent/app/quickevent/plugins/Event/src/eventplugin.h
index d82b57799..31a7401ba 100644
--- a/quickevent/app/quickevent/plugins/Event/src/eventplugin.h
+++ b/quickevent/app/quickevent/plugins/Event/src/eventplugin.h
@@ -15,7 +15,7 @@
namespace qf::core::sql { class Query; class Connection; }
namespace qf::qmlwidgets { class Action; }
namespace qf::qmlwidgets::framework { class DockWidget; }
-namespace qf::core::model { class SqlTableModel; }
+namespace qf::qmlwidgets::model { class SqlTableModel; }
class QComboBox;
class DbSchema;
@@ -111,7 +111,7 @@ class EventPlugin : public qf::qmlwidgets::framework::Plugin
Q_SLOT void onInstalled();
- qf::core::model::SqlTableModel* registrationsModel();
+ qf::qmlwidgets::model::SqlTableModel* registrationsModel();
const qf::core::utils::Table& registrationsTable();
public:
@@ -162,7 +162,7 @@ class EventPlugin : public qf::qmlwidgets::framework::Plugin
qf::qmlwidgets::framework::DockWidget *m_servicesDockWidget = nullptr;
qf::qmlwidgets::framework::DockWidget *m_registrationsDockWidget = nullptr;
- qf::core::model::SqlTableModel *m_registrationsModel = nullptr;
+ qf::qmlwidgets::model::SqlTableModel *m_registrationsModel = nullptr;
qf::core::utils::Table m_registrationsTable;
};
diff --git a/quickevent/app/quickevent/plugins/Event/src/findregistrationedit.cpp b/quickevent/app/quickevent/plugins/Event/src/findregistrationedit.cpp
index bda32a23e..bc5bb9715 100644
--- a/quickevent/app/quickevent/plugins/Event/src/findregistrationedit.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/findregistrationedit.cpp
@@ -5,7 +5,7 @@
#include
#include
-#include
+#include
#include
#include
diff --git a/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.cpp b/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.cpp
index 737d33e81..5e5394574 100644
--- a/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.cpp
@@ -1,9 +1,9 @@
#include "lentcardssettingspage.h"
#include "ui_lentcardssettingspage.h"
-#include
+#include
-namespace qfm = qf::core::model;
+namespace qfm = qf::qmlwidgets::model;
namespace qfs = qf::core::sql;
LentCardsSettingsPage::LentCardsSettingsPage(QWidget *parent)
diff --git a/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.h b/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.h
index 683988bcf..2275d63a9 100644
--- a/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.h
+++ b/quickevent/app/quickevent/plugins/Event/src/lentcardssettingspage.h
@@ -8,9 +8,7 @@ namespace Ui {
class LentCardsSettingsPage;
}
-namespace qf {
-namespace core { namespace model { class SqlTableModel; } }
-}
+namespace qf::qmlwidgets::model { class SqlTableModel; }
class LentCardsSettingsPage : public Core::SettingsPage
{
@@ -27,6 +25,6 @@ class LentCardsSettingsPage : public Core::SettingsPage
private:
Ui::LentCardsSettingsPage *ui;
- qf::core::model::SqlTableModel *m_tableModel;
+ qf::qmlwidgets::model::SqlTableModel *m_tableModel;
};
diff --git a/quickevent/app/quickevent/plugins/Event/src/registrationswidget.cpp b/quickevent/app/quickevent/plugins/Event/src/registrationswidget.cpp
index b9b5b8264..3b2469b89 100644
--- a/quickevent/app/quickevent/plugins/Event/src/registrationswidget.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/registrationswidget.cpp
@@ -4,7 +4,7 @@
#include
-#include
+#include
#include
#include
#include
@@ -37,9 +37,9 @@ void RegistrationsWidget::checkModel()
return;
if(!ui->tblRegistrations->tableModel()) {
- qf::core::model::SqlTableModel *reg_model = getPlugin()->registrationsModel();
+ qf::qmlwidgets::model::SqlTableModel *reg_model = getPlugin()->registrationsModel();
ui->tblRegistrations->setTableModel(reg_model);
- connect(reg_model, &qf::core::model::SqlTableModel::reloaded, this, [this]() {
+ connect(reg_model, &qf::qmlwidgets::model::SqlTableModel::reloaded, this, [this]() {
ui->tblRegistrations->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
});
}
diff --git a/quickevent/app/quickevent/plugins/Event/src/services/qx/qxlateregistrationswidget.cpp b/quickevent/app/quickevent/plugins/Event/src/services/qx/qxlateregistrationswidget.cpp
index 1f79f9dc7..285209fca 100644
--- a/quickevent/app/quickevent/plugins/Event/src/services/qx/qxlateregistrationswidget.cpp
+++ b/quickevent/app/quickevent/plugins/Event/src/services/qx/qxlateregistrationswidget.cpp
@@ -8,14 +8,14 @@
#include
#include
-#include
+#include
#include