From bfef5ffe0ed40f39d6ce93d777ee8436a2c43cdc Mon Sep 17 00:00:00 2001 From: boutinb Date: Fri, 10 Jan 2025 13:47:05 +0100 Subject: [PATCH 01/14] Load QML Controls as QML Module The QML Module is also a plugin. All versions in QML import statement must be removed. --- Desktop/CMakeLists.txt | 2 +- .../components/JASP/Theme/DarkTheme.qml | 0 .../components/JASP/Theme/Theme.qml | 6 +- .../components/JASP/Theme/qmldir | 0 .../JASP/Widgets/AnalysisFormExpander.qml | 6 +- .../components/JASP/Widgets/AnalysisForms.qml | 5 +- .../JASP/Widgets/ComputeColumnWindow.qml | 8 +-- .../components/JASP/Widgets/CustomMenu.qml | 6 +- .../components/JASP/Widgets/EnginesWindow.qml | 10 +-- .../JASP/Widgets/FileMenu/BreadCrumbs.qml | 11 ++-- .../JASP/Widgets/FileMenu/Computer.qml | 11 ++-- .../JASP/Widgets/FileMenu/FileList.qml | 8 +-- .../JASP/Widgets/FileMenu/FileMenu.qml | 10 +-- .../JASP/Widgets/FileMenu/ListItem.qml | 6 +- .../JASP/Widgets/FileMenu/MenuHeader.qml | 13 ++-- .../components/JASP/Widgets/FileMenu/OSF.qml | 11 ++-- .../JASP/Widgets/FileMenu/PrefsAdvanced.qml | 8 +-- .../JASP/Widgets/FileMenu/PrefsGroupRect.qml | 13 ++-- .../JASP/Widgets/FileMenu/PrefsResults.qml | 9 ++- .../JASP/Widgets/FileMenu/PrefsUI.qml | 12 ++-- .../components/JASP/Widgets/FilterWindow.qml | 6 +- .../components/JASP/Widgets/HelpWindow.qml | 10 +-- .../components/JASP/Widgets/JASPDataView.qml | 10 +-- Desktop/components/JASP/Widgets/MainPage.qml | 2 +- .../components/JASP/Widgets/MessageBox.qml | 9 ++- .../JASP/Widgets/ModuleInstaller.qml | 11 ++-- .../Widgets/PlotEditor/PlotEditingAxis.qml | 16 ++--- .../JASP/Widgets/PlotEditor/PlotEditor.qml | 14 ++--- .../JASP/Widgets/RCommanderWindow.qml | 12 ++-- .../JASP/Widgets/RenameColumnDialog.qml | 6 +- Desktop/components/JASP/Widgets/SpinBox.qml | 8 +-- Desktop/gui/preferencesmodel.h | 3 +- Desktop/mainwindow.cpp | 27 +------- Docs/development/jasp-qml-style-example.qml | 10 +-- QMLComponents/CMakeLists.txt | 28 +++++---- QMLComponents/analysisform.cpp | 2 +- .../JASP/Controls/AddColumnField.qml | 6 +- .../JASP/Controls/BayesFactorType.qml | 4 +- .../components/JASP/Controls/CIField.qml | 6 +- .../Controls/CheckColumnIsFreeOrMineField.qml | 6 +- .../JASP/Controls/Chi2TestTableView.qml | 8 +-- .../components/JASP/Controls/ColorPalette.qml | 4 +- .../JASP/Controls/ComputedColumnField.qml | 5 +- .../Controls/CustomContrastsTableView.qml | 8 +-- .../components/JASP/Controls/DoubleField.qml | 6 +- .../Controls/{ComboBox.qml => DropDown.qml} | 0 .../JASP/Controls/FactorLevelList.qml | 8 +-- .../components/JASP/Controls/FactorsForm.qml | 9 ++- .../components/JASP/Controls/FactorsList.qml | 4 +- .../components/JASP/Controls/FileSelector.qml | 6 +- .../components/JASP/Controls/Form.qml | 10 +-- .../components/JASP/Controls/FormulaField.qml | 6 +- .../JASP/Controls/{GroupBox.qml => Group.qml} | 0 .../JASP/Controls/InputListView.qml | 8 +-- .../components/JASP/Controls/JAGSTextArea.qml | 6 +- .../JASP/Controls/JagsTableView.qml | 8 +-- .../components/JASP/Controls/MenuButton.qml | 8 +-- .../components/JASP/Controls/PercentField.qml | 7 +-- .../{ExpanderButton.qml => Section.qml} | 0 .../components/JASP/Controls/SetSeed.qml | 5 +- .../JASP/Controls/SimpleTableView.qml | 7 +-- .../JASP/Controls/SubjectivePriors.qml | 8 +-- QMLComponents/plugin.cpp | 62 +++++++++++++++++++ QMLComponents/preferencesmodelbase.h | 2 + QMLComponents/utilities/qmlutils.cpp | 28 +++++++++ QMLComponents/utilities/qmlutils.h | 3 +- 66 files changed, 316 insertions(+), 261 deletions(-) rename {QMLComponents => Desktop}/components/JASP/Theme/DarkTheme.qml (100%) rename {QMLComponents => Desktop}/components/JASP/Theme/Theme.qml (98%) rename {QMLComponents => Desktop}/components/JASP/Theme/qmldir (100%) rename QMLComponents/components/JASP/Controls/{ComboBox.qml => DropDown.qml} (100%) rename QMLComponents/components/JASP/Controls/{GroupBox.qml => Group.qml} (100%) rename QMLComponents/components/JASP/Controls/{ExpanderButton.qml => Section.qml} (100%) create mode 100644 QMLComponents/plugin.cpp diff --git a/Desktop/CMakeLists.txt b/Desktop/CMakeLists.txt index 9aabf55445..f1cd6bcdb8 100644 --- a/Desktop/CMakeLists.txt +++ b/Desktop/CMakeLists.txt @@ -218,7 +218,7 @@ qt_add_resources( file(GLOB_RECURSE QML_RESOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/components/*") qt_add_resources( JASP - "widgets" + "widgetsandtheme" PREFIX "/" BASE diff --git a/QMLComponents/components/JASP/Theme/DarkTheme.qml b/Desktop/components/JASP/Theme/DarkTheme.qml similarity index 100% rename from QMLComponents/components/JASP/Theme/DarkTheme.qml rename to Desktop/components/JASP/Theme/DarkTheme.qml diff --git a/QMLComponents/components/JASP/Theme/Theme.qml b/Desktop/components/JASP/Theme/Theme.qml similarity index 98% rename from QMLComponents/components/JASP/Theme/Theme.qml rename to Desktop/components/JASP/Theme/Theme.qml index a4212861ec..1d29f310c3 100644 --- a/QMLComponents/components/JASP/Theme/Theme.qml +++ b/Desktop/components/JASP/Theme/Theme.qml @@ -17,9 +17,9 @@ // -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import JASP 1.0 +import QtQuick +import QtQuick.Controls +import JASP JaspTheme { diff --git a/QMLComponents/components/JASP/Theme/qmldir b/Desktop/components/JASP/Theme/qmldir similarity index 100% rename from QMLComponents/components/JASP/Theme/qmldir rename to Desktop/components/JASP/Theme/qmldir diff --git a/Desktop/components/JASP/Widgets/AnalysisFormExpander.qml b/Desktop/components/JASP/Widgets/AnalysisFormExpander.qml index 4bba96abfe..09d527e3e5 100644 --- a/Desktop/components/JASP/Widgets/AnalysisFormExpander.qml +++ b/Desktop/components/JASP/Widgets/AnalysisFormExpander.qml @@ -1,6 +1,6 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Controls import Qt5Compat.GraphicalEffects DropArea diff --git a/Desktop/components/JASP/Widgets/AnalysisForms.qml b/Desktop/components/JASP/Widgets/AnalysisForms.qml index a7db37f252..a1eb8de20f 100644 --- a/Desktop/components/JASP/Widgets/AnalysisForms.qml +++ b/Desktop/components/JASP/Widgets/AnalysisForms.qml @@ -1,7 +1,6 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 +import QtQuick import JASP -import JASP.Controls 1.0 +import JASP.Controls FocusScope diff --git a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml index 300a5379fe..4f345cc24a 100644 --- a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml +++ b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml @@ -1,7 +1,7 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 -import JASP.Controls 1.0 as JaspControls +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import JASP.Controls as JaspControls import JASP import "FilterConstructor" diff --git a/Desktop/components/JASP/Widgets/CustomMenu.qml b/Desktop/components/JASP/Widgets/CustomMenu.qml index 555175b09b..1fa26022c7 100644 --- a/Desktop/components/JASP/Widgets/CustomMenu.qml +++ b/Desktop/components/JASP/Widgets/CustomMenu.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.15 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 as JASPControl +import QtQuick +import QtQuick.Controls +import JASP.Controls as JASPControl import Qt5Compat.GraphicalEffects FocusScope diff --git a/Desktop/components/JASP/Widgets/EnginesWindow.qml b/Desktop/components/JASP/Widgets/EnginesWindow.qml index 0398ca3eac..9889b989e4 100644 --- a/Desktop/components/JASP/Widgets/EnginesWindow.qml +++ b/Desktop/components/JASP/Widgets/EnginesWindow.qml @@ -1,8 +1,8 @@ -import QtQuick 2.12 -import QtQuick.Window 2.12 -import QtWebEngine 1.8 -import JASP.Widgets 1.0 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Window +import QtWebEngine +import JASP.Widgets +import JASP.Controls Window { diff --git a/Desktop/components/JASP/Widgets/FileMenu/BreadCrumbs.qml b/Desktop/components/JASP/Widgets/FileMenu/BreadCrumbs.qml index f6673df052..9baeb31110 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/BreadCrumbs.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/BreadCrumbs.qml @@ -1,9 +1,8 @@ -import QtQuick 2.11 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.4 - -import JASP.Widgets 1.0 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import JASP.Widgets +import JASP.Controls ListView { diff --git a/Desktop/components/JASP/Widgets/FileMenu/Computer.qml b/Desktop/components/JASP/Widgets/FileMenu/Computer.qml index 0012f4c30e..47246aced1 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/Computer.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/Computer.qml @@ -1,9 +1,8 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 - -import JASP.Controls 1.0 -import JASP.Widgets 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import JASP.Controls +import JASP.Widgets Item { diff --git a/Desktop/components/JASP/Widgets/FileMenu/FileList.qml b/Desktop/components/JASP/Widgets/FileMenu/FileList.qml index 7eeced8b7d..c2fdd234bb 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/FileList.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/FileList.qml @@ -1,6 +1,6 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Controls as JC ListView @@ -81,7 +81,7 @@ ListView hasBreadCrumbs: listView.breadCrumbs !== null } - JASPScrollBar + JC.JASPScrollBar { id: rightscrollbar flickable: parent diff --git a/Desktop/components/JASP/Widgets/FileMenu/FileMenu.qml b/Desktop/components/JASP/Widgets/FileMenu/FileMenu.qml index fcf116fbfc..51341c2f72 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/FileMenu.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/FileMenu.qml @@ -1,10 +1,10 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts -import JASP.Controls 1.0 +import JASP.Controls import JASP -import FileOperation 1.0 +import FileOperation FocusScope { diff --git a/Desktop/components/JASP/Widgets/FileMenu/ListItem.qml b/Desktop/components/JASP/Widgets/FileMenu/ListItem.qml index 42d7f2d53f..bcf6764dde 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/ListItem.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/ListItem.qml @@ -1,7 +1,5 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 - +import QtQuick +import QtQuick.Controls FocusScope { diff --git a/Desktop/components/JASP/Widgets/FileMenu/MenuHeader.qml b/Desktop/components/JASP/Widgets/FileMenu/MenuHeader.qml index d5e3b244fe..36e064a013 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/MenuHeader.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/MenuHeader.qml @@ -1,9 +1,8 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 - -import JASP.Widgets 1.0 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls as QtC +import QtQuick.Layouts +import JASP.Widgets +import JASP.Controls Item { @@ -63,7 +62,7 @@ Item } } - ToolSeparator + QtC.ToolSeparator { id: firstSeparator diff --git a/Desktop/components/JASP/Widgets/FileMenu/OSF.qml b/Desktop/components/JASP/Widgets/FileMenu/OSF.qml index 780fca7edb..7d1a45722a 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/OSF.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/OSF.qml @@ -16,11 +16,10 @@ // . // -import QtQuick 2.0 -import QtQuick.Controls 2.2 - -import JASP.Controls 1.0 -import JASP.Widgets 1.0 +import QtQuick +import QtQuick.Controls as QtC +import JASP.Controls +import JASP.Widgets //import QtQuick.Layouts 1.3 @@ -120,7 +119,7 @@ Item sortMenuModel: fileMenuModel.osf.sortedMenuModel } - ToolSeparator + QtC.ToolSeparator { id : firstSeparator visible : loggedin diff --git a/Desktop/components/JASP/Widgets/FileMenu/PrefsAdvanced.qml b/Desktop/components/JASP/Widgets/FileMenu/PrefsAdvanced.qml index ae7e61be6b..31d929c84b 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/PrefsAdvanced.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/PrefsAdvanced.qml @@ -1,7 +1,7 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import JASP.Widgets 1.0 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Widgets +import JASP.Controls ScrollView { diff --git a/Desktop/components/JASP/Widgets/FileMenu/PrefsGroupRect.qml b/Desktop/components/JASP/Widgets/FileMenu/PrefsGroupRect.qml index 3f079553f0..762447bd42 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/PrefsGroupRect.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/PrefsGroupRect.qml @@ -1,10 +1,9 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.3 -import JASP.Widgets 1.0 - -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import JASP.Widgets +import JASP.Controls +import JASP Rectangle { diff --git a/Desktop/components/JASP/Widgets/FileMenu/PrefsResults.qml b/Desktop/components/JASP/Widgets/FileMenu/PrefsResults.qml index f9698486d9..4b078b7c8a 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/PrefsResults.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/PrefsResults.qml @@ -1,8 +1,7 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Widgets 1.0 - -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Widgets +import JASP.Controls ScrollView { diff --git a/Desktop/components/JASP/Widgets/FileMenu/PrefsUI.qml b/Desktop/components/JASP/Widgets/FileMenu/PrefsUI.qml index 791e3d614f..bfa8e464ee 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/PrefsUI.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/PrefsUI.qml @@ -1,8 +1,8 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import QtQuick.Layouts 1.3 as L -import JASP.Widgets 1.0 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts as L +import JASP.Widgets +import JASP.Controls ScrollView { @@ -80,7 +80,7 @@ ScrollView } } - GroupBox + Group { width: parent.width diff --git a/Desktop/components/JASP/Widgets/FilterWindow.qml b/Desktop/components/JASP/Widgets/FilterWindow.qml index a2dab847e7..0c7af7ac87 100644 --- a/Desktop/components/JASP/Widgets/FilterWindow.qml +++ b/Desktop/components/JASP/Widgets/FilterWindow.qml @@ -1,6 +1,6 @@ -import QtQuick 2.12 -import QtQuick.Controls 2.12 -import JASP.Controls 1.0 as JaspControls +import QtQuick +import QtQuick.Controls +import JASP.Controls as JaspControls import "FilterConstructor" import JASP diff --git a/Desktop/components/JASP/Widgets/HelpWindow.qml b/Desktop/components/JASP/Widgets/HelpWindow.qml index 968c30e0bd..e288a30f77 100644 --- a/Desktop/components/JASP/Widgets/HelpWindow.qml +++ b/Desktop/components/JASP/Widgets/HelpWindow.qml @@ -1,8 +1,8 @@ -import QtQuick 2.12 -import QtQuick.Window 2.12 -import QtWebEngine 1.8 -import JASP.Widgets 1.0 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Window +import QtWebEngine +import JASP.Widgets +import JASP.Controls Window { diff --git a/Desktop/components/JASP/Widgets/JASPDataView.qml b/Desktop/components/JASP/Widgets/JASPDataView.qml index cd968cd48b..1d2ddf06bc 100644 --- a/Desktop/components/JASP/Widgets/JASPDataView.qml +++ b/Desktop/components/JASP/Widgets/JASPDataView.qml @@ -1,9 +1,9 @@ -import QtQuick 2.9 -import QtQuick.Window 2.3 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Window +import QtQuick.Controls -import JASP.Controls 1.0 -import JASP 1.0 +import JASP.Controls +import JASP FocusScope { diff --git a/Desktop/components/JASP/Widgets/MainPage.qml b/Desktop/components/JASP/Widgets/MainPage.qml index baa6b9dab5..538c078d80 100644 --- a/Desktop/components/JASP/Widgets/MainPage.qml +++ b/Desktop/components/JASP/Widgets/MainPage.qml @@ -21,7 +21,7 @@ import QtWebEngine import QtWebChannel import JASP import QtQuick.Controls -import JASP.Controls 1.0 as JC +import JASP.Controls as JC Item { diff --git a/Desktop/components/JASP/Widgets/MessageBox.qml b/Desktop/components/JASP/Widgets/MessageBox.qml index 6fdd34f8c5..b62cf3f308 100644 --- a/Desktop/components/JASP/Widgets/MessageBox.qml +++ b/Desktop/components/JASP/Widgets/MessageBox.qml @@ -1,10 +1,9 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 -//import QtQuick.Dialogs 1.2 +import QtQuick +import QtQuick.Controls as QtC +import JASP.Controls -Popup +QtC.Popup //MessageDialog { id: messageRoot diff --git a/Desktop/components/JASP/Widgets/ModuleInstaller.qml b/Desktop/components/JASP/Widgets/ModuleInstaller.qml index fa71a66adc..e8ad427d9a 100644 --- a/Desktop/components/JASP/Widgets/ModuleInstaller.qml +++ b/Desktop/components/JASP/Widgets/ModuleInstaller.qml @@ -16,12 +16,11 @@ // . // -import QtQuick 2.11 -import QtQuick.Controls 2.7 as QTCONTROLS -import Qt.labs.folderlistmodel 2.11 -//import QtQuick.Window 2.3 -import JASP.Controls 1.0 -import JASP.Widgets 1.0 +import QtQuick +import QtQuick.Controls as QTCONTROLS +import Qt.labs.folderlistmodel +import JASP.Controls +import JASP.Widgets QTCONTROLS.Popup { diff --git a/Desktop/components/JASP/Widgets/PlotEditor/PlotEditingAxis.qml b/Desktop/components/JASP/Widgets/PlotEditor/PlotEditingAxis.qml index 2681fcfdc0..98f5e24cc4 100644 --- a/Desktop/components/JASP/Widgets/PlotEditor/PlotEditingAxis.qml +++ b/Desktop/components/JASP/Widgets/PlotEditor/PlotEditingAxis.qml @@ -1,11 +1,11 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.Layouts 1.3 -import JASP.Widgets 1.0 as JASPW -import JASP.Theme 1.0 -import JASP.Controls 1.0 as JASPC -import JASP.PlotEditor 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import JASP.Widgets as JASPW +import JASP.Theme +import JASP.Controls as JASPC +import JASP.PlotEditor +import JASP /* TODO: it might make sense to add a global title/ box around all the options inside one axis. diff --git a/Desktop/components/JASP/Widgets/PlotEditor/PlotEditor.qml b/Desktop/components/JASP/Widgets/PlotEditor/PlotEditor.qml index 06f01415a7..a505a7ef41 100644 --- a/Desktop/components/JASP/Widgets/PlotEditor/PlotEditor.qml +++ b/Desktop/components/JASP/Widgets/PlotEditor/PlotEditor.qml @@ -1,10 +1,10 @@ -import QtQuick 2.14 -import QtQuick.Controls 6.0 -import QtQuick.Layouts 1.3 -import JASP.Widgets 1.0 as JASPW -import JASP.Theme 1.0 -import JASP.Controls 1.0 as JASPC -import JASP.PlotEditor 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import JASP.Widgets as JASPW +import JASP.Theme +import JASP.Controls as JASPC +import JASP.PlotEditor Popup { diff --git a/Desktop/components/JASP/Widgets/RCommanderWindow.qml b/Desktop/components/JASP/Widgets/RCommanderWindow.qml index cc8907a622..f8c9ca197a 100644 --- a/Desktop/components/JASP/Widgets/RCommanderWindow.qml +++ b/Desktop/components/JASP/Widgets/RCommanderWindow.qml @@ -16,12 +16,12 @@ // . // -import QtQuick 2.12 -import QtQuick.Window 2.12 -import QtQuick.Controls 2.12 -import JASP 1.0 -import JASP.Widgets 1.0 as JW -import JASP.Controls 1.0 as JC +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import JASP +import JASP.Widgets as JW +import JASP.Controls as JC Window { diff --git a/Desktop/components/JASP/Widgets/RenameColumnDialog.qml b/Desktop/components/JASP/Widgets/RenameColumnDialog.qml index 81d9157444..26b11929d5 100644 --- a/Desktop/components/JASP/Widgets/RenameColumnDialog.qml +++ b/Desktop/components/JASP/Widgets/RenameColumnDialog.qml @@ -1,6 +1,6 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Controls Popup { diff --git a/Desktop/components/JASP/Widgets/SpinBox.qml b/Desktop/components/JASP/Widgets/SpinBox.qml index ea0d936746..6935273b4e 100644 --- a/Desktop/components/JASP/Widgets/SpinBox.qml +++ b/Desktop/components/JASP/Widgets/SpinBox.qml @@ -16,10 +16,10 @@ // . // -import QtQuick 2.11 -import QtQuick.Controls 2.5 -import JASP.Controls 1.0 as JaspControls -import JASP 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Controls as JaspControls +import JASP Item { diff --git a/Desktop/gui/preferencesmodel.h b/Desktop/gui/preferencesmodel.h index a000082dd7..04b510d009 100644 --- a/Desktop/gui/preferencesmodel.h +++ b/Desktop/gui/preferencesmodel.h @@ -145,7 +145,7 @@ class PreferencesModel : public PreferencesModelBase void zoomReset(); int maxEnginesAdmin() const; bool developerMode() const; - bool ALTNavModeActive() const; + bool ALTNavModeActive() const override; bool orderByValueByDefault() const; int maxScaleLevels() const override; QVariantList pdfPageSizeModel() const { return _pdfPageSizeModel; } @@ -273,7 +273,6 @@ public slots: void guiQtTextRenderChanged( bool guiQtTextRender); void reportingModeChanged( bool reportingMode); void showRSyntaxInResultsChanged( bool showRSyntax); - void ALTNavModeActiveChanged( bool ALTNavModeActive); void aboutToChangeEmptyValues( QStringList newValues); void orderByValueByDefaultChanged( bool orderByValueByDefault); void checkUpdatesAskUserChanged( bool checkAsk); diff --git a/Desktop/mainwindow.cpp b/Desktop/mainwindow.cpp index 2223c3771b..912172718b 100644 --- a/Desktop/mainwindow.cpp +++ b/Desktop/mainwindow.cpp @@ -195,6 +195,7 @@ MainWindow::MainWindow(QApplication * application) : QObject(application), _appl ALTNavigation::registerQMLTypes("JASP"); ALTNavControl::ctrl()->enableAlTNavigation(_preferences->ALTNavModeActive()); + QmlUtils::setGlobalPropertiesInQMLContext(_qml->rootContext()); _dynamicModules->registerQMLTypes(); @@ -636,31 +637,6 @@ void MainWindow::loadQML() _qml->rootContext()->setContextProperty("computedColumnTypeConstructorCode", int(computedColumnType::constructorCode) ); _qml->rootContext()->setContextProperty("computedColumnTypeAnalysisNotComputed", int(computedColumnType::analysisNotComputed) ); - - bool debug = false, - isMac = false, - isLinux = false; - -#ifdef JASP_DEBUG - debug = true; -#endif - -#ifdef __APPLE__ - isMac = true; -#endif - -#ifdef __linux__ - isLinux = true; -#endif - - bool isWindows = !isMac && !isLinux; - - _qml->rootContext()->setContextProperty("DEBUG_MODE", debug); - _qml->rootContext()->setContextProperty("MACOS", isMac); - _qml->rootContext()->setContextProperty("LINUX", isLinux); - _qml->rootContext()->setContextProperty("WINDOWS", isWindows); - _qml->rootContext()->setContextProperty("INTERACTION_SEPARATOR", Term::separator); - _qml->setOutputWarningsToStandardError(true); setQmlImportPaths(); @@ -760,6 +736,7 @@ void MainWindow::setQmlImportPaths() QStringList newImportPaths = originalImportPaths; + newImportPaths.append(":/jasp-stats.org/imports"); newImportPaths.append("qrc:///components"); newImportPaths.append(_dynamicModules->importPaths()); diff --git a/Docs/development/jasp-qml-style-example.qml b/Docs/development/jasp-qml-style-example.qml index 1a8638cce0..1120519173 100644 --- a/Docs/development/jasp-qml-style-example.qml +++ b/Docs/development/jasp-qml-style-example.qml @@ -2,16 +2,16 @@ //Comments (like this) will describe what the "approved" style is and how to use it. //Make sure you indent using tabs and *not* with spaces. The tabs should have a 4-space width. -import QtQuick 2.8 -import QtQuick.Layouts 1.3 -import JASP.Controls 1.0 -import JASP.Widgets 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls +import JASP.Widgets //Not exactly a style thing but every QML form should have Form as it's root: Form { //Opening braces should on their own line and at the exact same indent as the closing brace. - GroupBox //A subitem is indented and always has a space between the previous subitem/property/function + Group //A subitem is indented and always has a space between the previous subitem/property/function { title: qsTr("A nice grouping of elements") //putting qsTr(...) around string constants allows us to make the interface translatable. diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index ce42019b0b..1c5785dc88 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -4,8 +4,21 @@ list(APPEND CMAKE_MESSAGE_CONTEXT QMLComponents) file(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/*.h") file(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") +file(GLOB_RECURSE QML_FILES RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "components/JASP/Controls/*.qml") -add_library(QMLComponents ${SOURCE_FILES} ${HEADER_FILES}) +qt_add_qml_module(QMLComponents + URI JASP.Controls + #STATIC + OUTPUT_DIRECTORY "JASP/Controls" + RESOURCE_PREFIX /jasp-stats.org/imports + #PLUGIN_TARGET jaspcontrolsplugin + DEPENDENCIES QtQuick + #NO_PLUGIN_OPTIONAL + NO_GENERATE_PLUGIN_SOURCE + CLASS_NAME JASPQmlPlugin + SOURCES ${SOURCE_FILES} ${HEADER_FILES} + QML_FILES ${QML_FILES} +) if(LINUX) target_link_libraries(QMLComponents PUBLIC ${_LIB_RT}) @@ -30,6 +43,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/CommonData ) + target_link_libraries( QMLComponents PUBLIC @@ -49,16 +63,4 @@ target_link_libraries( $<$:/app/lib/$ENV{FLATPAK_ARCH}-linux-gnu/libQt6Core5Compat.so> ) -file(GLOB_RECURSE QML_RESOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/components/*") - -qt_add_resources( - QMLComponents - "qmlComponents" - PREFIX - "/" - BASE - ${CMAKE_CURRENT_LIST_DIR} - FILES - ${QML_RESOURCE_FILES}) - list(POP_BACK CMAKE_MESSAGE_CONTEXT) diff --git a/QMLComponents/analysisform.cpp b/QMLComponents/analysisform.cpp index 8daa6b50fa..cb2bc116a8 100644 --- a/QMLComponents/analysisform.cpp +++ b/QMLComponents/analysisform.cpp @@ -913,7 +913,7 @@ QString AnalysisForm::helpMD() const orderedControls.removeIf([](JASPControl* c) { return c->helpMD().isEmpty(); }); if (orderedControls.length() > 0 && orderedControls[0]->controlType() != JASPControl::ControlType::Expander) - // If the first control is an ExpanderButton, then it adds already a line + // If the first control is an Section, then it adds already a line markdown << "\n---\n"; for(JASPControl * control : orderedControls) diff --git a/QMLComponents/components/JASP/Controls/AddColumnField.qml b/QMLComponents/components/JASP/Controls/AddColumnField.qml index 85ccacfb0d..32dfc4da5f 100644 --- a/QMLComponents/components/JASP/Controls/AddColumnField.qml +++ b/QMLComponents/components/JASP/Controls/AddColumnField.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP TextField { diff --git a/QMLComponents/components/JASP/Controls/BayesFactorType.qml b/QMLComponents/components/JASP/Controls/BayesFactorType.qml index 9076f03cdd..c127cb1a70 100644 --- a/QMLComponents/components/JASP/Controls/BayesFactorType.qml +++ b/QMLComponents/components/JASP/Controls/BayesFactorType.qml @@ -17,8 +17,8 @@ // -import QtQuick 2.8 -import JASP.Controls 1.0 +import QtQuick +import JASP.Controls RadioButtonGroup diff --git a/QMLComponents/components/JASP/Controls/CIField.qml b/QMLComponents/components/JASP/Controls/CIField.qml index 2a9556833f..61d5d3524e 100644 --- a/QMLComponents/components/JASP/Controls/CIField.qml +++ b/QMLComponents/components/JASP/Controls/CIField.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP PercentField { diff --git a/QMLComponents/components/JASP/Controls/CheckColumnIsFreeOrMineField.qml b/QMLComponents/components/JASP/Controls/CheckColumnIsFreeOrMineField.qml index 22d6835f98..204a4ee29c 100644 --- a/QMLComponents/components/JASP/Controls/CheckColumnIsFreeOrMineField.qml +++ b/QMLComponents/components/JASP/Controls/CheckColumnIsFreeOrMineField.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP TextField { diff --git a/QMLComponents/components/JASP/Controls/Chi2TestTableView.qml b/QMLComponents/components/JASP/Controls/Chi2TestTableView.qml index 240c9ee791..c71b35e518 100644 --- a/QMLComponents/components/JASP/Controls/Chi2TestTableView.qml +++ b/QMLComponents/components/JASP/Controls/Chi2TestTableView.qml @@ -17,10 +17,10 @@ // -import QtQuick 2.0 -import QtQuick.Layouts 1.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls +import JASP BasicThreeButtonTableView { diff --git a/QMLComponents/components/JASP/Controls/ColorPalette.qml b/QMLComponents/components/JASP/Controls/ColorPalette.qml index 841ad4c1d3..324919de33 100644 --- a/QMLComponents/components/JASP/Controls/ColorPalette.qml +++ b/QMLComponents/components/JASP/Controls/ColorPalette.qml @@ -17,8 +17,8 @@ // -import QtQuick 2.8 -import JASP.Controls 1.0 +import QtQuick +import JASP.Controls DropDown { diff --git a/QMLComponents/components/JASP/Controls/ComputedColumnField.qml b/QMLComponents/components/JASP/Controls/ComputedColumnField.qml index a7f72a4b35..dbd4f6aff4 100644 --- a/QMLComponents/components/JASP/Controls/ComputedColumnField.qml +++ b/QMLComponents/components/JASP/Controls/ComputedColumnField.qml @@ -16,9 +16,8 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls TextField { diff --git a/QMLComponents/components/JASP/Controls/CustomContrastsTableView.qml b/QMLComponents/components/JASP/Controls/CustomContrastsTableView.qml index 8dfb8b7c93..f1f9f905eb 100644 --- a/QMLComponents/components/JASP/Controls/CustomContrastsTableView.qml +++ b/QMLComponents/components/JASP/Controls/CustomContrastsTableView.qml @@ -17,10 +17,10 @@ // -import QtQuick 2.0 -import QtQuick.Layouts 1.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls +import JASP BasicThreeButtonTableView { diff --git a/QMLComponents/components/JASP/Controls/DoubleField.qml b/QMLComponents/components/JASP/Controls/DoubleField.qml index 1e4482f3f9..dab013d9d8 100644 --- a/QMLComponents/components/JASP/Controls/DoubleField.qml +++ b/QMLComponents/components/JASP/Controls/DoubleField.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP TextField { diff --git a/QMLComponents/components/JASP/Controls/ComboBox.qml b/QMLComponents/components/JASP/Controls/DropDown.qml similarity index 100% rename from QMLComponents/components/JASP/Controls/ComboBox.qml rename to QMLComponents/components/JASP/Controls/DropDown.qml diff --git a/QMLComponents/components/JASP/Controls/FactorLevelList.qml b/QMLComponents/components/JASP/Controls/FactorLevelList.qml index 38844ed211..3c11b231e5 100644 --- a/QMLComponents/components/JASP/Controls/FactorLevelList.qml +++ b/QMLComponents/components/JASP/Controls/FactorLevelList.qml @@ -16,10 +16,10 @@ // . // -import QtQuick 2.11 -import QtQml.Models 2.2 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQml.Models +import JASP.Controls +import JASP FactorLevelListBase { diff --git a/QMLComponents/components/JASP/Controls/FactorsForm.qml b/QMLComponents/components/JASP/Controls/FactorsForm.qml index 32d085b583..78581af35c 100644 --- a/QMLComponents/components/JASP/Controls/FactorsForm.qml +++ b/QMLComponents/components/JASP/Controls/FactorsForm.qml @@ -1,8 +1,7 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 -import JASP 1.0 -import QtQuick.Layouts 1.3 +import QtQuick +import JASP.Controls +import JASP +import QtQuick.Layouts FactorsFormBase { diff --git a/QMLComponents/components/JASP/Controls/FactorsList.qml b/QMLComponents/components/JASP/Controls/FactorsList.qml index e5808df36a..1a3945625f 100644 --- a/QMLComponents/components/JASP/Controls/FactorsList.qml +++ b/QMLComponents/components/JASP/Controls/FactorsList.qml @@ -1,5 +1,5 @@ -import QtQuick 2.8 -import JASP.Controls 1.0 +import QtQuick +import JASP.Controls AssignedVariablesList { diff --git a/QMLComponents/components/JASP/Controls/FileSelector.qml b/QMLComponents/components/JASP/Controls/FileSelector.qml index 744e4b9979..3a62f21925 100644 --- a/QMLComponents/components/JASP/Controls/FileSelector.qml +++ b/QMLComponents/components/JASP/Controls/FileSelector.qml @@ -1,6 +1,6 @@ -import JASP 1.0 -import JASP.Controls 1.0 -import QtQuick 2.11 as QT +import JASP +import JASP.Controls +import QtQuick as QT TextField { diff --git a/QMLComponents/components/JASP/Controls/Form.qml b/QMLComponents/components/JASP/Controls/Form.qml index 83cf28a43d..15d9e770a2 100644 --- a/QMLComponents/components/JASP/Controls/Form.qml +++ b/QMLComponents/components/JASP/Controls/Form.qml @@ -15,10 +15,10 @@ // License along with this program. If not, see // . // -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Controls as QtC +import JASP.Controls +import JASP AnalysisForm { @@ -194,7 +194,7 @@ AnalysisForm label: qsTr("Generate Wrapper") onClicked: popup.open() - Popup + QtC.Popup { id: popup diff --git a/QMLComponents/components/JASP/Controls/FormulaField.qml b/QMLComponents/components/JASP/Controls/FormulaField.qml index afb3f0dec2..dba9af7301 100644 --- a/QMLComponents/components/JASP/Controls/FormulaField.qml +++ b/QMLComponents/components/JASP/Controls/FormulaField.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP TextField { diff --git a/QMLComponents/components/JASP/Controls/GroupBox.qml b/QMLComponents/components/JASP/Controls/Group.qml similarity index 100% rename from QMLComponents/components/JASP/Controls/GroupBox.qml rename to QMLComponents/components/JASP/Controls/Group.qml diff --git a/QMLComponents/components/JASP/Controls/InputListView.qml b/QMLComponents/components/JASP/Controls/InputListView.qml index 95f65152c7..2e707e96c2 100644 --- a/QMLComponents/components/JASP/Controls/InputListView.qml +++ b/QMLComponents/components/JASP/Controls/InputListView.qml @@ -16,10 +16,10 @@ // . // -import QtQuick 2.11 -import QtQml.Models 2.2 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQml.Models +import JASP.Controls +import JASP InputListBase { diff --git a/QMLComponents/components/JASP/Controls/JAGSTextArea.qml b/QMLComponents/components/JASP/Controls/JAGSTextArea.qml index aa877610ac..997baf9bbc 100644 --- a/QMLComponents/components/JASP/Controls/JAGSTextArea.qml +++ b/QMLComponents/components/JASP/Controls/JAGSTextArea.qml @@ -1,6 +1,6 @@ -import QtQuick 2.0 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP TextArea { diff --git a/QMLComponents/components/JASP/Controls/JagsTableView.qml b/QMLComponents/components/JASP/Controls/JagsTableView.qml index 03bde0fcc6..58cb16cdf6 100644 --- a/QMLComponents/components/JASP/Controls/JagsTableView.qml +++ b/QMLComponents/components/JASP/Controls/JagsTableView.qml @@ -17,10 +17,10 @@ // -import QtQuick 2.0 -import QtQuick.Layouts 1.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls +import JASP BasicThreeButtonTableView { diff --git a/QMLComponents/components/JASP/Controls/MenuButton.qml b/QMLComponents/components/JASP/Controls/MenuButton.qml index fc83fb5434..512fc05bdc 100644 --- a/QMLComponents/components/JASP/Controls/MenuButton.qml +++ b/QMLComponents/components/JASP/Controls/MenuButton.qml @@ -1,7 +1,7 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import JASP.Controls RoundedButton { diff --git a/QMLComponents/components/JASP/Controls/PercentField.qml b/QMLComponents/components/JASP/Controls/PercentField.qml index 3f18153c7e..a9d4fed043 100644 --- a/QMLComponents/components/JASP/Controls/PercentField.qml +++ b/QMLComponents/components/JASP/Controls/PercentField.qml @@ -16,10 +16,9 @@ // . // -import QtQuick 2.11 -import JASP.Controls 1.0 - -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP DoubleField { diff --git a/QMLComponents/components/JASP/Controls/ExpanderButton.qml b/QMLComponents/components/JASP/Controls/Section.qml similarity index 100% rename from QMLComponents/components/JASP/Controls/ExpanderButton.qml rename to QMLComponents/components/JASP/Controls/Section.qml diff --git a/QMLComponents/components/JASP/Controls/SetSeed.qml b/QMLComponents/components/JASP/Controls/SetSeed.qml index a867c10f5f..549b462eb5 100644 --- a/QMLComponents/components/JASP/Controls/SetSeed.qml +++ b/QMLComponents/components/JASP/Controls/SetSeed.qml @@ -1,5 +1,5 @@ // -// Copyright (C) 2013-2018 University of Amsterdam +// Copyright (C) 2013-2025 University of Amsterdam // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as @@ -17,8 +17,7 @@ // -import QtQuick 2.8 -import JASP.Controls 1.0 +import JASP.Controls Group { diff --git a/QMLComponents/components/JASP/Controls/SimpleTableView.qml b/QMLComponents/components/JASP/Controls/SimpleTableView.qml index b551acd093..06686cb9e3 100644 --- a/QMLComponents/components/JASP/Controls/SimpleTableView.qml +++ b/QMLComponents/components/JASP/Controls/SimpleTableView.qml @@ -17,10 +17,9 @@ // -import QtQuick 2.0 -import QtQuick.Layouts 1.11 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP BasicThreeButtonTableView { diff --git a/QMLComponents/components/JASP/Controls/SubjectivePriors.qml b/QMLComponents/components/JASP/Controls/SubjectivePriors.qml index 1a04d27a41..d1d0588676 100644 --- a/QMLComponents/components/JASP/Controls/SubjectivePriors.qml +++ b/QMLComponents/components/JASP/Controls/SubjectivePriors.qml @@ -17,10 +17,10 @@ // -import QtQuick 2.8 -import QtQuick.Layouts 1.3 -import JASP.Controls 1.0 -import JASP 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls +import JASP Section { diff --git a/QMLComponents/plugin.cpp b/QMLComponents/plugin.cpp new file mode 100644 index 0000000000..233ccc4078 --- /dev/null +++ b/QMLComponents/plugin.cpp @@ -0,0 +1,62 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#include +#include +#include +#include "preferencesmodelbase.h" +#include "jasptheme.h" +#include "controls/jaspcontrol.h" +#include +#include "knownissues.h" +#include "utilities/qmlutils.h" + + +//![plugin] +class JASPQmlPlugin : public QQmlEngineExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QQmlEngineExtensionInterface_iid) + + + void initializeEngine(QQmlEngine *engine, const char *uri) override + { + QQmlEngineExtensionPlugin::initializeEngine(engine, uri); + + QLocale::setDefault(QLocale(QLocale::English)); // make decimal points == . + + QmlUtils::setGlobalPropertiesInQMLContext(engine->rootContext()); + + PreferencesModelBase* prefModel = engine->rootContext()->contextProperty("preferencesModel").value(); + if (prefModel == nullptr) + { + prefModel = new PreferencesModelBase(); + engine->rootContext()->setContextProperty("preferencesModel", prefModel); + } + + if (engine->rootContext()->contextProperty("jaspTheme").isNull()) + { + JaspTheme* defaultJaspTheme = new JaspTheme(); + defaultJaspTheme->setIconPath("/default/"); + engine->rootContext()->setContextProperty("jaspTheme", defaultJaspTheme ); + } + + qmlRegisterUncreatableMetaObject(JASPControl::staticMetaObject, // static meta object + "JASP.Controls", // import statement + 0, 1, // major and minor version of the import + "JASP", // name in QML + "Error: only enums"); + if (!KnownIssues::issues()) + new KnownIssues(this); + + // TODO: I don't know anymore why I had to add these lines for the pilot project. It does not seem to be needed. + // ALTNavControl::ctrl()->enableAlTNavigation(prefModel->ALTNavModeActive()); + // connect(prefModel, &PreferencesModelBase::ALTNavModeActiveChanged, ALTNavControl::ctrl(), &ALTNavControl::enableAlTNavigation); + + } +}; +//![plugin] + +#include "plugin.moc" + + diff --git a/QMLComponents/preferencesmodelbase.h b/QMLComponents/preferencesmodelbase.h index 603fd791f1..3fdf2c4939 100644 --- a/QMLComponents/preferencesmodelbase.h +++ b/QMLComponents/preferencesmodelbase.h @@ -24,6 +24,7 @@ public slots: virtual void setCurrentThemeName(QString currentThemeName) {} virtual void setShowRSyntax(bool showRSyntax) {} virtual void setShowAllROptions(bool showAllROptions) {} + virtual bool ALTNavModeActive() const { return false; } signals: void ribbonBarHeightScaleChanged(float height); @@ -34,6 +35,7 @@ public slots: void interfaceFontChanged(); void showRSyntaxChanged(); void showAllROptionsChanged(); + void ALTNavModeActiveChanged(bool ALTNavModeActive); protected: static PreferencesModelBase* _singleton; diff --git a/QMLComponents/utilities/qmlutils.cpp b/QMLComponents/utilities/qmlutils.cpp index f0c09bbe04..794935b809 100644 --- a/QMLComponents/utilities/qmlutils.cpp +++ b/QMLComponents/utilities/qmlutils.cpp @@ -5,6 +5,7 @@ #include "qutils.h" #include "log.h" #include "columnencoder.h" +#include "models/term.h" #ifdef linux #include @@ -169,3 +170,30 @@ QDir QmlUtils::generateQMLCacheDir() } #endif + +void QmlUtils::setGlobalPropertiesInQMLContext(QQmlContext * ctxt) +{ + bool debug = false, + isMac = false, + isLinux = false; + +#ifdef JASP_DEBUG + debug = true; +#endif + +#ifdef __APPLE__ + isMac = true; +#endif + +#ifdef __linux__ + isLinux = true; +#endif + + bool isWindows = !isMac && !isLinux; + + ctxt->setContextProperty("DEBUG_MODE", debug); + ctxt->setContextProperty("MACOS", isMac); + ctxt->setContextProperty("LINUX", isLinux); + ctxt->setContextProperty("WINDOWS", isWindows); + ctxt->setContextProperty("INTERACTION_SEPARATOR", Term::separator); +} diff --git a/QMLComponents/utilities/qmlutils.h b/QMLComponents/utilities/qmlutils.h index 847488ea83..b2e30df4df 100644 --- a/QMLComponents/utilities/qmlutils.h +++ b/QMLComponents/utilities/qmlutils.h @@ -27,6 +27,8 @@ class QmlUtils : public QObject static QDir generateQMLCacheDir(); #endif + static void setGlobalPropertiesInQMLContext(QQmlContext * ctxt); + public slots: QString encodeAllColumnNames( const QString & str); QString decodeAllColumnNames( const QString & str); @@ -39,5 +41,4 @@ public slots: QObject * instantiateQml( const QUrl & filePath, const std::string & moduleName, QQmlContext * ctxt = nullptr); QObject * instantiateQml(const QString & qmlTxt, const QUrl & url, const std::string & moduleName, const std::string & whatAmILoading, const std::string & filename, QQmlContext * ctxt = nullptr); - #endif // QMLUTILS_H From f54810c1dcf82440d2f11359a205a47fbde052b3 Mon Sep 17 00:00:00 2001 From: boutinb Date: Fri, 10 Jan 2025 15:03:12 +0100 Subject: [PATCH 02/14] More --- Docs/development/jasp-qml-style-example.qml | 1 - QMLComponents/components/JASP/Controls/Form.qml | 2 +- QMLComponents/components/JASP/Controls/HelpButton.qml | 6 +++--- QMLComponents/components/JASP/Controls/Slider.qml | 10 +++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Docs/development/jasp-qml-style-example.qml b/Docs/development/jasp-qml-style-example.qml index 1120519173..0c936f231b 100644 --- a/Docs/development/jasp-qml-style-example.qml +++ b/Docs/development/jasp-qml-style-example.qml @@ -5,7 +5,6 @@ import QtQuick import QtQuick.Layouts import JASP.Controls -import JASP.Widgets //Not exactly a style thing but every QML form should have Form as it's root: Form diff --git a/QMLComponents/components/JASP/Controls/Form.qml b/QMLComponents/components/JASP/Controls/Form.qml index 15d9e770a2..22be130d29 100644 --- a/QMLComponents/components/JASP/Controls/Form.qml +++ b/QMLComponents/components/JASP/Controls/Form.qml @@ -198,7 +198,7 @@ AnalysisForm { id: popup - parent: Overlay.overlay + parent: QtC.Overlay.overlay anchors.centerIn: parent width: 400 * jaspTheme.uiScale diff --git a/QMLComponents/components/JASP/Controls/HelpButton.qml b/QMLComponents/components/JASP/Controls/HelpButton.qml index 59acd29892..de7a5ef96b 100644 --- a/QMLComponents/components/JASP/Controls/HelpButton.qml +++ b/QMLComponents/components/JASP/Controls/HelpButton.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.8 -import QtQuick.Layouts 1.3 -import JASP.Controls 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls ///Simple help button that shows you the 'helpPage'. Only works when run from a Form. MenuButton diff --git a/QMLComponents/components/JASP/Controls/Slider.qml b/QMLComponents/components/JASP/Controls/Slider.qml index 9b9d57bbed..3ebda78470 100644 --- a/QMLComponents/components/JASP/Controls/Slider.qml +++ b/QMLComponents/components/JASP/Controls/Slider.qml @@ -1,8 +1,8 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Controls 1.0 as JC //He returns! -import QtQuick.Layouts 1.3 -import JASP 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Controls as JC //He returns! +import QtQuick.Layouts +import JASP SliderBase { From 1e6a18321700168ae2b087663ec53b2fc3fbad7a Mon Sep 17 00:00:00 2001 From: boutinb Date: Mon, 13 Jan 2025 15:57:03 +0100 Subject: [PATCH 03/14] Remove Filter object from QML Components Remove the CommonData to the QML Comnponent. Only the Audit analyses use the CommonData objects (via the Filter object), but this leads to unexpected error: the sqlite library is added in the translation unit of the QML Component library. Furthermore, n order to use the Filter object in the QML Component the whole DataSet object was exposed to the QML Component, which is completely inconsistent with the Provider/Consumer pattern used in the VariableInfo. So in order to still be able to use the Filter object in the Audit analyses, callback functions are used instead, which are set in the DesktopCommunicator object. --- Common/jaspColumnEncoder | 2 +- {CommonData => Common}/jsonutilities.cpp | 0 {CommonData => Common}/jsonutilities.h | 0 CommonData/column.cpp | 8 +- CommonData/columnutils.cpp | 20 ----- CommonData/columnutils.h | 3 - CommonData/filter.cpp | 11 +++ CommonData/filter.h | 23 ++--- Desktop/data/columnsmodel.cpp | 1 - Desktop/data/importers/jaspimporterold.cpp | 2 +- .../readstat/readstatimportcolumn.cpp | 6 +- Desktop/mainwindow.cpp | 31 +++++++ QMLComponents/CMakeLists.txt | 2 - QMLComponents/controls/textinputbase.cpp | 2 - .../models/listmodelfiltereddataentry.cpp | 86 ++++++++++++------- .../models/listmodelfiltereddataentry.h | 12 ++- .../utilities/desktopcommunicator.cpp | 53 ++++++++++++ QMLComponents/utilities/desktopcommunicator.h | 23 +++++ QMLComponents/utilities/qmlutils.h | 3 +- QMLComponents/variableinfo.cpp | 5 -- QMLComponents/variableinfo.h | 3 +- 21 files changed, 208 insertions(+), 88 deletions(-) rename {CommonData => Common}/jsonutilities.cpp (100%) rename {CommonData => Common}/jsonutilities.h (100%) diff --git a/Common/jaspColumnEncoder b/Common/jaspColumnEncoder index 094a53c3d8..1dfc2421ff 160000 --- a/Common/jaspColumnEncoder +++ b/Common/jaspColumnEncoder @@ -1 +1 @@ -Subproject commit 094a53c3d8b3375bcb486ec2ded5843e15933291 +Subproject commit 1dfc2421ff45ac9a52ffa888a3fac4e15ff630c7 diff --git a/CommonData/jsonutilities.cpp b/Common/jsonutilities.cpp similarity index 100% rename from CommonData/jsonutilities.cpp rename to Common/jsonutilities.cpp diff --git a/CommonData/jsonutilities.h b/Common/jsonutilities.h similarity index 100% rename from CommonData/jsonutilities.h rename to Common/jsonutilities.h diff --git a/CommonData/column.cpp b/CommonData/column.cpp index 7c6b59eb4c..c67b7fe514 100644 --- a/CommonData/column.cpp +++ b/CommonData/column.cpp @@ -983,7 +983,7 @@ stringvec Column::nonFilteredLevels() levels.insert(label->label()); } else if(!isEmptyValue(_dbls[r])) - levels.insert(ColumnUtils::doubleToString(_dbls[r])); + levels.insert(Utils::doubleToString(_dbls[r])); } // Use the right label order @@ -1164,7 +1164,7 @@ std::string Column::doubleToDisplayString(double dbl, bool fancyEmptyValue, bool ignoreEmptyValue = ignoreEmptyValue && !std::isnan(dbl); if (isEmptyValue(dbl) && !ignoreEmptyValue) return fancyEmptyValue ? EmptyValues::displayString() : ""; - else return ColumnUtils::doubleToString(dbl); + else return Utils::doubleToString(dbl); } std::string Column::operator[](size_t row) @@ -1416,7 +1416,7 @@ bool Column::replaceDoubleLabelFromRowWithDouble(size_t row, double dbl) dblsRef = dbl; _labelsTempDbls[row] = dbl; - _labelsTemp[row] = ColumnUtils::doubleToString(dbl); + _labelsTemp[row] = Utils::doubleToString(dbl); return true; } @@ -1580,7 +1580,7 @@ bool Column::setValue(size_t row, const std::string & value, const std::string & if(justAValue && !newLabel && itsADouble) { - const std::string valueDbl = ColumnUtils::doubleToString(newDoubleToSet); + const std::string valueDbl = Utils::doubleToString(newDoubleToSet); newLabel = labelByValue(valueDbl); newLabel = newLabel ? newLabel : labelByValueAndDisplay(valueDbl, valueDbl); } diff --git a/CommonData/columnutils.cpp b/CommonData/columnutils.cpp index b923589868..55e1b8a9d0 100644 --- a/CommonData/columnutils.cpp +++ b/CommonData/columnutils.cpp @@ -210,26 +210,6 @@ std::string ColumnUtils::deEuropeaniseForImport(std::string value) return value; } -std::string ColumnUtils::doubleToStringMaxPrec(double dbl) -{ - constexpr auto max_precision{std::numeric_limits::digits10 + 1}; - return doubleToString(dbl, max_precision); -} - -std::string ColumnUtils::doubleToString(double dbl, int precision) -{ - JASPTIMER_SCOPE(ColumnUtils::doubleToString); - - if (dbl > std::numeric_limits::max()) return "∞"; - if (dbl < std::numeric_limits::lowest()) return "-∞"; - - std::stringstream conv; //Use this instead of std::to_string to make sure there are no trailing zeroes (and to get full precision) - conv << std::setprecision(precision); - conv << dbl; - return conv.str(); -} - - // hex should be 4 hexadecimals characters std::string ColumnUtils::_convertEscapedUnicodeToUTF8(std::string hex) { diff --git a/CommonData/columnutils.h b/CommonData/columnutils.h index 761ac304a2..6bd80deece 100644 --- a/CommonData/columnutils.h +++ b/CommonData/columnutils.h @@ -22,9 +22,6 @@ class ColumnUtils static void convertEscapedUnicodeToUTF8( std::string & inputStr); static std::string deEuropeaniseForImport( std::string value); //Convert a string to a double with a dot for a separator - - static std::string doubleToString( double dbl, int precision = 10); - static std::string doubleToStringMaxPrec( double dbl); static bool convertVecToInt( const stringvec & values, intvec & intValues, intset & uniqueValues); static bool convertVecToDouble( const stringvec & values, doublevec & doubleValues); diff --git a/CommonData/filter.cpp b/CommonData/filter.cpp index 439fe4cbbc..2f447a10c9 100644 --- a/CommonData/filter.cpp +++ b/CommonData/filter.cpp @@ -3,6 +3,8 @@ #include "dataset.h" #include "databaseinterface.h" +std::map _filterMap; + Filter::Filter(DataSet * data) : DataSetBaseNode(dataSetBaseNodeType::filter, data), _data(data) { } @@ -15,6 +17,8 @@ Filter::Filter(DataSet * data, const std::string & name, bool createIfMissing) if(db().filterGetId(_name) > -1) dbLoad(); else if(createIfMissing) dbCreate(); else throw std::runtime_error("Filter by name '" + _name + "' but it doesnt exist and createIfMissing=false!\nAre you sure this filter should exist?"); + + _filterMap[name] = this; } void Filter::dbCreate() @@ -136,6 +140,8 @@ void Filter::dbDelete() db().filterDelete(_id); _id = -1; + + _filterMap.erase(_name); } void Filter::incRevision() @@ -175,6 +181,11 @@ bool Filter::filterNameIsFree(const std::string &filterName) return -1 == DatabaseInterface::singleton()->filterGetId(filterName); } +Filter* Filter::getFilterFromName(const std::string & filterName) +{ + return _filterMap[filterName]; +} + void Filter::reset() { if(!_data->writeBatchedToDB()) diff --git a/CommonData/filter.h b/CommonData/filter.h index 62ca15bfd4..ce11a194db 100644 --- a/CommonData/filter.h +++ b/CommonData/filter.h @@ -24,16 +24,16 @@ class Filter : public DataSetBaseNode Filter(DataSet * data); Filter(DataSet * data, const std::string & name, bool createIfMissing = true); - DataSet * data() const { return _data; } - int id() const { return _id; } - const std::string & name() const { return _name; } - const std::string & rFilter() const { return _rFilter; } - const std::string & generatedFilter() const { return _generatedFilter; } - const std::string & constructorJson() const { return _constructorJson; } - const std::string & constructorR() const { return _constructorR; } - const std::string & errorMsg() const { return _errorMsg; } - const std::vector & filtered() const { return _filtered; } - int filteredRowCount() const { return _filteredRowCount; } + DataSet * data() const { return _data; } + int id() const { return _id; } + const std::string & name() const { return _name; } + const std::string & rFilter() const { return _rFilter; } + const std::string & generatedFilter() const { return _generatedFilter; } + const std::string & constructorJson() const { return _constructorJson; } + const std::string & constructorR() const { return _constructorR; } + const std::string & errorMsg() const { return _errorMsg; } + const std::vector & filtered() const { return _filtered; } + int filteredRowCount() const { return _filteredRowCount; } void setRFilter( const std::string & rFilter) { _rFilter = rFilter; dbUpdate(); } void setGeneratedFilter( const std::string & generatedFilter) { _generatedFilter = generatedFilter; dbUpdate(); } @@ -52,10 +52,11 @@ class Filter : public DataSetBaseNode void dbLoad(); bool dbLoadResultAndError(); ///< Loads (updated) filtervalues from database and the (possible) error msg, returns true if an error is set void dbDelete(); - void incRevision() override; + void incRevision() override; bool checkForUpdates(); static bool filterNameIsFree(const std::string & filterName); + static Filter* getFilterFromName(const std::string & filterName); void reset(); diff --git a/Desktop/data/columnsmodel.cpp b/Desktop/data/columnsmodel.cpp index 140df53c3d..eb762d5ef1 100644 --- a/Desktop/data/columnsmodel.cpp +++ b/Desktop/data/columnsmodel.cpp @@ -168,7 +168,6 @@ QVariant ColumnsModel::provideInfo(VariableInfo::InfoType info, const QString& c case VariableInfo::PreviewScale: return QTransposeProxyModel::headerData(colIndex, Qt::Vertical, int(DataSetPackage::specialRoles::previewScale)); case VariableInfo::PreviewOrdinal: return QTransposeProxyModel::headerData(colIndex, Qt::Vertical, int(DataSetPackage::specialRoles::previewOrdinal)); case VariableInfo::PreviewNominal: return QTransposeProxyModel::headerData(colIndex, Qt::Vertical, int(DataSetPackage::specialRoles::previewNominal)); - case VariableInfo::DataSetPointer: return QVariant::fromValue(DataSetPackage::pkg()->dataSet()); } } catch(std::exception & e) diff --git a/Desktop/data/importers/jaspimporterold.cpp b/Desktop/data/importers/jaspimporterold.cpp index 2e7f427865..802394cfb0 100644 --- a/Desktop/data/importers/jaspimporterold.cpp +++ b/Desktop/data/importers/jaspimporterold.cpp @@ -200,7 +200,7 @@ void JASPImporterOld::loadDataArchive_1_00(const std::string &path, std::functio if (isScalar) { - values.push_back(ColumnUtils::doubleToString(*reinterpret_cast(buff))); + values.push_back(Utils::doubleToString(*reinterpret_cast(buff))); labels.push_back(values.back()); } else diff --git a/Desktop/data/importers/readstat/readstatimportcolumn.cpp b/Desktop/data/importers/readstat/readstatimportcolumn.cpp index 31a9c2a762..fc48f7caa5 100644 --- a/Desktop/data/importers/readstat/readstatimportcolumn.cpp +++ b/Desktop/data/importers/readstat/readstatimportcolumn.cpp @@ -45,8 +45,8 @@ std::string ReadStatImportColumn::readstatValueToString(const readstat_value_t & case READSTAT_TYPE_INT8: return std::to_string (int( readstat_int8_value(value)) ); case READSTAT_TYPE_INT16: return std::to_string (int( readstat_int16_value(value)) ); case READSTAT_TYPE_INT32: return std::to_string (int( readstat_int32_value(value)) ); - case READSTAT_TYPE_FLOAT: return ColumnUtils::doubleToStringMaxPrec ( readstat_float_value(value) ); - case READSTAT_TYPE_DOUBLE: return ColumnUtils::doubleToStringMaxPrec ( readstat_double_value(value) ); + case READSTAT_TYPE_FLOAT: return Utils::doubleToStringMaxPrec ( readstat_float_value(value) ); + case READSTAT_TYPE_DOUBLE: return Utils::doubleToStringMaxPrec ( readstat_double_value(value) ); case READSTAT_TYPE_STRING_REF: throw std::runtime_error("File contains string references and we do not support this."); } @@ -69,7 +69,7 @@ const stringvec &ReadStatImportColumn::labels() const void ReadStatImportColumn::addValue(const readstat_value_t & value) { bool setMiss = readstat_value_is_tagged_missing(value) || (_readstatVariable && readstat_value_is_defined_missing(value, _readstatVariable)); - std::string valStr = ColumnUtils::doubleToString(EmptyValues::missingValueDouble); + std::string valStr = Utils::doubleToString(EmptyValues::missingValueDouble); if(readstat_value_is_tagged_missing(value)) //This is from sas/stata and actual value is NaN but there is a tag. So we use that as a value, this will be converted to NaN later anyway { diff --git a/Desktop/mainwindow.cpp b/Desktop/mainwindow.cpp index 912172718b..26b1662480 100644 --- a/Desktop/mainwindow.cpp +++ b/Desktop/mainwindow.cpp @@ -536,6 +536,37 @@ void MainWindow::makeConnections() Column::setAutoSortByValuesByDefault(PreferencesModel::prefs()->orderByValueByDefault()); auto * dCSingleton = DesktopCommunicator::singleton(); + // For Audit analyses, the Filter object is needed. As the QML objects should not have direct access to the data objects, the needed functions are set as callbacks. + dCSingleton->setFilterFunctions( + [](const std::string& name) { + new Filter(DataSetPackage::pkg()->dataSet(), name, true); + }, + [](const std::string& name) { + Filter* filter = Filter::getFilterFromName(name); + if (filter) + filter->dbDelete(); + }, + [](const std::string& name, const std::string& rFilter) { + Filter* filter = Filter::getFilterFromName(name); + if (filter) + filter->setRFilter(rFilter); + }, + [](const std::string& name) { + Filter* filter = Filter::getFilterFromName(name); + return filter ? filter->checkForUpdates() : false; + }, + [](const std::string& name) { + Filter* filter = Filter::getFilterFromName(name); + return filter ? filter->filtered() : std::vector(); + }, + [](const std::string& name) { + Filter* filter = Filter::getFilterFromName(name); + return filter ? filter->filteredRowCount() : 0; + }, + [](const std::string& name) { + return Filter::filterNameIsFree(name); + } + ); //Needed to allow for a hard split between Desktop/QMLComps: connect(_preferences, &PreferencesModel::uiScaleChanged, dCSingleton, &DesktopCommunicator::uiScaleChanged ); diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index 1c5785dc88..37e5c5b438 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -40,7 +40,6 @@ target_include_directories( PUBLIC # JASP ${PROJECT_SOURCE_DIR}/Common ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder - ${PROJECT_SOURCE_DIR}/CommonData ) @@ -48,7 +47,6 @@ target_link_libraries( QMLComponents PUBLIC Common - CommonData Qt::Core Qt::Gui Qt::Widgets diff --git a/QMLComponents/controls/textinputbase.cpp b/QMLComponents/controls/textinputbase.cpp index d33143609e..6b6cda622f 100644 --- a/QMLComponents/controls/textinputbase.cpp +++ b/QMLComponents/controls/textinputbase.cpp @@ -18,8 +18,6 @@ #include "textinputbase.h" #include "analysisform.h" -#include "utils.h" -#include "columnutils.h" using namespace std; diff --git a/QMLComponents/models/listmodelfiltereddataentry.cpp b/QMLComponents/models/listmodelfiltereddataentry.cpp index 6646b9e84b..d7c170f0a2 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.cpp +++ b/QMLComponents/models/listmodelfiltereddataentry.cpp @@ -1,10 +1,9 @@ #include "listmodelfiltereddataentry.h" -#include "columnutils.h" #include "controls/tableviewbase.h" #include "utilities/qutils.h" #include "log.h" #include "controls/jaspcontrol.h" -#include "filter.h" +#include "utilities/desktopcommunicator.h" ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) @@ -22,17 +21,14 @@ ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) { _filterName = "ListModelFilteredDataEntry_" + std::to_string(counter++); } - while(!Filter::filterNameIsFree(_filterName)); + while(!filterNameIsFree(_filterName)); connect(VariableInfo::info(), &VariableInfo::dataSetChanged, this, &ListModelFilteredDataEntry::dataSetChangedHandler); } ListModelFilteredDataEntry::~ListModelFilteredDataEntry() { - if(_filter) - _filter->dbDelete(); - delete _filter; - _filter = nullptr; + filterDelete(); } void ListModelFilteredDataEntry::dataSetChangedHandler() @@ -53,37 +49,33 @@ void ListModelFilteredDataEntry::setFilter(QString filter) _tableTerms.filter = filter; emit filterChanged(_tableTerms.filter); - if(_filter) - _filter->setRFilter("filterResult <- {" + filter.toStdString() + "};" "\n" + filterSetRScript("filterResult <- {" + filter.toStdString() + "};" "\n" "if(!is.logical(filterResult)) filterResult <- rep(TRUE, rowcount);" "\n" " return(filterResult);" "\n"); } void ListModelFilteredDataEntry::runFilter() { - if(!_filter) //prob still need to bind - return; - - runFilterByName(tq(_filter->name())); + runFilterByName(tq(_filterName)); } void ListModelFilteredDataEntry::filterDoneHandler(const QString &name, const QString & error) { - if(name.toStdString() != _filter->name()) + if(name.toStdString() != _filterName) return; Log::log() << "ListModelFilteredDataEntry::filterDoneHandler for " << name << " and error '" << error << "'" << std::endl; - _filter->checkForUpdates(); + filterCheckForUpdate(); - setAcceptedRows(_filter->filtered()); + setAcceptedRows(filtered()); if(!error.isEmpty()) _tableView->addControlWarning(tr("Filter had error '%1'").arg(error)); else _tableView->clearControlError(); - if(_filter->filteredRowCount() == 0) + if(filteredRowCount() == 0) runFilter(); else informDataSetOfInitialValues(); @@ -175,16 +167,12 @@ void ListModelFilteredDataEntry::initTableTerms(const TableTerms& terms) Log::log() << "Too many values in ListModelFilteredDataEntry" << std::endl; if(terms.filterName.isEmpty()) - { //We dont apparently have a previous filterName, so this is a fresh one, we need a new filter! - assert(!_filter && !_filterName.empty()); - _filter = new Filter(VariableInfo::info()->dataSet(), _filterName, true); - } - else if(!_filter) - { + assert(!_filterName.empty()); + else if(_filterName.empty()) _filterName = fq(terms.filterName); - _filter = new Filter(VariableInfo::info()->dataSet(), _filterName, true); - } + + filterBuild(); if (terms.colName.isEmpty()) { @@ -199,7 +187,7 @@ void ListModelFilteredDataEntry::initTableTerms(const TableTerms& terms) setColName( _tableTerms.colName ); setExtraCol(_tableTerms.extraCol); - _acceptedRows = _filter->filtered(); + _acceptedRows = filtered(); _dataColumns = _tableTerms.colNames; @@ -224,10 +212,9 @@ void ListModelFilteredDataEntry::fillTable() _tableTerms.rowNames.clear(); _tableTerms.values.clear(); - if(_filter) - _filter->checkForUpdates(); + filterCheckForUpdate(); - size_t dataRows = _filter && _filter->filtered().size() > 0 ? _filter->filtered().size() : getDataSetRowCount(); + size_t dataRows = filtered().size() > 0 ? filtered().size() : getDataSetRowCount(); if (_acceptedRows.size() != dataRows) _acceptedRows = std::vector(dataRows, true); @@ -365,7 +352,7 @@ void ListModelFilteredDataEntry::informDataSetOfInitialValues() QVariantList vals; for(size_t i=0; i<_initialValues.size(); i++) { - vals.append(_acceptedRows[i] ? tq(ColumnUtils::doubleToString(_initialValues[i])) : ""); + vals.append(_acceptedRows[i] ? tq(Utils::doubleToString(_initialValues[i])) : ""); if(_acceptedRows[i]) somethingFilled = true; } @@ -439,3 +426,42 @@ void ListModelFilteredDataEntry::refreshModel() { ListModel::refresh(); } + +bool ListModelFilteredDataEntry::filterNameIsFree(const std::string& name) +{ + return DesktopCommunicator::singleton()->filterNameIsFree(name); +} + +void ListModelFilteredDataEntry::filterBuild() +{ + if (!_filterName.empty()) + DesktopCommunicator::singleton()->filterBuild(_filterName); +} + +void ListModelFilteredDataEntry::filterDelete() +{ + if (!_filterName.empty()) + DesktopCommunicator::singleton()->filterDelete(_filterName); +} + +void ListModelFilteredDataEntry::filterSetRScript(const std::string& script) +{ + if (!_filterName.empty()) + DesktopCommunicator::singleton()->filterSetRScript(_filterName, script); +} + +bool ListModelFilteredDataEntry::filterCheckForUpdate() +{ + return !_filterName.empty() ? DesktopCommunicator::singleton()->filterCheckForUpdate(_filterName) : false; +} + +std::vector ListModelFilteredDataEntry::filtered() +{ + return !_filterName.empty() ? DesktopCommunicator::singleton()->filtered(_filterName) : std::vector(); +} + +int ListModelFilteredDataEntry::filteredRowCount() +{ + return !_filterName.empty() ? DesktopCommunicator::singleton()->filteredRowCount(_filterName) : 0; +} + diff --git a/QMLComponents/models/listmodelfiltereddataentry.h b/QMLComponents/models/listmodelfiltereddataentry.h index f4a1dc00e1..71ca457a62 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.h +++ b/QMLComponents/models/listmodelfiltereddataentry.h @@ -22,7 +22,6 @@ #include "listmodeltableviewbase.h" -class Filter; class ListModelFilteredDataEntry : public ListModelTableViewBase { Q_OBJECT @@ -75,6 +74,16 @@ private slots: size_t getDataSetRowCount() const; void fillTable(); + bool filterNameIsFree(const std::string& name); + void filterBuild(); + void filterDelete(); + void filterSetRScript(const std::string& script); + bool filterCheckForUpdate(); + std::vector filtered(); + int filteredRowCount(); + + + private: boolvec _acceptedRows; @@ -85,7 +94,6 @@ private slots: QStringList _dataColumns, _extraColsStr; std::string _filterName; - Filter * _filter = nullptr; bool _informOnce = false; }; diff --git a/QMLComponents/utilities/desktopcommunicator.cpp b/QMLComponents/utilities/desktopcommunicator.cpp index cc3536d6da..8dfc3188a7 100644 --- a/QMLComponents/utilities/desktopcommunicator.cpp +++ b/QMLComponents/utilities/desktopcommunicator.cpp @@ -16,6 +16,59 @@ DesktopCommunicator *DesktopCommunicator::singleton() return _singleton; } +void DesktopCommunicator::setFilterFunctions( + std::function _builderFunc, + std::function _deleteFunc, + std::function _setRFilterFunc, + std::function _checkForUpdateFunc, + std::function(const std::string&)> _filteredFunc, + std::function _filteredRowCountFunc, + std::function _filterExistFunc) +{ + _filterBuilderFunc = _builderFunc; + _filterDeleteFunc = _deleteFunc; + _filterSetRFilterFunc = _setRFilterFunc; + _filterCheckForUpdateFunc = _checkForUpdateFunc; + _filterFilteredFunc = _filteredFunc; + _filterFilteredRowCountFunc = _filteredRowCountFunc; + _filterNameExistFunc = _filterExistFunc; +} + +void DesktopCommunicator::filterBuild(const std::string &name) +{ + _filterBuilderFunc(name); +} + +void DesktopCommunicator::filterDelete(const std::string& name) +{ + _filterDeleteFunc(name); +} + +void DesktopCommunicator::filterSetRScript(const std::string& name, const std::string& rFilter) +{ + _filterSetRFilterFunc(name, rFilter); +} + +bool DesktopCommunicator::filterCheckForUpdate(const std::string& name) +{ + return _filterCheckForUpdateFunc(name); +} + +std::vector DesktopCommunicator::filtered(const std::string& name) +{ + return _filterFilteredFunc(name); +} + +int DesktopCommunicator::filteredRowCount(const std::string& name) +{ + return _filterFilteredRowCountFunc(name); +} + +bool DesktopCommunicator::filterNameIsFree(const std::string &name) +{ + return _filterNameExistFunc(name); +} + bool DesktopCommunicator::useNativeFileDialog() { #ifdef BUILDING_JASP diff --git a/QMLComponents/utilities/desktopcommunicator.h b/QMLComponents/utilities/desktopcommunicator.h index 3e8873bd6b..0b79f7d36d 100644 --- a/QMLComponents/utilities/desktopcommunicator.h +++ b/QMLComponents/utilities/desktopcommunicator.h @@ -14,6 +14,21 @@ class DesktopCommunicator : public QObject static DesktopCommunicator * singleton(); bool useNativeFileDialog(); + void setFilterFunctions( + std::function _builderFunc, + std::function _deleteFunc, + std::function _setRFilterFunc, + std::function _checkForUpdateFunc, + std::function(const std::string&)> _filteredFunc, + std::function _filteredRowCountFunc, + std::function _filterExistFunc); + void filterBuild(const std::string& name); + void filterDelete(const std::string& name); + void filterSetRScript(const std::string& name, const std::string& rFilter); + bool filterCheckForUpdate(const std::string& name); + std::vector filtered(const std::string& name); + int filteredRowCount(const std::string& name); + bool filterNameIsFree(const std::string& name); signals: void currentJaspThemeChanged(); @@ -23,6 +38,14 @@ class DesktopCommunicator : public QObject private: static DesktopCommunicator * _singleton; + + std::function _filterBuilderFunc; + std::function _filterDeleteFunc; + std::function _filterSetRFilterFunc; + std::function _filterCheckForUpdateFunc; + std::function(const std::string&)> _filterFilteredFunc; + std::function _filterFilteredRowCountFunc; + std::function _filterNameExistFunc; }; #endif // DESKTOPCOMMUNICATOR_H diff --git a/QMLComponents/utilities/qmlutils.h b/QMLComponents/utilities/qmlutils.h index b2e30df4df..f72a12dc82 100644 --- a/QMLComponents/utilities/qmlutils.h +++ b/QMLComponents/utilities/qmlutils.h @@ -19,6 +19,8 @@ class QmlUtils : public QObject public: explicit QmlUtils(QObject *parent = nullptr); + static void setGlobalPropertiesInQMLContext(QQmlContext * ctxt); + #ifdef linux // Functions for qml cache bug workaround on linux public: @@ -27,7 +29,6 @@ class QmlUtils : public QObject static QDir generateQMLCacheDir(); #endif - static void setGlobalPropertiesInQMLContext(QQmlContext * ctxt); public slots: QString encodeAllColumnNames( const QString & str); diff --git a/QMLComponents/variableinfo.cpp b/QMLComponents/variableinfo.cpp index c4862e5eac..331f000246 100644 --- a/QMLComponents/variableinfo.cpp +++ b/QMLComponents/variableinfo.cpp @@ -65,8 +65,3 @@ bool VariableInfo::dataAvailable() { return _provider ? _provider->provideInfo(VariableInfo::DataAvailable).toBool() : false; } - -DataSet *VariableInfo::dataSet() -{ - return _provider ? reinterpret_cast(_provider->provideInfo(VariableInfo::DataSetPointer).value()) : nullptr; -} diff --git a/QMLComponents/variableinfo.h b/QMLComponents/variableinfo.h index e2e33640cb..2158c6880b 100644 --- a/QMLComponents/variableinfo.h +++ b/QMLComponents/variableinfo.h @@ -38,7 +38,7 @@ class VariableInfo : public QObject { Q_OBJECT public: - enum InfoType { VariableType, VariableNames, DataSetRowCount, Labels, DoubleValues, NameRole, DataSetValue, DataSetValues, MaxWidth, SignalsBlocked, DataAvailable, TotalNumericValues, TotalLevels, PreviewScale, PreviewOrdinal, PreviewNominal, DataSetPointer }; + enum InfoType { VariableType, VariableNames, DataSetRowCount, Labels, DoubleValues, NameRole, DataSetValue, DataSetValues, MaxWidth, SignalsBlocked, DataAvailable, TotalNumericValues, TotalLevels, PreviewScale, PreviewOrdinal, PreviewNominal }; enum IconType { DefaultIconType, DisabledIconType, InactiveIconType, TransformedIconType }; public: @@ -55,7 +55,6 @@ class VariableInfo : public QObject int rowCount(); bool dataAvailable(); - DataSet * dataSet(); signals: void namesChanged( QMap changedNames); From e32ad10cc3fc29e7b895ec6cd2597f7eb14b0cd9 Mon Sep 17 00:00:00 2001 From: boutinb Date: Mon, 13 Jan 2025 17:45:05 +0100 Subject: [PATCH 04/14] Update submodule so that it uses QML import without version --- Engine/jaspBase | 2 +- Engine/jaspGraphs | 2 +- Modules/jaspAcceptanceSampling | 2 +- Modules/jaspAnova | 2 +- Modules/jaspAudit | 2 +- Modules/jaspBFF | 2 +- Modules/jaspBain | 2 +- Modules/jaspBfpack | 2 +- Modules/jaspBsts | 2 +- Modules/jaspCircular | 2 +- Modules/jaspCochrane | 2 +- Modules/jaspDescriptives | 2 +- Modules/jaspDistributions | 2 +- Modules/jaspEquivalenceTTests | 2 +- Modules/jaspFactor | 2 +- Modules/jaspFrequencies | 2 +- Modules/jaspJags | 2 +- Modules/jaspLearnBayes | 2 +- Modules/jaspLearnStats | 2 +- Modules/jaspMachineLearning | 2 +- Modules/jaspMetaAnalysis | 2 +- Modules/jaspMixedModels | 2 +- Modules/jaspNetwork | 2 +- Modules/jaspPower | 2 +- Modules/jaspPredictiveAnalytics | 2 +- Modules/jaspProcess | 2 +- Modules/jaspProphet | 2 +- Modules/jaspQualityControl | 2 +- Modules/jaspRegression | 2 +- Modules/jaspReliability | 2 +- Modules/jaspRobustTTests | 2 +- Modules/jaspSem | 2 +- Modules/jaspSummaryStatistics | 2 +- Modules/jaspSurvival | 2 +- Modules/jaspTTests | 2 +- Modules/jaspTestModule | 2 +- Modules/jaspTimeSeries | 2 +- Modules/jaspVisualModeling | 2 +- 38 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Engine/jaspBase b/Engine/jaspBase index d3a4242867..2011f4c641 160000 --- a/Engine/jaspBase +++ b/Engine/jaspBase @@ -1 +1 @@ -Subproject commit d3a42428674d84b91281634562e9ac4bd03b82f1 +Subproject commit 2011f4c6415e5ece2fc948a9ec7b51ab23eff529 diff --git a/Engine/jaspGraphs b/Engine/jaspGraphs index c73a76cd55..9bd1fdafc6 160000 --- a/Engine/jaspGraphs +++ b/Engine/jaspGraphs @@ -1 +1 @@ -Subproject commit c73a76cd55a7f15ccbace1f7eb3b04a5209197ee +Subproject commit 9bd1fdafc6bf6a04451f982e6c6dd9002524dbcb diff --git a/Modules/jaspAcceptanceSampling b/Modules/jaspAcceptanceSampling index fb1a9d3076..9605e54bdc 160000 --- a/Modules/jaspAcceptanceSampling +++ b/Modules/jaspAcceptanceSampling @@ -1 +1 @@ -Subproject commit fb1a9d3076a4ad388e040d37ad6a5eb13bd7ca7f +Subproject commit 9605e54bdcbef41e664f7d599a5220115ceb8c7f diff --git a/Modules/jaspAnova b/Modules/jaspAnova index fcb081feae..c2f72941ba 160000 --- a/Modules/jaspAnova +++ b/Modules/jaspAnova @@ -1 +1 @@ -Subproject commit fcb081feaea780d978b3042693025bf6168fb412 +Subproject commit c2f72941ba366b9a1eace2afdfe7019a75419cd5 diff --git a/Modules/jaspAudit b/Modules/jaspAudit index 497782e430..ad3db9a5aa 160000 --- a/Modules/jaspAudit +++ b/Modules/jaspAudit @@ -1 +1 @@ -Subproject commit 497782e430e0c6ba8c172ae02ea5f904083363dc +Subproject commit ad3db9a5aacbddbdeba2db0dd1071b9084b69383 diff --git a/Modules/jaspBFF b/Modules/jaspBFF index bed32e9e38..ed86f3d663 160000 --- a/Modules/jaspBFF +++ b/Modules/jaspBFF @@ -1 +1 @@ -Subproject commit bed32e9e3865d20c98cf6fbe4acfc59216cb6bac +Subproject commit ed86f3d6635074e1893d7288fb7c83132a0ad170 diff --git a/Modules/jaspBain b/Modules/jaspBain index f5045ca50b..e4b9db87b3 160000 --- a/Modules/jaspBain +++ b/Modules/jaspBain @@ -1 +1 @@ -Subproject commit f5045ca50b3bcb54d9c7b9ac078346d030e6e6b5 +Subproject commit e4b9db87b3321c36379a0b7e2a7cba2744bee6bd diff --git a/Modules/jaspBfpack b/Modules/jaspBfpack index d9abf73f75..0504afbac1 160000 --- a/Modules/jaspBfpack +++ b/Modules/jaspBfpack @@ -1 +1 @@ -Subproject commit d9abf73f75bcede52fca4dbdb46a799ecb593636 +Subproject commit 0504afbac1ddaaa3c91af7768cc7a65781fa0d39 diff --git a/Modules/jaspBsts b/Modules/jaspBsts index efd01ea853..9207644db1 160000 --- a/Modules/jaspBsts +++ b/Modules/jaspBsts @@ -1 +1 @@ -Subproject commit efd01ea8539236cc466e864f7e8f3f0b5d860b43 +Subproject commit 9207644db1f3414be3fe5a8243431302ec85f434 diff --git a/Modules/jaspCircular b/Modules/jaspCircular index 5c151f7c56..c1d302dff1 160000 --- a/Modules/jaspCircular +++ b/Modules/jaspCircular @@ -1 +1 @@ -Subproject commit 5c151f7c56988f32dd50af2fb05844882dcf7eb5 +Subproject commit c1d302dff1f835c0a15a51eb67f91e285f34711a diff --git a/Modules/jaspCochrane b/Modules/jaspCochrane index 8916ef4b0e..24f0aac822 160000 --- a/Modules/jaspCochrane +++ b/Modules/jaspCochrane @@ -1 +1 @@ -Subproject commit 8916ef4b0ea760f3e545d1e82253410259fb4783 +Subproject commit 24f0aac8226d30ff991ef6d008ecb856b7abd592 diff --git a/Modules/jaspDescriptives b/Modules/jaspDescriptives index 7b1cd8ab24..1ce428ebcc 160000 --- a/Modules/jaspDescriptives +++ b/Modules/jaspDescriptives @@ -1 +1 @@ -Subproject commit 7b1cd8ab2465ca4866095cf573074664a27b8443 +Subproject commit 1ce428ebcc28266a5e0dc57a27fb2d36bb528ebe diff --git a/Modules/jaspDistributions b/Modules/jaspDistributions index 8d3abc3aff..fa06beefb2 160000 --- a/Modules/jaspDistributions +++ b/Modules/jaspDistributions @@ -1 +1 @@ -Subproject commit 8d3abc3aff8ce80cd14785a1aa345be61585cb43 +Subproject commit fa06beefb247fbadb6a7fb595902593a72f23f3b diff --git a/Modules/jaspEquivalenceTTests b/Modules/jaspEquivalenceTTests index c8f0ba5c95..5c5e3e2efb 160000 --- a/Modules/jaspEquivalenceTTests +++ b/Modules/jaspEquivalenceTTests @@ -1 +1 @@ -Subproject commit c8f0ba5c95be388969333f333a194af871c1d17b +Subproject commit 5c5e3e2efb7d1f01d4a9806cc7dd2033b87e9b76 diff --git a/Modules/jaspFactor b/Modules/jaspFactor index 9cbcfa1fed..260d27e2f1 160000 --- a/Modules/jaspFactor +++ b/Modules/jaspFactor @@ -1 +1 @@ -Subproject commit 9cbcfa1fed0b3b256d07be88fe774984ba4a9ac8 +Subproject commit 260d27e2f15dc5011dedcdba82ad2a3604a0b1aa diff --git a/Modules/jaspFrequencies b/Modules/jaspFrequencies index 1941a0a8a0..8ad777083c 160000 --- a/Modules/jaspFrequencies +++ b/Modules/jaspFrequencies @@ -1 +1 @@ -Subproject commit 1941a0a8a0222fcd49fcd1bda1d7abc181cdbe3f +Subproject commit 8ad777083c07a2fb6fba14cabedd8c9abcaa534f diff --git a/Modules/jaspJags b/Modules/jaspJags index 47bb25f35b..690ad61a78 160000 --- a/Modules/jaspJags +++ b/Modules/jaspJags @@ -1 +1 @@ -Subproject commit 47bb25f35bd993ce9b23980d4c0091957545b500 +Subproject commit 690ad61a785100ea16efaf0ad3e6f71b1284f3ab diff --git a/Modules/jaspLearnBayes b/Modules/jaspLearnBayes index 5007d1636e..a6afad11d0 160000 --- a/Modules/jaspLearnBayes +++ b/Modules/jaspLearnBayes @@ -1 +1 @@ -Subproject commit 5007d1636ea96259eb3f8698d6fe483a3a6b26e4 +Subproject commit a6afad11d01ea1f5ac5164a21707c994621d4e9c diff --git a/Modules/jaspLearnStats b/Modules/jaspLearnStats index ac27a3dabd..0fd6d5681c 160000 --- a/Modules/jaspLearnStats +++ b/Modules/jaspLearnStats @@ -1 +1 @@ -Subproject commit ac27a3dabda859f4f963480908575c4bf9f1b11e +Subproject commit 0fd6d5681c53baa8722c5b40da854c1ce33e0532 diff --git a/Modules/jaspMachineLearning b/Modules/jaspMachineLearning index 7c67c095ed..cdfc56d9e3 160000 --- a/Modules/jaspMachineLearning +++ b/Modules/jaspMachineLearning @@ -1 +1 @@ -Subproject commit 7c67c095ed8e1757f977deb34e2b514a22429cc5 +Subproject commit cdfc56d9e3a326027667c7897f6cf2af44d00adb diff --git a/Modules/jaspMetaAnalysis b/Modules/jaspMetaAnalysis index 6dcf3028d3..95d17a3272 160000 --- a/Modules/jaspMetaAnalysis +++ b/Modules/jaspMetaAnalysis @@ -1 +1 @@ -Subproject commit 6dcf3028d34da6a53b30d6ea99c330e48fe417b2 +Subproject commit 95d17a32727e9a1df1c83deb0f338a1ae21213d4 diff --git a/Modules/jaspMixedModels b/Modules/jaspMixedModels index f0115dbec9..78434e23e3 160000 --- a/Modules/jaspMixedModels +++ b/Modules/jaspMixedModels @@ -1 +1 @@ -Subproject commit f0115dbec9cc2166898bc1c10b4eb62b9ecdabcd +Subproject commit 78434e23e3e6a1b14bc3026fbe0cb9e408041596 diff --git a/Modules/jaspNetwork b/Modules/jaspNetwork index 8ef441b40f..e6fa10c087 160000 --- a/Modules/jaspNetwork +++ b/Modules/jaspNetwork @@ -1 +1 @@ -Subproject commit 8ef441b40fee0b48811539403d6535e743611065 +Subproject commit e6fa10c087d5054050f9ffae3165a3064fb9c77c diff --git a/Modules/jaspPower b/Modules/jaspPower index 3658d1a967..d4c083346d 160000 --- a/Modules/jaspPower +++ b/Modules/jaspPower @@ -1 +1 @@ -Subproject commit 3658d1a967916919d88c03eeedfe833e3724e55a +Subproject commit d4c083346d97c12015cfafaf4c1d12805c1828c8 diff --git a/Modules/jaspPredictiveAnalytics b/Modules/jaspPredictiveAnalytics index e4f42f10c1..afe3319ea9 160000 --- a/Modules/jaspPredictiveAnalytics +++ b/Modules/jaspPredictiveAnalytics @@ -1 +1 @@ -Subproject commit e4f42f10c11221b5b0b36b8ab7bd44346cb9c0d5 +Subproject commit afe3319ea9a28b33d29d8646912968fe65ecf052 diff --git a/Modules/jaspProcess b/Modules/jaspProcess index 7bb84fb7c0..b3a4ae33c2 160000 --- a/Modules/jaspProcess +++ b/Modules/jaspProcess @@ -1 +1 @@ -Subproject commit 7bb84fb7c04359c60da6fb5edda30d055ad76f86 +Subproject commit b3a4ae33c28b06055da5736a525cd46e94ac8063 diff --git a/Modules/jaspProphet b/Modules/jaspProphet index 3ab1134a31..24cf9bdfba 160000 --- a/Modules/jaspProphet +++ b/Modules/jaspProphet @@ -1 +1 @@ -Subproject commit 3ab1134a313553533245fc4daa02385a8d3a0c17 +Subproject commit 24cf9bdfbad76b4ccf3a8e40f221f2fdb1b230f2 diff --git a/Modules/jaspQualityControl b/Modules/jaspQualityControl index c53d732805..2bb9824f79 160000 --- a/Modules/jaspQualityControl +++ b/Modules/jaspQualityControl @@ -1 +1 @@ -Subproject commit c53d73280554f2d04e150e1657482d512db8fb11 +Subproject commit 2bb9824f7904d4a3f427ce390113dc7d60f6119e diff --git a/Modules/jaspRegression b/Modules/jaspRegression index 333ee6cbc5..71472c0ed4 160000 --- a/Modules/jaspRegression +++ b/Modules/jaspRegression @@ -1 +1 @@ -Subproject commit 333ee6cbc5ece5ea3683d9757356dd2e06691548 +Subproject commit 71472c0ed46e4d8edc7eaf3841e71e0e8fa57b8a diff --git a/Modules/jaspReliability b/Modules/jaspReliability index 955ed33994..a4a16830bf 160000 --- a/Modules/jaspReliability +++ b/Modules/jaspReliability @@ -1 +1 @@ -Subproject commit 955ed33994f8d03e8eb420d60475c75f01dc011b +Subproject commit a4a16830bf5703f384216c67b79d6988d8a22c8d diff --git a/Modules/jaspRobustTTests b/Modules/jaspRobustTTests index e40ddf9fa9..6620932b0b 160000 --- a/Modules/jaspRobustTTests +++ b/Modules/jaspRobustTTests @@ -1 +1 @@ -Subproject commit e40ddf9fa96511a2102c8836ef6b88c077969f8b +Subproject commit 6620932b0bba905a52d5d3f6185dd32961806e69 diff --git a/Modules/jaspSem b/Modules/jaspSem index 63a4cb2946..8840ffc423 160000 --- a/Modules/jaspSem +++ b/Modules/jaspSem @@ -1 +1 @@ -Subproject commit 63a4cb29469ad694189b1b528db01a49d42091c9 +Subproject commit 8840ffc42307e4d7057e23f6f6daa31a07562156 diff --git a/Modules/jaspSummaryStatistics b/Modules/jaspSummaryStatistics index 908393f932..4f36635834 160000 --- a/Modules/jaspSummaryStatistics +++ b/Modules/jaspSummaryStatistics @@ -1 +1 @@ -Subproject commit 908393f932353efdc129b495d3fa6494a40bff02 +Subproject commit 4f36635834b30333dd6e4192e5e1974015246e05 diff --git a/Modules/jaspSurvival b/Modules/jaspSurvival index 86f27b399c..9fc69330a8 160000 --- a/Modules/jaspSurvival +++ b/Modules/jaspSurvival @@ -1 +1 @@ -Subproject commit 86f27b399c2b4253a3dbbacaf1bb2d51594e3663 +Subproject commit 9fc69330a88fa7b33dc37358d0eafe2e25aeacee diff --git a/Modules/jaspTTests b/Modules/jaspTTests index 3d34890729..e83ba72666 160000 --- a/Modules/jaspTTests +++ b/Modules/jaspTTests @@ -1 +1 @@ -Subproject commit 3d348907296dfd5371084a1d7f07c7ae0bc98f4f +Subproject commit e83ba72666d896de54abc3f7347c775402937eb6 diff --git a/Modules/jaspTestModule b/Modules/jaspTestModule index 04e72d7c86..0e0f811e93 160000 --- a/Modules/jaspTestModule +++ b/Modules/jaspTestModule @@ -1 +1 @@ -Subproject commit 04e72d7c86772c26cb5feb14e4f0b5cd2f254327 +Subproject commit 0e0f811e9323f9334d368c981a4151df4245d063 diff --git a/Modules/jaspTimeSeries b/Modules/jaspTimeSeries index 835e55529a..bbfae723cf 160000 --- a/Modules/jaspTimeSeries +++ b/Modules/jaspTimeSeries @@ -1 +1 @@ -Subproject commit 835e55529a95567216e98f87d5edb1931a7503d6 +Subproject commit bbfae723cf6cba85d93f7493ebaaff6b7cab8441 diff --git a/Modules/jaspVisualModeling b/Modules/jaspVisualModeling index 33065f8af5..cc904969be 160000 --- a/Modules/jaspVisualModeling +++ b/Modules/jaspVisualModeling @@ -1 +1 @@ -Subproject commit 33065f8af59e38c3fadb2366eb8e1054735fbe99 +Subproject commit cc904969beb3ad860c4276c9d1dfda369dabfbda From 769d232da7b5c3b9bd0a533a8363e091fa3467b7 Mon Sep 17 00:00:00 2001 From: boutinb Date: Tue, 14 Jan 2025 11:30:18 +0100 Subject: [PATCH 05/14] JASP QML Controls base objects should be registered automatically Use QML_ELEMENT Remove import version in other QML files --- .../JASP/Widgets/ComputeColumnWindow.qml | 2 +- .../Widgets/CreateComputeColumnDialog.qml | 4 +- Desktop/components/JASP/Widgets/DataPanel.qml | 6 +- .../JASP/Widgets/FileMenu/CurrentFile.qml | 4 +- .../JASP/Widgets/FileMenu/DataLibrary.qml | 6 +- .../FileMenu/DataLibraryBreadCrumbs.qml | 8 +-- .../JASP/Widgets/FileMenu/PrefsTextInput.qml | 4 +- .../JASP/Widgets/FileMenu/RecentFiles.qml | 6 +- .../Widgets/FilterConstructor/ColumnDrag.qml | 2 +- .../Widgets/FilterConstructor/DragGeneric.qml | 4 +- .../Widgets/FilterConstructor/DropSpot.qml | 4 +- .../Widgets/FilterConstructor/DropTrash.qml | 4 +- .../Widgets/FilterConstructor/ElementView.qml | 2 +- .../Widgets/FilterConstructor/Function.qml | 2 +- .../FilterConstructor/FunctionDrag.qml | 2 +- .../JASP/Widgets/FilterConstructor/Number.qml | 2 +- .../Widgets/FilterConstructor/NumberDrag.qml | 2 +- .../Widgets/FilterConstructor/Operator.qml | 2 +- .../FilterConstructor/OperatorDrag.qml | 2 +- .../FilterConstructor/OperatorSelector.qml | 2 +- .../OperatorSelectorComputedColumns.qml | 2 +- .../FilterConstructor/OperatorVertical.qml | 2 +- .../OperatorVerticalDrag.qml | 2 +- .../JASP/Widgets/FilterConstructor/String.qml | 2 +- .../Widgets/FilterConstructor/StringDrag.qml | 2 +- .../components/JASP/Widgets/FilterWindow.qml | 4 +- .../components/JASP/Widgets/ImageInverter.qml | 2 +- .../JASP/Widgets/JASPMouseAreaToolTipped.qml | 4 +- .../JASP/Widgets/JASPSplitHandle.qml | 6 +- .../JASP/Widgets/LoadingIndicator.qml | 2 +- .../components/JASP/Widgets/MainWindow.qml | 6 +- .../JASP/Widgets/ProgressBarHolder.qml | 4 +- .../JASP/Widgets/Ribbon/MenuArrowButton.qml | 4 +- .../JASP/Widgets/Ribbon/RibbonBar.qml | 2 +- .../JASP/Widgets/Ribbon/RibbonButton.qml | 8 +-- .../JASP/Widgets/Ribbon/Ribbons.qml | 4 +- .../JASP/Widgets/SaveDiscardCancelDialog.qml | 4 +- Desktop/components/JASP/Widgets/SpinBox.qml | 2 +- .../JASP/Widgets/UIScaleNotifier.qml | 6 +- Desktop/mainwindow.cpp | 43 ------------ QMLComponents/CMakeLists.txt | 4 +- QMLComponents/analysisbase.h | 2 + QMLComponents/analysisform.h | 2 + .../components/JASP/Controls/AssignButton.qml | 2 +- .../Controls/AssignedPairsVariablesList.qml | 2 +- .../AssignedRepeatedMeasuresCells.qml | 2 +- .../JASP/Controls/AssignedVariablesList.qml | 2 +- .../JASP/Controls/AvailableVariablesList.qml | 2 +- .../components/JASP/Controls/Button.qml | 4 +- .../components/JASP/Controls/CheckBox.qml | 2 +- .../components/JASP/Controls/ColumnLayout.qml | 4 +- .../JASP/Controls/ComponentsList.qml | 3 +- .../JASP/Controls/ControlErrorMessage.qml | 4 +- .../components/JASP/Controls/CrossButton.qml | 4 +- .../components/JASP/Controls/Divider.qml | 4 +- .../components/JASP/Controls/DoubleField.qml | 1 - .../components/JASP/Controls/DropDown.qml | 10 +-- .../JASP/Controls/FactorLevelList.qml | 1 - .../components/JASP/Controls/Group.qml | 2 +- .../JASP/Controls/InputListView.qml | 1 - .../components/JASP/Controls/IntegerField.qml | 4 +- .../JASP/Controls/JASPScrollBar.qml | 4 +- .../components/JASP/Controls/Label.qml | 5 +- .../components/JASP/Controls/MenuButton.qml | 1 - .../JASP/Controls/ModelTermsList.qml | 5 +- .../components/JASP/Controls/PercentField.qml | 1 - .../components/JASP/Controls/RadioButton.qml | 2 +- .../JASP/Controls/RadioButtonGroup.qml | 7 +- .../JASP/Controls/RectangularButton.qml | 4 +- .../JASP/Controls/RoundedButton.qml | 2 +- .../components/JASP/Controls/RowLayout.qml | 4 +- .../components/JASP/Controls/Section.qml | 7 +- .../components/JASP/Controls/Slider.qml | 9 ++- .../JASP/Controls/SortMenuButton.qml | 2 +- .../components/JASP/Controls/Switch.qml | 6 +- .../components/JASP/Controls/TabView.qml | 2 +- .../components/JASP/Controls/Text.qml | 3 +- .../components/JASP/Controls/TextArea.qml | 9 +-- .../components/JASP/Controls/TextField.qml | 6 +- .../JASP/Controls/VariablesForm.qml | 6 +- .../JASP/Controls/VariablesList.qml | 1 + QMLComponents/components/JASP/Controls/qmldir | 69 ------------------- QMLComponents/controls/checkboxbase.h | 1 + QMLComponents/controls/comboboxbase.h | 1 + QMLComponents/controls/componentslistbase.h | 1 + QMLComponents/controls/expanderbuttonbase.h | 2 + QMLComponents/controls/factorlevellistbase.h | 3 +- QMLComponents/controls/factorsformbase.h | 1 + QMLComponents/controls/groupboxbase.h | 1 + QMLComponents/controls/inputlistbase.h | 3 +- QMLComponents/controls/jaspcontrol.h | 1 + QMLComponents/controls/jaspdoublevalidator.h | 1 + QMLComponents/controls/jasplistcontrol.h | 1 + QMLComponents/controls/radiobuttonbase.h | 2 + .../controls/radiobuttonsgroupbase.h | 3 +- QMLComponents/controls/rsyntaxhighlighter.h | 2 + QMLComponents/controls/sliderbase.h | 3 +- QMLComponents/controls/tableviewbase.h | 1 + QMLComponents/controls/textareabase.h | 1 + QMLComponents/controls/textinputbase.h | 1 + QMLComponents/controls/variablesformbase.h | 1 + QMLComponents/controls/variableslistbase.h | 1 + QMLComponents/rsyntax/formulabase.h | 1 + 103 files changed, 172 insertions(+), 258 deletions(-) delete mode 100644 QMLComponents/components/JASP/Controls/qmldir diff --git a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml index 4f345cc24a..3e3415a372 100644 --- a/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml +++ b/Desktop/components/JASP/Widgets/ComputeColumnWindow.qml @@ -105,7 +105,7 @@ FocusScope { id: computeColumnEdit - RSyntaxHighlighterQuick + JaspControls.RSyntaxHighlighterQuick { textDocument: computeColumnEdit.textDocument } diff --git a/Desktop/components/JASP/Widgets/CreateComputeColumnDialog.qml b/Desktop/components/JASP/Widgets/CreateComputeColumnDialog.qml index 9f0d3725f5..c0aa9ef77c 100644 --- a/Desktop/components/JASP/Widgets/CreateComputeColumnDialog.qml +++ b/Desktop/components/JASP/Widgets/CreateComputeColumnDialog.qml @@ -1,5 +1,5 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Controls import JASP.Controls as JaspControls diff --git a/Desktop/components/JASP/Widgets/DataPanel.qml b/Desktop/components/JASP/Widgets/DataPanel.qml index b48f1b6d71..72ed16a0a5 100644 --- a/Desktop/components/JASP/Widgets/DataPanel.qml +++ b/Desktop/components/JASP/Widgets/DataPanel.qml @@ -1,6 +1,6 @@ -import QtQuick.Controls 6.0 -import QtQuick.Layouts 1.0 -import QtQuick 2.15 +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick Rectangle diff --git a/Desktop/components/JASP/Widgets/FileMenu/CurrentFile.qml b/Desktop/components/JASP/Widgets/FileMenu/CurrentFile.qml index 3be5ff1071..de95e80313 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/CurrentFile.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/CurrentFile.qml @@ -1,5 +1,5 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Controls Item diff --git a/Desktop/components/JASP/Widgets/FileMenu/DataLibrary.qml b/Desktop/components/JASP/Widgets/FileMenu/DataLibrary.qml index b1b884a632..2037442ea5 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/DataLibrary.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/DataLibrary.qml @@ -1,6 +1,6 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Item diff --git a/Desktop/components/JASP/Widgets/FileMenu/DataLibraryBreadCrumbs.qml b/Desktop/components/JASP/Widgets/FileMenu/DataLibraryBreadCrumbs.qml index a390d5430c..dcbb406528 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/DataLibraryBreadCrumbs.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/DataLibraryBreadCrumbs.qml @@ -1,7 +1,7 @@ -import QtQuick 2.0 -import QtQuick.Layouts 1.3 -import QtQuick.Controls 2.2 -import JASP.Theme 1.0 +import QtQuick +import QtQuick.Layouts +import QtQuick.Controls +import JASP.Theme ListView { diff --git a/Desktop/components/JASP/Widgets/FileMenu/PrefsTextInput.qml b/Desktop/components/JASP/Widgets/FileMenu/PrefsTextInput.qml index 89a6bbbad1..708e645625 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/PrefsTextInput.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/PrefsTextInput.qml @@ -1,5 +1,5 @@ -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls Rectangle { diff --git a/Desktop/components/JASP/Widgets/FileMenu/RecentFiles.qml b/Desktop/components/JASP/Widgets/FileMenu/RecentFiles.qml index e05df5b472..bcd9f72ab4 100644 --- a/Desktop/components/JASP/Widgets/FileMenu/RecentFiles.qml +++ b/Desktop/components/JASP/Widgets/FileMenu/RecentFiles.qml @@ -1,6 +1,6 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 -import QtQuick.Layouts 1.3 +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts Item diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/ColumnDrag.qml b/Desktop/components/JASP/Widgets/FilterConstructor/ColumnDrag.qml index 20359cd585..d15b5b6fae 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/ColumnDrag.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/ColumnDrag.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick DragGeneric { diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/DragGeneric.qml b/Desktop/components/JASP/Widgets/FilterConstructor/DragGeneric.qml index 3d92345c76..20ff8b7650 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/DragGeneric.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/DragGeneric.qml @@ -1,5 +1,5 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Controls MouseArea diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/DropSpot.qml b/Desktop/components/JASP/Widgets/FilterConstructor/DropSpot.qml index 044e9affb1..302d2c156d 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/DropSpot.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/DropSpot.qml @@ -1,5 +1,5 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Controls diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/DropTrash.qml b/Desktop/components/JASP/Widgets/FilterConstructor/DropTrash.qml index 550ff815cf..4247acf65b 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/DropTrash.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/DropTrash.qml @@ -1,5 +1,5 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Controls DropArea { diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/ElementView.qml b/Desktop/components/JASP/Widgets/FilterConstructor/ElementView.qml index f4a23acbf4..634ce8b034 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/ElementView.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/ElementView.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick ListView diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/Function.qml b/Desktop/components/JASP/Widgets/FilterConstructor/Function.qml index 661ddcff26..f841f69751 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/Function.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/Function.qml @@ -1,4 +1,4 @@ -import QtQuick 2.9 +import QtQuick Item diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/FunctionDrag.qml b/Desktop/components/JASP/Widgets/FilterConstructor/FunctionDrag.qml index a90ba399bb..004de13f1c 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/FunctionDrag.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/FunctionDrag.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick DragGeneric { shownChild: showMe diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/Number.qml b/Desktop/components/JASP/Widgets/FilterConstructor/Number.qml index abe2a4a751..1dd03cd8bc 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/Number.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/Number.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick Item { diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/NumberDrag.qml b/Desktop/components/JASP/Widgets/FilterConstructor/NumberDrag.qml index 0e897c71c7..9f7fa7a04d 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/NumberDrag.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/NumberDrag.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick DragGeneric { property real value: 0 diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/Operator.qml b/Desktop/components/JASP/Widgets/FilterConstructor/Operator.qml index 462b322d30..f8615e4855 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/Operator.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/Operator.qml @@ -1,4 +1,4 @@ -import QtQuick 2.9 +import QtQuick Item diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorDrag.qml b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorDrag.qml index 356c9ffb94..00b98ea46c 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorDrag.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorDrag.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick DragGeneric { shownChild: showMe diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelector.qml b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelector.qml index b3941760aa..b3e5e0e419 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelector.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelector.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick Item { diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelectorComputedColumns.qml b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelectorComputedColumns.qml index a4f1023c73..6edf744195 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelectorComputedColumns.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorSelectorComputedColumns.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick Item { diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVertical.qml b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVertical.qml index abd4d63a32..722c166fb0 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVertical.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVertical.qml @@ -1,4 +1,4 @@ -import QtQuick 2.9 +import QtQuick Item diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVerticalDrag.qml b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVerticalDrag.qml index 414f91f31f..4b76fbdb78 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVerticalDrag.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/OperatorVerticalDrag.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick DragGeneric { shownChild: showMe diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/String.qml b/Desktop/components/JASP/Widgets/FilterConstructor/String.qml index eb161aaa3f..ab24f4c87f 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/String.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/String.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick Item { diff --git a/Desktop/components/JASP/Widgets/FilterConstructor/StringDrag.qml b/Desktop/components/JASP/Widgets/FilterConstructor/StringDrag.qml index 7a601d0be0..2e3c299176 100644 --- a/Desktop/components/JASP/Widgets/FilterConstructor/StringDrag.qml +++ b/Desktop/components/JASP/Widgets/FilterConstructor/StringDrag.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick DragGeneric { property string text: "?" diff --git a/Desktop/components/JASP/Widgets/FilterWindow.qml b/Desktop/components/JASP/Widgets/FilterWindow.qml index 0c7af7ac87..11b46d95a6 100644 --- a/Desktop/components/JASP/Widgets/FilterWindow.qml +++ b/Desktop/components/JASP/Widgets/FilterWindow.qml @@ -301,7 +301,7 @@ FocusScope TextArea { - RSyntaxHighlighterQuick + JaspControls.RSyntaxHighlighterQuick { textDocument: filterGeneratedEdit.textDocument } @@ -351,7 +351,7 @@ FocusScope TextArea { - RSyntaxHighlighterQuick + JaspControls.RSyntaxHighlighterQuick { textDocument: filterEdit.textDocument } diff --git a/Desktop/components/JASP/Widgets/ImageInverter.qml b/Desktop/components/JASP/Widgets/ImageInverter.qml index acf8da15a2..b518edf062 100644 --- a/Desktop/components/JASP/Widgets/ImageInverter.qml +++ b/Desktop/components/JASP/Widgets/ImageInverter.qml @@ -1,4 +1,4 @@ -import QtQuick 2.15 +import QtQuick ///Setting src to an Image will put this image inverter there and enable/disable it based on a dark theme is enabled. This is especially useful for getting the negative of a plot ShaderEffect diff --git a/Desktop/components/JASP/Widgets/JASPMouseAreaToolTipped.qml b/Desktop/components/JASP/Widgets/JASPMouseAreaToolTipped.qml index 19e0a475f9..58a5c725cd 100644 --- a/Desktop/components/JASP/Widgets/JASPMouseAreaToolTipped.qml +++ b/Desktop/components/JASP/Widgets/JASPMouseAreaToolTipped.qml @@ -1,5 +1,5 @@ -import QtQuick 2.9 -import QtQuick.Controls 2.2 +import QtQuick +import QtQuick.Controls MouseArea { diff --git a/Desktop/components/JASP/Widgets/JASPSplitHandle.qml b/Desktop/components/JASP/Widgets/JASPSplitHandle.qml index 745092c72b..fc6e4b7213 100644 --- a/Desktop/components/JASP/Widgets/JASPSplitHandle.qml +++ b/Desktop/components/JASP/Widgets/JASPSplitHandle.qml @@ -1,6 +1,6 @@ -import QtQuick 2.11 -import JASP.Widgets 1.0 -import QtQuick.Controls 6.0 +import QtQuick +import JASP.Widgets +import QtQuick.Controls //Only works vertically right now... diff --git a/Desktop/components/JASP/Widgets/LoadingIndicator.qml b/Desktop/components/JASP/Widgets/LoadingIndicator.qml index f1ab4b989d..90d5b243bc 100644 --- a/Desktop/components/JASP/Widgets/LoadingIndicator.qml +++ b/Desktop/components/JASP/Widgets/LoadingIndicator.qml @@ -1,4 +1,4 @@ -import QtQuick 2.12 +import QtQuick Item { diff --git a/Desktop/components/JASP/Widgets/MainWindow.qml b/Desktop/components/JASP/Widgets/MainWindow.qml index 64fb401b95..4b614be4c8 100644 --- a/Desktop/components/JASP/Widgets/MainWindow.qml +++ b/Desktop/components/JASP/Widgets/MainWindow.qml @@ -16,10 +16,10 @@ // . // -import QtQuick 2.11 -import QtQuick.Window 2.11 +import QtQuick +import QtQuick.Window import JASP -import QtQuick.Controls 2.12 +import QtQuick.Controls Window { diff --git a/Desktop/components/JASP/Widgets/ProgressBarHolder.qml b/Desktop/components/JASP/Widgets/ProgressBarHolder.qml index 298aca7e7d..e257e2bfd8 100644 --- a/Desktop/components/JASP/Widgets/ProgressBarHolder.qml +++ b/Desktop/components/JASP/Widgets/ProgressBarHolder.qml @@ -1,5 +1,5 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 +import QtQuick +import QtQuick.Controls Item diff --git a/Desktop/components/JASP/Widgets/Ribbon/MenuArrowButton.qml b/Desktop/components/JASP/Widgets/Ribbon/MenuArrowButton.qml index 210b2f510f..f709189440 100644 --- a/Desktop/components/JASP/Widgets/Ribbon/MenuArrowButton.qml +++ b/Desktop/components/JASP/Widgets/Ribbon/MenuArrowButton.qml @@ -16,8 +16,8 @@ // . // -import QtQuick 2.11 -import QtQuick.Controls 2.4 +import QtQuick +import QtQuick.Controls Rectangle diff --git a/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml b/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml index 0deac041a1..78cbc20ffc 100644 --- a/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml +++ b/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml @@ -16,7 +16,7 @@ // . // -import QtQuick 2.11 +import QtQuick import JASP diff --git a/Desktop/components/JASP/Widgets/Ribbon/RibbonButton.qml b/Desktop/components/JASP/Widgets/Ribbon/RibbonButton.qml index b3d267b15e..b414e6a461 100644 --- a/Desktop/components/JASP/Widgets/Ribbon/RibbonButton.qml +++ b/Desktop/components/JASP/Widgets/Ribbon/RibbonButton.qml @@ -16,10 +16,10 @@ // . // -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP 1.0 -import JASP.Widgets 1.0 +import QtQuick +import QtQuick.Controls +import JASP +import JASP.Widgets Item { diff --git a/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml b/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml index ff4725e4d3..141ac2f617 100644 --- a/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml +++ b/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml @@ -16,8 +16,8 @@ // . // -import QtQuick 2.15 -import QtQuick.Controls 2.15 +import QtQuick +import QtQuick.Controls import JASP Item diff --git a/Desktop/components/JASP/Widgets/SaveDiscardCancelDialog.qml b/Desktop/components/JASP/Widgets/SaveDiscardCancelDialog.qml index 287f319fba..41c3283b8e 100644 --- a/Desktop/components/JASP/Widgets/SaveDiscardCancelDialog.qml +++ b/Desktop/components/JASP/Widgets/SaveDiscardCancelDialog.qml @@ -1,5 +1,5 @@ -import QtQuick 2.12 -import JASP 1.0 +import QtQuick +import JASP QtObject { diff --git a/Desktop/components/JASP/Widgets/SpinBox.qml b/Desktop/components/JASP/Widgets/SpinBox.qml index 6935273b4e..32e7e18005 100644 --- a/Desktop/components/JASP/Widgets/SpinBox.qml +++ b/Desktop/components/JASP/Widgets/SpinBox.qml @@ -97,7 +97,7 @@ Item TextField { id: valueField - validator: JASPDoubleValidator { id: doubleValidator; bottom: root.min; top: root.max ; decimals: root.decimals } + validator: JaspControls.JASPDoubleValidator { id: doubleValidator; bottom: root.min; top: root.max ; decimals: root.decimals } anchors { left: minus.right diff --git a/Desktop/components/JASP/Widgets/UIScaleNotifier.qml b/Desktop/components/JASP/Widgets/UIScaleNotifier.qml index c975126ed8..802ec970c1 100644 --- a/Desktop/components/JASP/Widgets/UIScaleNotifier.qml +++ b/Desktop/components/JASP/Widgets/UIScaleNotifier.qml @@ -1,6 +1,6 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP.Widgets 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Widgets Item { diff --git a/Desktop/mainwindow.cpp b/Desktop/mainwindow.cpp index 26b1662480..ac35e5cc27 100644 --- a/Desktop/mainwindow.cpp +++ b/Desktop/mainwindow.cpp @@ -39,27 +39,6 @@ #include "mainwindow.h" -#include "analysisform.h" -#include "controls/jaspcontrol.h" -#include "controls/checkboxbase.h" -#include "controls/comboboxbase.h" -#include "controls/textinputbase.h" -#include "controls/componentslistbase.h" -#include "controls/rsyntaxhighlighter.h" -#include "controls/factorsformbase.h" -#include "controls/inputlistbase.h" -#include "controls/textareabase.h" -#include "controls/sliderbase.h" -#include "controls/expanderbuttonbase.h" -#include "controls/variableslistbase.h" -#include "controls/variablesformbase.h" -#include "controls/factorlevellistbase.h" -#include "controls/tableviewbase.h" -#include "controls/radiobuttonbase.h" -#include "controls/radiobuttonsgroupbase.h" -#include "controls/jaspdoublevalidator.h" -#include "controls/groupboxbase.h" - #include "gui/jaspversionchecker.h" #include "gui/preferencesmodel.h" #include "ALTNavigation/altnavigation.h" @@ -69,7 +48,6 @@ #include "modules/activemodules.h" #include "modules/dynamicmodules.h" #include "modules/menumodel.h" -#include "modules/description/entrybase.h" #include "qquick/datasetview.h" #include "qquick/rcommander.h" @@ -166,30 +144,9 @@ MainWindow::MainWindow(QApplication * application) : QObject(application), _appl qmlRegisterType ("JASP", 1, 0, "DataSetView" ); qmlRegisterType ("JASP", 1, 0, "JaspTheme" ); - qmlRegisterType ("JASP", 1, 0, "AnalysisForm" ); qmlRegisterType ("JASP", 1, 0, "RCommander" ); - qmlRegisterType ("JASP", 1, 0, "JASPControl" ); - qmlRegisterType ("JASP", 1, 0, "GroupBoxBase" ); - qmlRegisterType ("JASP", 1, 0, "ExpanderButtonBase" ); - qmlRegisterType ("JASP", 1, 0, "CheckBoxBase" ); - qmlRegisterType ("JASP", 1, 0, "SliderBase" ); - qmlRegisterType ("JASP", 1, 0, "TextInputBase" ); - qmlRegisterType ("JASP", 1, 0, "TextAreaBase" ); - qmlRegisterType ("JASP", 1, 0, "ComboBoxBase" ); - qmlRegisterType ("JASP", 1, 0, "RadioButtonBase" ); - qmlRegisterType ("JASP", 1, 0, "RadioButtonsGroupBase" ); - qmlRegisterType ("JASP", 1, 0, "RSyntaxHighlighterQuick" ); - qmlRegisterType ("JASP", 1, 0, "ComponentsListBase" ); - qmlRegisterType ("JASP", 1, 0, "FactorsFormBase" ); - qmlRegisterType ("JASP", 1, 0, "InputListBase" ); - qmlRegisterType ("JASP", 1, 0, "FactorLevelListBase" ); - qmlRegisterType ("JASP", 1, 0, "VariablesListBase" ); - qmlRegisterType ("JASP", 1, 0, "VariablesFormBase" ); - qmlRegisterType ("JASP", 1, 0, "TableViewBase" ); - qmlRegisterType ("JASP", 1, 0, "JASPDoubleValidator" ); qmlRegisterType ("JASP", 1, 0, "ResultsJsInterface" ); qmlRegisterType ("JASP", 1, 0, "ColumnModel" ); - qmlRegisterType ("JASP", 1, 0, "Formula" ); qmlRegisterUncreatableType ("JASP.PlotEditor", 1, 0, "AxisModel", "Can't make it"); qmlRegisterUncreatableType ("JASP.PlotEditor", 1, 0, "PlotEditorModel", "Can't make it"); diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index 37e5c5b438..0dae550f57 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -11,7 +11,7 @@ qt_add_qml_module(QMLComponents #STATIC OUTPUT_DIRECTORY "JASP/Controls" RESOURCE_PREFIX /jasp-stats.org/imports - #PLUGIN_TARGET jaspcontrolsplugin + #PLUGIN_TARGET QMLComponents DEPENDENCIES QtQuick #NO_PLUGIN_OPTIONAL NO_GENERATE_PLUGIN_SOURCE @@ -40,6 +40,8 @@ target_include_directories( PUBLIC # JASP ${PROJECT_SOURCE_DIR}/Common ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder + ${CMAKE_CURRENT_LIST_DIR}/controls + ${CMAKE_CURRENT_LIST_DIR}/rsyntax ) diff --git a/QMLComponents/analysisbase.h b/QMLComponents/analysisbase.h index 5ae4bee671..9e9421f7d8 100644 --- a/QMLComponents/analysisbase.h +++ b/QMLComponents/analysisbase.h @@ -11,6 +11,8 @@ class AnalysisForm; class AnalysisBase : public QObject { Q_OBJECT + QML_ELEMENT + Q_PROPERTY(QQuickItem * formItem READ formItem NOTIFY formItemChanged ) Q_PROPERTY(QString qmlError READ qmlError WRITE setQmlError NOTIFY qmlErrorChanged ) diff --git a/QMLComponents/analysisform.h b/QMLComponents/analysisform.h index 844a2114bf..5327df37ef 100644 --- a/QMLComponents/analysisform.h +++ b/QMLComponents/analysisform.h @@ -44,6 +44,8 @@ class RSyntax; class AnalysisForm : public QQuickItem { Q_OBJECT + QML_ELEMENT + Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged ) Q_PROPERTY(QString errors READ errors NOTIFY errorsChanged ) Q_PROPERTY(QString warnings READ warnings NOTIFY warningsChanged ) diff --git a/QMLComponents/components/JASP/Controls/AssignButton.qml b/QMLComponents/components/JASP/Controls/AssignButton.qml index 858d8435e0..c745ff81cf 100644 --- a/QMLComponents/components/JASP/Controls/AssignButton.qml +++ b/QMLComponents/components/JASP/Controls/AssignButton.qml @@ -17,7 +17,7 @@ // -import QtQuick 2.11 +import QtQuick Button { diff --git a/QMLComponents/components/JASP/Controls/AssignedPairsVariablesList.qml b/QMLComponents/components/JASP/Controls/AssignedPairsVariablesList.qml index 7e6e673c3b..f0836c8a99 100644 --- a/QMLComponents/components/JASP/Controls/AssignedPairsVariablesList.qml +++ b/QMLComponents/components/JASP/Controls/AssignedPairsVariablesList.qml @@ -16,7 +16,7 @@ // . // -import JASP 1.0 +import JASP VariablesList { diff --git a/QMLComponents/components/JASP/Controls/AssignedRepeatedMeasuresCells.qml b/QMLComponents/components/JASP/Controls/AssignedRepeatedMeasuresCells.qml index 2c8f300fe4..b85d83d7ca 100644 --- a/QMLComponents/components/JASP/Controls/AssignedRepeatedMeasuresCells.qml +++ b/QMLComponents/components/JASP/Controls/AssignedRepeatedMeasuresCells.qml @@ -16,7 +16,7 @@ // . // -import JASP 1.0 +import JASP VariablesList { diff --git a/QMLComponents/components/JASP/Controls/AssignedVariablesList.qml b/QMLComponents/components/JASP/Controls/AssignedVariablesList.qml index f78d5cadfd..4ab65d9735 100644 --- a/QMLComponents/components/JASP/Controls/AssignedVariablesList.qml +++ b/QMLComponents/components/JASP/Controls/AssignedVariablesList.qml @@ -16,7 +16,7 @@ // . // -import JASP 1.0 +import JASP VariablesList { diff --git a/QMLComponents/components/JASP/Controls/AvailableVariablesList.qml b/QMLComponents/components/JASP/Controls/AvailableVariablesList.qml index 35f972f077..8228825b3b 100644 --- a/QMLComponents/components/JASP/Controls/AvailableVariablesList.qml +++ b/QMLComponents/components/JASP/Controls/AvailableVariablesList.qml @@ -16,7 +16,7 @@ // . // -import JASP 1.0 +import JASP VariablesList { diff --git a/QMLComponents/components/JASP/Controls/Button.qml b/QMLComponents/components/JASP/Controls/Button.qml index f948836885..1f2c555f9a 100644 --- a/QMLComponents/components/JASP/Controls/Button.qml +++ b/QMLComponents/components/JASP/Controls/Button.qml @@ -15,8 +15,8 @@ // License along with this program. If not, see // . // -import QtQuick 2.11 -import JASP 1.0 +import QtQuick +import JASP.Controls JASPControl { diff --git a/QMLComponents/components/JASP/Controls/CheckBox.qml b/QMLComponents/components/JASP/Controls/CheckBox.qml index 289cab2e6c..505bea54fc 100644 --- a/QMLComponents/components/JASP/Controls/CheckBox.qml +++ b/QMLComponents/components/JASP/Controls/CheckBox.qml @@ -18,7 +18,7 @@ import QtQuick import QtQuick.Controls as QtC -import JASP +import JASP.Controls CheckBoxBase diff --git a/QMLComponents/components/JASP/Controls/ColumnLayout.qml b/QMLComponents/components/JASP/Controls/ColumnLayout.qml index c4a362ea5c..3d200af4c4 100644 --- a/QMLComponents/components/JASP/Controls/ColumnLayout.qml +++ b/QMLComponents/components/JASP/Controls/ColumnLayout.qml @@ -16,8 +16,8 @@ // . // -import QtQuick 2.11 -import QtQuick.Layouts 1.3 +import QtQuick +import QtQuick.Layouts ColumnLayout diff --git a/QMLComponents/components/JASP/Controls/ComponentsList.qml b/QMLComponents/components/JASP/Controls/ComponentsList.qml index 9664e7d069..24331a7933 100644 --- a/QMLComponents/components/JASP/Controls/ComponentsList.qml +++ b/QMLComponents/components/JASP/Controls/ComponentsList.qml @@ -18,8 +18,9 @@ import QtQuick import QtQuick.Controls as QtControls -import JASP import QtQuick.Layouts +import JASP.Controls +import JASP ComponentsListBase { diff --git a/QMLComponents/components/JASP/Controls/ControlErrorMessage.qml b/QMLComponents/components/JASP/Controls/ControlErrorMessage.qml index b30b886f2c..b41c064394 100644 --- a/QMLComponents/components/JASP/Controls/ControlErrorMessage.qml +++ b/QMLComponents/components/JASP/Controls/ControlErrorMessage.qml @@ -15,8 +15,8 @@ // License along with this program. If not, see // . // -import QtQuick 2.11 -import JASP 1.0 +import QtQuick +import JASP Rectangle { diff --git a/QMLComponents/components/JASP/Controls/CrossButton.qml b/QMLComponents/components/JASP/Controls/CrossButton.qml index b643de2b7b..da5dba8504 100644 --- a/QMLComponents/components/JASP/Controls/CrossButton.qml +++ b/QMLComponents/components/JASP/Controls/CrossButton.qml @@ -15,8 +15,8 @@ // License along with this program. If not, see // . // -import QtQuick 2.11 -import JASP 1.0 +import QtQuick +import JASP Item { diff --git a/QMLComponents/components/JASP/Controls/Divider.qml b/QMLComponents/components/JASP/Controls/Divider.qml index 4a9ba1d3fb..8773d15558 100644 --- a/QMLComponents/components/JASP/Controls/Divider.qml +++ b/QMLComponents/components/JASP/Controls/Divider.qml @@ -17,8 +17,8 @@ // -import QtQuick 2.0 -import QtQuick.Layouts 1.3 +import QtQuick +import QtQuick.Layouts diff --git a/QMLComponents/components/JASP/Controls/DoubleField.qml b/QMLComponents/components/JASP/Controls/DoubleField.qml index dab013d9d8..4b997e50f5 100644 --- a/QMLComponents/components/JASP/Controls/DoubleField.qml +++ b/QMLComponents/components/JASP/Controls/DoubleField.qml @@ -18,7 +18,6 @@ import QtQuick import JASP.Controls -import JASP TextField { diff --git a/QMLComponents/components/JASP/Controls/DropDown.qml b/QMLComponents/components/JASP/Controls/DropDown.qml index d25e695c9a..971c0552a3 100644 --- a/QMLComponents/components/JASP/Controls/DropDown.qml +++ b/QMLComponents/components/JASP/Controls/DropDown.qml @@ -1,7 +1,7 @@ import QtQuick -import QtQuick.Controls +import QtQuick.Controls as QTC import QtQuick.Layouts -import JASP +import JASP.Controls ComboBoxBase @@ -51,7 +51,7 @@ ComboBoxBase } } - ComboBox + QTC.ComboBox { id: control implicitWidth: longestFieldWidth + (allowedTypeIcons.count > 0 ? allowedTypeIcons.width + jaspTheme.contentMargin : 0) @@ -160,7 +160,7 @@ ComboBoxBase radius: jaspTheme.jaspControlHighlightWidth } - popup: Popup + popup: QTC.Popup { id: popupRoot padding: 1 @@ -220,7 +220,7 @@ ComboBoxBase } } - delegate: ItemDelegate + delegate: QTC.ItemDelegate { implicitHeight: jaspTheme.comboBoxHeight implicitWidth: popupView.width diff --git a/QMLComponents/components/JASP/Controls/FactorLevelList.qml b/QMLComponents/components/JASP/Controls/FactorLevelList.qml index 3c11b231e5..79b97df0aa 100644 --- a/QMLComponents/components/JASP/Controls/FactorLevelList.qml +++ b/QMLComponents/components/JASP/Controls/FactorLevelList.qml @@ -19,7 +19,6 @@ import QtQuick import QtQml.Models import JASP.Controls -import JASP FactorLevelListBase { diff --git a/QMLComponents/components/JASP/Controls/Group.qml b/QMLComponents/components/JASP/Controls/Group.qml index 99a49f142c..2dc19410a9 100644 --- a/QMLComponents/components/JASP/Controls/Group.qml +++ b/QMLComponents/components/JASP/Controls/Group.qml @@ -17,8 +17,8 @@ // import QtQuick -import QtQuick.Controls import QtQuick.Layouts as L +import JASP.Controls import JASP GroupBoxBase diff --git a/QMLComponents/components/JASP/Controls/InputListView.qml b/QMLComponents/components/JASP/Controls/InputListView.qml index 2e707e96c2..21d2b93c97 100644 --- a/QMLComponents/components/JASP/Controls/InputListView.qml +++ b/QMLComponents/components/JASP/Controls/InputListView.qml @@ -19,7 +19,6 @@ import QtQuick import QtQml.Models import JASP.Controls -import JASP InputListBase { diff --git a/QMLComponents/components/JASP/Controls/IntegerField.qml b/QMLComponents/components/JASP/Controls/IntegerField.qml index 6862147e8a..9c32d7269d 100644 --- a/QMLComponents/components/JASP/Controls/IntegerField.qml +++ b/QMLComponents/components/JASP/Controls/IntegerField.qml @@ -16,8 +16,8 @@ // . // -import QtQuick 2.11 -import JASP 1.0 +import QtQuick +import JASP.Controls TextField { diff --git a/QMLComponents/components/JASP/Controls/JASPScrollBar.qml b/QMLComponents/components/JASP/Controls/JASPScrollBar.qml index b1b99282c3..346ffb887f 100644 --- a/QMLComponents/components/JASP/Controls/JASPScrollBar.qml +++ b/QMLComponents/components/JASP/Controls/JASPScrollBar.qml @@ -17,8 +17,8 @@ // // Code based on http://stackoverflow.com/questions/17833103/how-to-create-scrollbar-in-qtquick-2-0 -import QtQuick 2 -import QtQml 2 +import QtQuick +import QtQml Item { diff --git a/QMLComponents/components/JASP/Controls/Label.qml b/QMLComponents/components/JASP/Controls/Label.qml index 856c71a037..3fb81e714d 100644 --- a/QMLComponents/components/JASP/Controls/Label.qml +++ b/QMLComponents/components/JASP/Controls/Label.qml @@ -17,10 +17,9 @@ // import QtQuick -import QtQuick.Controls +import QtQuick.Controls as QtC - -Label +QtC.Label { font: jaspTheme.font color: enabled ? jaspTheme.textEnabled : jaspTheme.textDisabled diff --git a/QMLComponents/components/JASP/Controls/MenuButton.qml b/QMLComponents/components/JASP/Controls/MenuButton.qml index 512fc05bdc..598cb79c9d 100644 --- a/QMLComponents/components/JASP/Controls/MenuButton.qml +++ b/QMLComponents/components/JASP/Controls/MenuButton.qml @@ -1,5 +1,4 @@ import QtQuick -import QtQuick.Controls import QtQuick.Layouts import JASP.Controls diff --git a/QMLComponents/components/JASP/Controls/ModelTermsList.qml b/QMLComponents/components/JASP/Controls/ModelTermsList.qml index 646cf548e2..7f02497fda 100644 --- a/QMLComponents/components/JASP/Controls/ModelTermsList.qml +++ b/QMLComponents/components/JASP/Controls/ModelTermsList.qml @@ -16,8 +16,9 @@ // . // -import QtQuick 2.11 -import JASP 1.0 +import QtQuick +import JASP.Controls +import JASP VariablesList diff --git a/QMLComponents/components/JASP/Controls/PercentField.qml b/QMLComponents/components/JASP/Controls/PercentField.qml index a9d4fed043..bdf40091ab 100644 --- a/QMLComponents/components/JASP/Controls/PercentField.qml +++ b/QMLComponents/components/JASP/Controls/PercentField.qml @@ -18,7 +18,6 @@ import QtQuick import JASP.Controls -import JASP DoubleField { diff --git a/QMLComponents/components/JASP/Controls/RadioButton.qml b/QMLComponents/components/JASP/Controls/RadioButton.qml index 07eda15863..7499591b4d 100644 --- a/QMLComponents/components/JASP/Controls/RadioButton.qml +++ b/QMLComponents/components/JASP/Controls/RadioButton.qml @@ -18,7 +18,7 @@ import QtQuick import QtQuick.Controls as QtC -import JASP +import JASP.Controls RadioButtonBase diff --git a/QMLComponents/components/JASP/Controls/RadioButtonGroup.qml b/QMLComponents/components/JASP/Controls/RadioButtonGroup.qml index 10b5f566c0..0e81d74fc4 100644 --- a/QMLComponents/components/JASP/Controls/RadioButtonGroup.qml +++ b/QMLComponents/components/JASP/Controls/RadioButtonGroup.qml @@ -17,10 +17,9 @@ // -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.3 as L -import JASP 1.0 +import QtQuick +import QtQuick.Layouts as L +import JASP.Controls RadioButtonsGroupBase diff --git a/QMLComponents/components/JASP/Controls/RectangularButton.qml b/QMLComponents/components/JASP/Controls/RectangularButton.qml index 4f6cb2a556..4ca7163206 100644 --- a/QMLComponents/components/JASP/Controls/RectangularButton.qml +++ b/QMLComponents/components/JASP/Controls/RectangularButton.qml @@ -16,8 +16,8 @@ // . // -import QtQuick 2.9 -import QtQuick.Controls 2.4 +import QtQuick +import QtQuick.Controls Rectangle diff --git a/QMLComponents/components/JASP/Controls/RoundedButton.qml b/QMLComponents/components/JASP/Controls/RoundedButton.qml index 3dbde8a8bb..12698300e9 100644 --- a/QMLComponents/components/JASP/Controls/RoundedButton.qml +++ b/QMLComponents/components/JASP/Controls/RoundedButton.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick RectangularButton { diff --git a/QMLComponents/components/JASP/Controls/RowLayout.qml b/QMLComponents/components/JASP/Controls/RowLayout.qml index 992d70e1ef..8e367b563c 100644 --- a/QMLComponents/components/JASP/Controls/RowLayout.qml +++ b/QMLComponents/components/JASP/Controls/RowLayout.qml @@ -16,8 +16,8 @@ // . // -import QtQuick 2.11 -import QtQuick.Layouts 1.3 +import QtQuick +import QtQuick.Layouts RowLayout { diff --git a/QMLComponents/components/JASP/Controls/Section.qml b/QMLComponents/components/JASP/Controls/Section.qml index 2587f01ea2..919de3fa10 100644 --- a/QMLComponents/components/JASP/Controls/Section.qml +++ b/QMLComponents/components/JASP/Controls/Section.qml @@ -16,9 +16,10 @@ // . // -import QtQuick 2.11 -import QtQuick.Layouts 1.3 as L -import JASP 1.0 +import QtQuick +import QtQuick.Layouts as L +import JASP.Controls +import JASP FocusScope { diff --git a/QMLComponents/components/JASP/Controls/Slider.qml b/QMLComponents/components/JASP/Controls/Slider.qml index 3ebda78470..44cd8c99a9 100644 --- a/QMLComponents/components/JASP/Controls/Slider.qml +++ b/QMLComponents/components/JASP/Controls/Slider.qml @@ -1,8 +1,7 @@ import QtQuick -import QtQuick.Controls -import JASP.Controls as JC //He returns! +import QtQuick.Controls as QtC +import JASP.Controls import QtQuick.Layouts -import JASP SliderBase { @@ -45,7 +44,7 @@ SliderBase color: enabled ? jaspTheme.textEnabled : jaspTheme.textDisabled } - Slider + QtC.Slider { id: control Layout.alignment: Qt.AlignCenter @@ -105,7 +104,7 @@ SliderBase } - JC.DoubleField + DoubleField { id: textField value: control.value diff --git a/QMLComponents/components/JASP/Controls/SortMenuButton.qml b/QMLComponents/components/JASP/Controls/SortMenuButton.qml index 1de6d35880..529e40f0fa 100644 --- a/QMLComponents/components/JASP/Controls/SortMenuButton.qml +++ b/QMLComponents/components/JASP/Controls/SortMenuButton.qml @@ -1,4 +1,4 @@ -import QtQuick 2.0 +import QtQuick MenuButton diff --git a/QMLComponents/components/JASP/Controls/Switch.qml b/QMLComponents/components/JASP/Controls/Switch.qml index dc3597159f..923cb5c532 100644 --- a/QMLComponents/components/JASP/Controls/Switch.qml +++ b/QMLComponents/components/JASP/Controls/Switch.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import JASP 1.0 +import QtQuick +import QtQuick.Controls +import JASP.Controls CheckBoxBase { diff --git a/QMLComponents/components/JASP/Controls/TabView.qml b/QMLComponents/components/JASP/Controls/TabView.qml index 5b974105b8..fa08b80baa 100644 --- a/QMLComponents/components/JASP/Controls/TabView.qml +++ b/QMLComponents/components/JASP/Controls/TabView.qml @@ -19,7 +19,7 @@ import QtQuick import QtQuick.Controls as QtControls import QtQuick.Layouts -import JASP +import JASP.Controls ComponentsListBase { diff --git a/QMLComponents/components/JASP/Controls/Text.qml b/QMLComponents/components/JASP/Controls/Text.qml index 69ed97faf7..8eb234487a 100644 --- a/QMLComponents/components/JASP/Controls/Text.qml +++ b/QMLComponents/components/JASP/Controls/Text.qml @@ -16,8 +16,7 @@ // . // -import QtQuick 2.11 -import QtQuick.Controls 2.4 +import QtQuick Text { diff --git a/QMLComponents/components/JASP/Controls/TextArea.qml b/QMLComponents/components/JASP/Controls/TextArea.qml index b04b5799e2..98c94376ed 100644 --- a/QMLComponents/components/JASP/Controls/TextArea.qml +++ b/QMLComponents/components/JASP/Controls/TextArea.qml @@ -1,7 +1,8 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 as QTC -import QtQuick.Layouts 1.3 -import JASP 1.0 +import QtQuick +import QtQuick.Controls as QTC +import QtQuick.Layouts +import JASP.Controls +import JASP TextAreaBase { diff --git a/QMLComponents/components/JASP/Controls/TextField.qml b/QMLComponents/components/JASP/Controls/TextField.qml index 172b8d9a8d..649a4125e2 100644 --- a/QMLComponents/components/JASP/Controls/TextField.qml +++ b/QMLComponents/components/JASP/Controls/TextField.qml @@ -17,9 +17,9 @@ // import QtQuick -import QtQuick.Controls 2.4 as QTC -import QtQuick.Layouts 1.3 -import JASP 1.0 +import QtQuick.Controls as QTC +import QtQuick.Layouts +import JASP.Controls TextInputBase { diff --git a/QMLComponents/components/JASP/Controls/VariablesForm.qml b/QMLComponents/components/JASP/Controls/VariablesForm.qml index fc7bc93484..9dc9e1940e 100644 --- a/QMLComponents/components/JASP/Controls/VariablesForm.qml +++ b/QMLComponents/components/JASP/Controls/VariablesForm.qml @@ -16,9 +16,9 @@ // . // -import QtQuick 2.12 -import QtQuick.Layouts 1.12 -import JASP 1.0 +import QtQuick +import QtQuick.Layouts +import JASP.Controls VariablesFormBase { diff --git a/QMLComponents/components/JASP/Controls/VariablesList.qml b/QMLComponents/components/JASP/Controls/VariablesList.qml index 766a5937a2..6f3559d963 100644 --- a/QMLComponents/components/JASP/Controls/VariablesList.qml +++ b/QMLComponents/components/JASP/Controls/VariablesList.qml @@ -20,6 +20,7 @@ import QtQuick import QtQuick.Controls as QTCONTROLS import QtQml.Models +import JASP.Controls import JASP VariablesListBase diff --git a/QMLComponents/components/JASP/Controls/qmldir b/QMLComponents/components/JASP/Controls/qmldir deleted file mode 100644 index 1edc3a2b75..0000000000 --- a/QMLComponents/components/JASP/Controls/qmldir +++ /dev/null @@ -1,69 +0,0 @@ -module -AddColumnField 1.0 AddColumnField.qml -AssignButton 1.0 AssignButton.qml -AssignedRepeatedMeasuresCells 1.0 AssignedRepeatedMeasuresCells.qml -AssignedPairsVariablesList 1.0 AssignedPairsVariablesList.qml -AssignedVariablesList 1.0 AssignedVariablesList.qml -AvailableVariablesList 1.0 AvailableVariablesList.qml -BasicThreeButtonTableView 1.0 BasicThreeButtonTableView.qml -BayesFactorType 1.0 BayesFactorType.qml -Button 1.0 Button.qml -CheckBox 1.0 CheckBox.qml -Chi2TestTableView 1.0 Chi2TestTableView.qml -CIField 1.0 CIField.qml -ColumnLayout 1.0 ColumnLayout.qml -ColorPalette 1.0 ColorPalette.qml -ComboBox 1.0 ComboBox.qml -ComponentsList 1.0 ComponentsList.qml -ComputedColumnField 1.0 ComputedColumnField.qml -CheckColumnIsFreeOrMineField 1.0 CheckColumnIsFreeOrMineField.qml -ContrastsList 1.0 ContrastsList.qml -ControlErrorMessage 1.0 ControlErrorMessage.qml -CrossButton 1.0 CrossButton.qml -CustomContrastsTableView 1.0 CustomContrastsTableView.qml -Divider 1.0 Divider.qml -DoubleField 1.0 DoubleField.qml -DropDown 1.0 ComboBox.qml -ExpanderButton 1.0 ExpanderButton.qml -FactorLevelList 1.0 FactorLevelList.qml -FactorsForm 1.0 FactorsForm.qml -FactorsList 1.0 FactorsList.qml -FileSelector 1.0 FileSelector.qml -Form 1.0 Form.qml -FormulaField 1.0 FormulaField.qml -GridLayout 1.0 GridLayout.qml -Group 1.0 GroupBox.qml -GroupBox 1.0 GroupBox.qml -HelpButton 1.0 HelpButton.qml -InputListView 1.0 InputListView.qml -IntegerField 1.0 IntegerField.qml -JagsTableView 1.0 JagsTableView.qml -JAGSTextArea 1.0 JAGSTextArea.qml -JASPControl 1.0 JASPControl.qml -JASPGridControl 1.0 JASPGridControl.qml -JASPGridViewControl 1.0 JASPGridViewControl.qml -JASPScrollBar 1.0 JASPScrollBar.qml -Label 1.0 Label.qml -MenuButton 1.0 MenuButton.qml -ModelTermsList 1.0 ModelTermsList.qml -PercentField 1.0 PercentField.qml -RowLayout 1.0 RowLayout.qml -SubjectivePriors 1.0 SubjectivePriors.qml -SortMenuButton 1.0 SortMenuButton.qml -RoundedButton 1.0 RoundedButton.qml -RectangularButton 1.0 RectangularButton.qml -Section 1.0 ExpanderButton.qml -TabView 1.0 TabView.qml -Text 1.0 Text.qml -RadioButton 1.0 RadioButton.qml -RadioButtonGroup 1.0 RadioButtonGroup.qml -RowComponents 1.0 RowComponents.qml -SetSeed 1.0 SetSeed.qml -SimpleTableView 1.0 SimpleTableView.qml -Slider 1.0 Slider.qml -Switch 1.0 Switch.qml -TableView 1.0 TableView.qml -TextField 1.0 TextField.qml -TextArea 1.0 TextArea.qml -VariablesForm 1.0 VariablesForm.qml -VariablesList 1.0 VariablesList.qml diff --git a/QMLComponents/controls/checkboxbase.h b/QMLComponents/controls/checkboxbase.h index c06d4c8484..771aa57905 100644 --- a/QMLComponents/controls/checkboxbase.h +++ b/QMLComponents/controls/checkboxbase.h @@ -25,6 +25,7 @@ class CheckBoxBase : public JASPControl, public BoundControlBase { Q_OBJECT + QML_ELEMENT public: CheckBoxBase(QQuickItem* parent = nullptr); diff --git a/QMLComponents/controls/comboboxbase.h b/QMLComponents/controls/comboboxbase.h index b7d1bb22f2..f06ec7d63d 100644 --- a/QMLComponents/controls/comboboxbase.h +++ b/QMLComponents/controls/comboboxbase.h @@ -28,6 +28,7 @@ class ComboBoxBase : public JASPListControl, public BoundControlBase { Q_OBJECT + QML_ELEMENT Q_PROPERTY( int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged ) Q_PROPERTY( QString currentText READ currentText WRITE setCurrentText NOTIFY currentTextChanged ) diff --git a/QMLComponents/controls/componentslistbase.h b/QMLComponents/controls/componentslistbase.h index 0ceb20d16d..ff54cbd05e 100644 --- a/QMLComponents/controls/componentslistbase.h +++ b/QMLComponents/controls/componentslistbase.h @@ -26,6 +26,7 @@ class ComponentsListBase : public JASPListControl, public BoundControlBase { Q_OBJECT + QML_ELEMENT Q_PROPERTY( bool addItemManually READ addItemManually WRITE setAddItemManually NOTIFY addItemManuallyChanged ) Q_PROPERTY( int minimumItems READ minimumItems WRITE setMinimumItems NOTIFY minimumItemsChanged ) diff --git a/QMLComponents/controls/expanderbuttonbase.h b/QMLComponents/controls/expanderbuttonbase.h index 44dafcbc9d..3dc5202bbe 100644 --- a/QMLComponents/controls/expanderbuttonbase.h +++ b/QMLComponents/controls/expanderbuttonbase.h @@ -26,6 +26,8 @@ class ExpanderButtonBase : public JASPControl { Q_OBJECT + QML_ELEMENT + public: explicit ExpanderButtonBase(QQuickItem *parent = nullptr); diff --git a/QMLComponents/controls/factorlevellistbase.h b/QMLComponents/controls/factorlevellistbase.h index 9bdbb0d9bd..d266b37e7d 100644 --- a/QMLComponents/controls/factorlevellistbase.h +++ b/QMLComponents/controls/factorlevellistbase.h @@ -26,7 +26,8 @@ class FactorLevelListBase : public JASPListControl, public BoundControlBase { Q_OBJECT - + QML_ELEMENT + Q_PROPERTY( QString factorName READ factorName WRITE setFactorName NOTIFY factorNameChanged ) Q_PROPERTY( QString levelName READ levelName WRITE setLevelName NOTIFY levelNameChanged ) Q_PROPERTY( QString factorPlaceHolder READ factorPlaceHolder WRITE setFactorPlaceHolder NOTIFY factorPlaceHolderChanged ) diff --git a/QMLComponents/controls/factorsformbase.h b/QMLComponents/controls/factorsformbase.h index 9fc6c09bfd..7775637948 100644 --- a/QMLComponents/controls/factorsformbase.h +++ b/QMLComponents/controls/factorsformbase.h @@ -27,6 +27,7 @@ class FactorsFormBase : public JASPListControl, public BoundControlBase { Q_OBJECT + QML_ELEMENT Q_PROPERTY( int initNumberFactors READ initNumberFactors WRITE setInitNumberFactors NOTIFY initNumberFactorsChanged ) Q_PROPERTY( int countVariables READ countVariables NOTIFY countVariablesChanged ) diff --git a/QMLComponents/controls/groupboxbase.h b/QMLComponents/controls/groupboxbase.h index da38995fb8..e4d47583ea 100644 --- a/QMLComponents/controls/groupboxbase.h +++ b/QMLComponents/controls/groupboxbase.h @@ -24,6 +24,7 @@ class GroupBoxBase : public JASPControl { Q_OBJECT + QML_ELEMENT public: GroupBoxBase(QQuickItem* parent = nullptr); diff --git a/QMLComponents/controls/inputlistbase.h b/QMLComponents/controls/inputlistbase.h index cc104ab142..d906e9ac1d 100644 --- a/QMLComponents/controls/inputlistbase.h +++ b/QMLComponents/controls/inputlistbase.h @@ -26,7 +26,8 @@ class InputListBase : public JASPListControl, public BoundControlBase { Q_OBJECT - + QML_ELEMENT + public: InputListBase(QQuickItem* parent = nullptr); diff --git a/QMLComponents/controls/jaspcontrol.h b/QMLComponents/controls/jaspcontrol.h index 084509525e..effc66550c 100644 --- a/QMLComponents/controls/jaspcontrol.h +++ b/QMLComponents/controls/jaspcontrol.h @@ -18,6 +18,7 @@ class BoundControl; class JASPControl : public QQuickItem { Q_OBJECT + QML_ELEMENT Q_PROPERTY( ControlType controlType READ controlType WRITE setControlType NOTIFY controlTypeChanged ) Q_PROPERTY( QString name READ name WRITE setName NOTIFY nameChanged ) diff --git a/QMLComponents/controls/jaspdoublevalidator.h b/QMLComponents/controls/jaspdoublevalidator.h index 1d1d7ed6f7..e152a63b3c 100644 --- a/QMLComponents/controls/jaspdoublevalidator.h +++ b/QMLComponents/controls/jaspdoublevalidator.h @@ -29,6 +29,7 @@ class JASPDoubleValidator : public QDoubleValidator { Q_OBJECT + QML_ELEMENT Q_PROPERTY(JASPControl::Inclusive inclusive READ inclusive WRITE setInclusive NOTIFY inclusiveChanged ) diff --git a/QMLComponents/controls/jasplistcontrol.h b/QMLComponents/controls/jasplistcontrol.h index 2bc05057d5..e5b83e4f09 100644 --- a/QMLComponents/controls/jasplistcontrol.h +++ b/QMLComponents/controls/jasplistcontrol.h @@ -38,6 +38,7 @@ class ColumnTypesModel; class JASPListControl : public JASPControl { Q_OBJECT + QML_ELEMENT Q_PROPERTY( ListModel* model READ model NOTIFY modelChanged ) Q_PROPERTY( QVariant source READ source WRITE setSource NOTIFY sourceChanged ) diff --git a/QMLComponents/controls/radiobuttonbase.h b/QMLComponents/controls/radiobuttonbase.h index 35f9051b53..37e2d4b83f 100644 --- a/QMLComponents/controls/radiobuttonbase.h +++ b/QMLComponents/controls/radiobuttonbase.h @@ -26,6 +26,8 @@ class RadioButtonsGroupBase; class RadioButtonBase : public JASPControl { Q_OBJECT + QML_ELEMENT + Q_PROPERTY(JASPControl* group READ group NOTIFY groupChanged) // Cannot have a RadioButtonsGroupBase property: compilation error in the moc stuff. public: diff --git a/QMLComponents/controls/radiobuttonsgroupbase.h b/QMLComponents/controls/radiobuttonsgroupbase.h index 43e164be77..05da6d8439 100644 --- a/QMLComponents/controls/radiobuttonsgroupbase.h +++ b/QMLComponents/controls/radiobuttonsgroupbase.h @@ -28,7 +28,8 @@ class RadioButtonBase; class RadioButtonsGroupBase : public JASPControl, public BoundControlBase { Q_OBJECT - + QML_ELEMENT + Q_PROPERTY( QString value READ value NOTIFY valueChanged ) Q_PROPERTY( RadioButtonBase* checkedButton READ checkedButton NOTIFY valueChanged ) Q_PROPERTY( QList buttons READ buttons NOTIFY buttonsChanged ) diff --git a/QMLComponents/controls/rsyntaxhighlighter.h b/QMLComponents/controls/rsyntaxhighlighter.h index 0bfe8f1fd2..b3b79678d7 100644 --- a/QMLComponents/controls/rsyntaxhighlighter.h +++ b/QMLComponents/controls/rsyntaxhighlighter.h @@ -72,6 +72,8 @@ protected slots: class RSyntaxHighlighterQuick : public QQuickItem { Q_OBJECT + QML_ELEMENT + Q_PROPERTY(QQuickTextDocument* textDocument READ textDocument WRITE setTextDocument NOTIFY textDocumentChanged) public: diff --git a/QMLComponents/controls/sliderbase.h b/QMLComponents/controls/sliderbase.h index 9318439d4e..6ab003139f 100644 --- a/QMLComponents/controls/sliderbase.h +++ b/QMLComponents/controls/sliderbase.h @@ -7,7 +7,8 @@ class SliderBase : public JASPControl, public BoundControlBase { Q_OBJECT - + QML_ELEMENT + public: SliderBase(QQuickItem* parent = nullptr); diff --git a/QMLComponents/controls/tableviewbase.h b/QMLComponents/controls/tableviewbase.h index d8edc78a81..df4d0bead7 100644 --- a/QMLComponents/controls/tableviewbase.h +++ b/QMLComponents/controls/tableviewbase.h @@ -26,6 +26,7 @@ class TableViewBase : public JASPListControl, public BoundControl { Q_OBJECT + QML_ELEMENT Q_PROPERTY( ModelType modelType READ modelType WRITE setModelType NOTIFY modelTypeChanged ) Q_PROPERTY( ItemType itemType READ itemType WRITE setItemType NOTIFY itemTypeChanged ) diff --git a/QMLComponents/controls/textareabase.h b/QMLComponents/controls/textareabase.h index 0c08ebdc61..4d231dfde5 100644 --- a/QMLComponents/controls/textareabase.h +++ b/QMLComponents/controls/textareabase.h @@ -35,6 +35,7 @@ class TextAreaBase : public JASPListControl, public BoundControl { Q_OBJECT + QML_ELEMENT Q_PROPERTY( TextType textType READ textType WRITE setTextType NOTIFY textTypeChanged ) Q_PROPERTY( bool hasScriptError READ hasScriptError WRITE setHasScriptError NOTIFY hasScriptErrorChanged ) diff --git a/QMLComponents/controls/textinputbase.h b/QMLComponents/controls/textinputbase.h index f7a63c6b75..8e5bc18b81 100644 --- a/QMLComponents/controls/textinputbase.h +++ b/QMLComponents/controls/textinputbase.h @@ -25,6 +25,7 @@ class TextInputBase : public JASPControl, public BoundControlBase { Q_OBJECT + QML_ELEMENT Q_PROPERTY( bool hasScriptError READ hasScriptError WRITE setHasScriptError NOTIFY hasScriptErrorChanged ) Q_PROPERTY( QVariant defaultValue READ defaultValue WRITE setDefaultValue NOTIFY defaultValueChanged ) diff --git a/QMLComponents/controls/variablesformbase.h b/QMLComponents/controls/variablesformbase.h index 4b4c9d3d2d..373640869a 100644 --- a/QMLComponents/controls/variablesformbase.h +++ b/QMLComponents/controls/variablesformbase.h @@ -26,6 +26,7 @@ class VariablesListBase; class VariablesFormBase : public JASPControl { Q_OBJECT + QML_ELEMENT Q_PROPERTY( JASPControl* availableVariablesList READ availableVariablesList NOTIFY availableVariablesListChanged ) Q_PROPERTY( QList allAssignedVariablesList READ allAssignedVariablesList NOTIFY allAssignedVariablesListChanged ) diff --git a/QMLComponents/controls/variableslistbase.h b/QMLComponents/controls/variableslistbase.h index 3e77854f91..73c17a5df7 100644 --- a/QMLComponents/controls/variableslistbase.h +++ b/QMLComponents/controls/variableslistbase.h @@ -29,6 +29,7 @@ class CheckBoxBase; class VariablesListBase : public JASPListControl, public BoundControl { Q_OBJECT + QML_ELEMENT Q_PROPERTY( ListViewType listViewType READ listViewType WRITE setListViewType NOTIFY listViewTypeChanged ) Q_PROPERTY( int columns READ columns WRITE setColumns NOTIFY columnsChanged ) diff --git a/QMLComponents/rsyntax/formulabase.h b/QMLComponents/rsyntax/formulabase.h index 691b0713b5..8739afc4e0 100644 --- a/QMLComponents/rsyntax/formulabase.h +++ b/QMLComponents/rsyntax/formulabase.h @@ -31,6 +31,7 @@ class ListModel; class FormulaBase : public QQuickItem { Q_OBJECT + QML_NAMED_ELEMENT(Formula) Q_PROPERTY( QVariant userMustSpecify READ userMustSpecify WRITE setUserMustSpecify NOTIFY userMustSpecifyChanged ) Q_PROPERTY( QVariant lhs READ lhs WRITE setLhs NOTIFY lhsChanged ) From 104ca01c625f1f5776d05174180d371f7251f760 Mon Sep 17 00:00:00 2001 From: boutinb Date: Tue, 14 Jan 2025 17:24:19 +0100 Subject: [PATCH 06/14] Add ALTNavigation --- Desktop/components/JASP/Widgets/MainPage.qml | 14 +++++++------- .../components/JASP/Widgets/Ribbon/RibbonBar.qml | 1 + Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml | 2 +- Desktop/mainwindow.cpp | 2 -- QMLComponents/ALTNavigation/altnavigation.cpp | 9 --------- QMLComponents/ALTNavigation/altnavigation.h | 6 +----- QMLComponents/ALTNavigation/altnavscope.cpp | 4 +++- QMLComponents/ALTNavigation/altnavtag.h | 1 + QMLComponents/CMakeLists.txt | 1 + QMLComponents/analysisform.cpp | 2 +- .../components/JASP/Controls}/ALTNavTag.qml | 1 + QMLComponents/utilities/qmlutils.cpp | 5 +++++ 12 files changed, 22 insertions(+), 26 deletions(-) rename {Desktop/components/JASP/Widgets => QMLComponents/components/JASP/Controls}/ALTNavTag.qml (97%) diff --git a/Desktop/components/JASP/Widgets/MainPage.qml b/Desktop/components/JASP/Widgets/MainPage.qml index 538c078d80..26e56c539b 100644 --- a/Desktop/components/JASP/Widgets/MainPage.qml +++ b/Desktop/components/JASP/Widgets/MainPage.qml @@ -105,10 +105,10 @@ Item onXChanged: checkPosition(false) onDraggingChanged: checkPosition(true) - ALTNavigation.enabled: true - ALTNavigation.onTagMatch: { arrowClicked(); } - ALTNavigation.requestedPostfix: "D" - ALTNavigation.y: height / 2 - 25 * jaspTheme.uiScale + JC.ALTNavigation.enabled: true + JC.ALTNavigation.onTagMatch: { arrowClicked(); } + JC.ALTNavigation.requestedPostfix: "D" + JC.ALTNavigation.y: height / 2 - 25 * jaspTheme.uiScale function checkPosition(forceCheck) { @@ -230,9 +230,9 @@ Item visible: hasAnalysis && !ribbonModel.dataMode color: analysesModel.currentAnalysisIndex !== -1 ? jaspTheme.uiBackground : jaspTheme.white - ALTNavigation.enabled: true - ALTNavigation.requestedPostfix: "R" - ALTNavigation.onTagMatch: { resultsView.nextItemInFocusChain().forceActiveFocus(); } + JC.ALTNavigation.enabled: true + JC.ALTNavigation.requestedPostfix: "R" + JC.ALTNavigation.onTagMatch: { resultsView.nextItemInFocusChain().forceActiveFocus(); } Rectangle { diff --git a/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml b/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml index 78cbc20ffc..bb6a66b7d6 100644 --- a/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml +++ b/Desktop/components/JASP/Widgets/Ribbon/RibbonBar.qml @@ -18,6 +18,7 @@ import QtQuick import JASP +import JASP.Controls FocusScope diff --git a/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml b/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml index 141ac2f617..91c36036af 100644 --- a/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml +++ b/Desktop/components/JASP/Widgets/Ribbon/Ribbons.qml @@ -18,7 +18,7 @@ import QtQuick import QtQuick.Controls -import JASP +import JASP.Controls Item { diff --git a/Desktop/mainwindow.cpp b/Desktop/mainwindow.cpp index ac35e5cc27..6426ce2a25 100644 --- a/Desktop/mainwindow.cpp +++ b/Desktop/mainwindow.cpp @@ -139,7 +139,6 @@ MainWindow::MainWindow(QApplication * application) : QObject(application), _appl makeConnections(); - qmlRegisterUncreatableType ("JASP", 1, 0, "JASP", "Impossible to create JASP Object" ); //This is here to keep JASP.enum short I guess? qmlRegisterUncreatableType ("JASP", 1, 0, "MessageForwarder", "You can't touch this" ); qmlRegisterType ("JASP", 1, 0, "DataSetView" ); @@ -150,7 +149,6 @@ MainWindow::MainWindow(QApplication * application) : QObject(application), _appl qmlRegisterUncreatableType ("JASP.PlotEditor", 1, 0, "AxisModel", "Can't make it"); qmlRegisterUncreatableType ("JASP.PlotEditor", 1, 0, "PlotEditorModel", "Can't make it"); - ALTNavigation::registerQMLTypes("JASP"); ALTNavControl::ctrl()->enableAlTNavigation(_preferences->ALTNavModeActive()); QmlUtils::setGlobalPropertiesInQMLContext(_qml->rootContext()); diff --git a/QMLComponents/ALTNavigation/altnavigation.cpp b/QMLComponents/ALTNavigation/altnavigation.cpp index 1c725663a3..8acf8b7b76 100644 --- a/QMLComponents/ALTNavigation/altnavigation.cpp +++ b/QMLComponents/ALTNavigation/altnavigation.cpp @@ -7,12 +7,3 @@ ALTNavScope* ALTNavigation::qmlAttachedProperties(QObject *object) ALTNavControl::ctrl()->registrate(scope, object); return scope; } - -//Could parameterize module -void ALTNavigation::registerQMLTypes(QString uri) -{ - std::string u = uri.toStdString(); - qmlRegisterType (u.c_str(), 1, 0, "ALTNavigation" ); - qmlRegisterType (u.c_str(), 1, 0, "ALTNavTagBase" ); - qmlRegisterUncreatableType (u.c_str(), 1, 0, "AssignmentStrategy", "Can't make it" ); -} diff --git a/QMLComponents/ALTNavigation/altnavigation.h b/QMLComponents/ALTNavigation/altnavigation.h index cc980e6906..f6f36a9efe 100644 --- a/QMLComponents/ALTNavigation/altnavigation.h +++ b/QMLComponents/ALTNavigation/altnavigation.h @@ -84,6 +84,7 @@ class ALTNavigation : public QObject { Q_OBJECT + QML_ELEMENT QML_ATTACHED(ALTNavScope) public: @@ -94,11 +95,6 @@ class ALTNavigation : public QObject */ static ALTNavScope* qmlAttachedProperties(QObject *object); - /*! - * \brief registers the QML types related to this subsystem under JASP - */ - static void registerQMLTypes(QString uri); - }; #endif // ALTNAVIGATION_H diff --git a/QMLComponents/ALTNavigation/altnavscope.cpp b/QMLComponents/ALTNavigation/altnavscope.cpp index 36149648e0..8a571d03a7 100644 --- a/QMLComponents/ALTNavigation/altnavscope.cpp +++ b/QMLComponents/ALTNavigation/altnavscope.cpp @@ -4,6 +4,8 @@ #include #include +#include +#include "log.h" ALTNavScope::ALTNavScope(QObject* attachee) : QObject{attachee} @@ -15,7 +17,7 @@ ALTNavScope::ALTNavScope(QObject* attachee) if(_attachee) //is a visual item { //create a visual tag - QQmlComponent component(qmlEngine(_attachee), QUrl("qrc:///components/JASP/Widgets/ALTNavTag.qml"), _attachee); + QQmlComponent component(qmlEngine(_attachee), QUrl("qrc:/jasp-stats.org/imports/JASP/Controls/components/JASP/Controls/ALTNavTag.qml"), _attachee); _attachedTag = qobject_cast(component.create()); _attachedTag->setParentItem(_attachee); _attachedTag->setParent(_attachee); diff --git a/QMLComponents/ALTNavigation/altnavtag.h b/QMLComponents/ALTNavigation/altnavtag.h index a455f14db4..dc5a18084f 100644 --- a/QMLComponents/ALTNavigation/altnavtag.h +++ b/QMLComponents/ALTNavigation/altnavtag.h @@ -14,6 +14,7 @@ class ALTNavScope; class ALTNavTagBase : public QQuickItem { Q_OBJECT + QML_ELEMENT Q_PROPERTY( QString tagText READ getTagText NOTIFY tagTextChanged ); Q_PROPERTY( bool active READ getActive NOTIFY activeChanged ); diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index 0dae550f57..1393cecbf7 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -42,6 +42,7 @@ target_include_directories( ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder ${CMAKE_CURRENT_LIST_DIR}/controls ${CMAKE_CURRENT_LIST_DIR}/rsyntax + ${CMAKE_CURRENT_LIST_DIR}/ALTNavigation ) diff --git a/QMLComponents/analysisform.cpp b/QMLComponents/analysisform.cpp index cb2bc116a8..0da3d80e38 100644 --- a/QMLComponents/analysisform.cpp +++ b/QMLComponents/analysisform.cpp @@ -456,7 +456,7 @@ void AnalysisForm::addControlError(JASPControl* control, QString message, bool t // Cannot instantiate _controlErrorMessageComponent in the constructor (it crashes), and it might be too late in the formCompletedHandler since error can be generated earlier // So create it when it is needed for the first time. if (!_controlErrorMessageComponent) - _controlErrorMessageComponent = new QQmlComponent(qmlEngine(this), "qrc:///components/JASP/Controls/ControlErrorMessage.qml"); + _controlErrorMessageComponent = new QQmlComponent(qmlEngine(this), "qrc:/jasp-stats.org/imports/JASP/Controls/components/JASP/Controls/ControlErrorMessage.qml"); controlErrorMessageItem = qobject_cast(_controlErrorMessageComponent->create(QQmlEngine::contextForObject(this))); if (!controlErrorMessageItem) diff --git a/Desktop/components/JASP/Widgets/ALTNavTag.qml b/QMLComponents/components/JASP/Controls/ALTNavTag.qml similarity index 97% rename from Desktop/components/JASP/Widgets/ALTNavTag.qml rename to QMLComponents/components/JASP/Controls/ALTNavTag.qml index 0b49a37cbc..53168b1ebd 100644 --- a/Desktop/components/JASP/Widgets/ALTNavTag.qml +++ b/QMLComponents/components/JASP/Controls/ALTNavTag.qml @@ -1,6 +1,7 @@ import QtQuick import QtQuick.Controls import JASP +import JASP.Controls //Tag shown when alt navigation mode is enabled. ALTNavTagBase diff --git a/QMLComponents/utilities/qmlutils.cpp b/QMLComponents/utilities/qmlutils.cpp index 794935b809..e744584013 100644 --- a/QMLComponents/utilities/qmlutils.cpp +++ b/QMLComponents/utilities/qmlutils.cpp @@ -6,6 +6,8 @@ #include "log.h" #include "columnencoder.h" #include "models/term.h" +#include "jaspcontrol.h" +#include "altnavpostfixassignmentstrategy.h" #ifdef linux #include @@ -196,4 +198,7 @@ void QmlUtils::setGlobalPropertiesInQMLContext(QQmlContext * ctxt) ctxt->setContextProperty("LINUX", isLinux); ctxt->setContextProperty("WINDOWS", isWindows); ctxt->setContextProperty("INTERACTION_SEPARATOR", Term::separator); + + qmlRegisterUncreatableType( "JASP", 1, 0, "JASP", "Impossible to create JASP Object"); + qmlRegisterUncreatableType("JASP", 1, 0, "AssignmentStrategy", "Can't make it" ); } From f7c488d128bfa0b38382ed8119e36ea3d0a63dd8 Mon Sep 17 00:00:00 2001 From: boutinb Date: Tue, 14 Jan 2025 21:30:54 +0100 Subject: [PATCH 07/14] Use CommanData in QML Components --- CommonData/filter.cpp | 11 --- CommonData/filter.h | 21 +++-- Desktop/mainwindow.cpp | 32 -------- QMLComponents/CMakeLists.txt | 5 +- .../models/listmodelfiltereddataentry.cpp | 82 +++++++------------ .../models/listmodelfiltereddataentry.h | 12 +-- .../utilities/desktopcommunicator.cpp | 53 ------------ QMLComponents/utilities/desktopcommunicator.h | 23 ------ QMLComponents/variableinfo.cpp | 14 ++++ QMLComponents/variableinfo.h | 1 + 10 files changed, 58 insertions(+), 196 deletions(-) diff --git a/CommonData/filter.cpp b/CommonData/filter.cpp index 2f447a10c9..439fe4cbbc 100644 --- a/CommonData/filter.cpp +++ b/CommonData/filter.cpp @@ -3,8 +3,6 @@ #include "dataset.h" #include "databaseinterface.h" -std::map _filterMap; - Filter::Filter(DataSet * data) : DataSetBaseNode(dataSetBaseNodeType::filter, data), _data(data) { } @@ -17,8 +15,6 @@ Filter::Filter(DataSet * data, const std::string & name, bool createIfMissing) if(db().filterGetId(_name) > -1) dbLoad(); else if(createIfMissing) dbCreate(); else throw std::runtime_error("Filter by name '" + _name + "' but it doesnt exist and createIfMissing=false!\nAre you sure this filter should exist?"); - - _filterMap[name] = this; } void Filter::dbCreate() @@ -140,8 +136,6 @@ void Filter::dbDelete() db().filterDelete(_id); _id = -1; - - _filterMap.erase(_name); } void Filter::incRevision() @@ -181,11 +175,6 @@ bool Filter::filterNameIsFree(const std::string &filterName) return -1 == DatabaseInterface::singleton()->filterGetId(filterName); } -Filter* Filter::getFilterFromName(const std::string & filterName) -{ - return _filterMap[filterName]; -} - void Filter::reset() { if(!_data->writeBatchedToDB()) diff --git a/CommonData/filter.h b/CommonData/filter.h index ce11a194db..3ea7225634 100644 --- a/CommonData/filter.h +++ b/CommonData/filter.h @@ -24,16 +24,16 @@ class Filter : public DataSetBaseNode Filter(DataSet * data); Filter(DataSet * data, const std::string & name, bool createIfMissing = true); - DataSet * data() const { return _data; } - int id() const { return _id; } - const std::string & name() const { return _name; } - const std::string & rFilter() const { return _rFilter; } - const std::string & generatedFilter() const { return _generatedFilter; } - const std::string & constructorJson() const { return _constructorJson; } - const std::string & constructorR() const { return _constructorR; } - const std::string & errorMsg() const { return _errorMsg; } - const std::vector & filtered() const { return _filtered; } - int filteredRowCount() const { return _filteredRowCount; } + DataSet * data() const { return _data; } + int id() const { return _id; } + const std::string & name() const { return _name; } + const std::string & rFilter() const { return _rFilter; } + const std::string & generatedFilter() const { return _generatedFilter; } + const std::string & constructorJson() const { return _constructorJson; } + const std::string & constructorR() const { return _constructorR; } + const std::string & errorMsg() const { return _errorMsg; } + const std::vector & filtered() const { return _filtered; } + int filteredRowCount() const { return _filteredRowCount; } void setRFilter( const std::string & rFilter) { _rFilter = rFilter; dbUpdate(); } void setGeneratedFilter( const std::string & generatedFilter) { _generatedFilter = generatedFilter; dbUpdate(); } @@ -56,7 +56,6 @@ class Filter : public DataSetBaseNode bool checkForUpdates(); static bool filterNameIsFree(const std::string & filterName); - static Filter* getFilterFromName(const std::string & filterName); void reset(); diff --git a/Desktop/mainwindow.cpp b/Desktop/mainwindow.cpp index 6426ce2a25..ef5e06e808 100644 --- a/Desktop/mainwindow.cpp +++ b/Desktop/mainwindow.cpp @@ -77,7 +77,6 @@ MainWindow * MainWindow::_singleton = nullptr; MainWindow::MainWindow(QApplication * application) : QObject(application), _application(application) { std::cout << "MainWindow constructor started" << std::endl; - connect(this, &MainWindow::exitSignal, this, &QApplication::exit, Qt::QueuedConnection); assert(!_singleton); @@ -491,37 +490,6 @@ void MainWindow::makeConnections() Column::setAutoSortByValuesByDefault(PreferencesModel::prefs()->orderByValueByDefault()); auto * dCSingleton = DesktopCommunicator::singleton(); - // For Audit analyses, the Filter object is needed. As the QML objects should not have direct access to the data objects, the needed functions are set as callbacks. - dCSingleton->setFilterFunctions( - [](const std::string& name) { - new Filter(DataSetPackage::pkg()->dataSet(), name, true); - }, - [](const std::string& name) { - Filter* filter = Filter::getFilterFromName(name); - if (filter) - filter->dbDelete(); - }, - [](const std::string& name, const std::string& rFilter) { - Filter* filter = Filter::getFilterFromName(name); - if (filter) - filter->setRFilter(rFilter); - }, - [](const std::string& name) { - Filter* filter = Filter::getFilterFromName(name); - return filter ? filter->checkForUpdates() : false; - }, - [](const std::string& name) { - Filter* filter = Filter::getFilterFromName(name); - return filter ? filter->filtered() : std::vector(); - }, - [](const std::string& name) { - Filter* filter = Filter::getFilterFromName(name); - return filter ? filter->filteredRowCount() : 0; - }, - [](const std::string& name) { - return Filter::filterNameIsFree(name); - } - ); //Needed to allow for a hard split between Desktop/QMLComps: connect(_preferences, &PreferencesModel::uiScaleChanged, dCSingleton, &DesktopCommunicator::uiScaleChanged ); diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index 1393cecbf7..0c47ea4185 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -8,10 +8,9 @@ file(GLOB_RECURSE QML_FILES RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "components/JAS qt_add_qml_module(QMLComponents URI JASP.Controls - #STATIC OUTPUT_DIRECTORY "JASP/Controls" RESOURCE_PREFIX /jasp-stats.org/imports - #PLUGIN_TARGET QMLComponents + #PLUGIN_TARGET QMLComponentsPlugin DEPENDENCIES QtQuick #NO_PLUGIN_OPTIONAL NO_GENERATE_PLUGIN_SOURCE @@ -39,6 +38,7 @@ target_include_directories( QMLComponents PUBLIC # JASP ${PROJECT_SOURCE_DIR}/Common + ${PROJECT_SOURCE_DIR}/CommonData ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder ${CMAKE_CURRENT_LIST_DIR}/controls ${CMAKE_CURRENT_LIST_DIR}/rsyntax @@ -50,6 +50,7 @@ target_link_libraries( QMLComponents PUBLIC Common + CommonData Qt::Core Qt::Gui Qt::Widgets diff --git a/QMLComponents/models/listmodelfiltereddataentry.cpp b/QMLComponents/models/listmodelfiltereddataentry.cpp index d7c170f0a2..04fc2e1127 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.cpp +++ b/QMLComponents/models/listmodelfiltereddataentry.cpp @@ -3,8 +3,7 @@ #include "utilities/qutils.h" #include "log.h" #include "controls/jaspcontrol.h" -#include "utilities/desktopcommunicator.h" - +#include "filter.h" ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) : ListModelTableViewBase(parent) @@ -16,19 +15,23 @@ ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) connect(_tableView, SIGNAL(colNameSignal(QString)), this, SLOT(setColName(QString)) ); connect(_tableView, SIGNAL(extraColSignal(QString)), this, SLOT(setExtraCol(QString)) ); + DataSet* dataSet = VariableInfo::info()->dataSet(); static int counter = 0; do { _filterName = "ListModelFilteredDataEntry_" + std::to_string(counter++); } - while(!filterNameIsFree(_filterName)); + while(!Filter::filterNameIsFree(_filterName)); connect(VariableInfo::info(), &VariableInfo::dataSetChanged, this, &ListModelFilteredDataEntry::dataSetChangedHandler); } ListModelFilteredDataEntry::~ListModelFilteredDataEntry() { - filterDelete(); + if(_filter) + _filter->dbDelete(); + delete _filter; + _filter = nullptr; } void ListModelFilteredDataEntry::dataSetChangedHandler() @@ -49,14 +52,18 @@ void ListModelFilteredDataEntry::setFilter(QString filter) _tableTerms.filter = filter; emit filterChanged(_tableTerms.filter); - filterSetRScript("filterResult <- {" + filter.toStdString() + "};" "\n" + if(_filter) + _filter->setRFilter("filterResult <- {" + filter.toStdString() + "};" "\n" "if(!is.logical(filterResult)) filterResult <- rep(TRUE, rowcount);" "\n" " return(filterResult);" "\n"); } void ListModelFilteredDataEntry::runFilter() { - runFilterByName(tq(_filterName)); + if(!_filter) //prob still need to bind + return; + + runFilterByName(tq(_filter->name())); } void ListModelFilteredDataEntry::filterDoneHandler(const QString &name, const QString & error) @@ -66,16 +73,16 @@ void ListModelFilteredDataEntry::filterDoneHandler(const QString &name, const QS Log::log() << "ListModelFilteredDataEntry::filterDoneHandler for " << name << " and error '" << error << "'" << std::endl; - filterCheckForUpdate(); + _filter->checkForUpdates(); - setAcceptedRows(filtered()); + setAcceptedRows(_filter->filtered()); if(!error.isEmpty()) _tableView->addControlWarning(tr("Filter had error '%1'").arg(error)); else _tableView->clearControlError(); - if(filteredRowCount() == 0) + if(_filter->filteredRowCount() == 0) runFilter(); else informDataSetOfInitialValues(); @@ -167,12 +174,16 @@ void ListModelFilteredDataEntry::initTableTerms(const TableTerms& terms) Log::log() << "Too many values in ListModelFilteredDataEntry" << std::endl; if(terms.filterName.isEmpty()) + { //We dont apparently have a previous filterName, so this is a fresh one, we need a new filter! - assert(!_filterName.empty()); - else if(_filterName.empty()) + assert(!_filter && !_filterName.empty()); + _filter = new Filter(VariableInfo::info()->dataSet(), _filterName, true); + } + else if(!_filter) + { _filterName = fq(terms.filterName); - - filterBuild(); + _filter = new Filter(VariableInfo::info()->dataSet(), _filterName, true); + } if (terms.colName.isEmpty()) { @@ -187,7 +198,7 @@ void ListModelFilteredDataEntry::initTableTerms(const TableTerms& terms) setColName( _tableTerms.colName ); setExtraCol(_tableTerms.extraCol); - _acceptedRows = filtered(); + _acceptedRows = _filter->filtered(); _dataColumns = _tableTerms.colNames; @@ -212,9 +223,10 @@ void ListModelFilteredDataEntry::fillTable() _tableTerms.rowNames.clear(); _tableTerms.values.clear(); - filterCheckForUpdate(); + if (_filter) + _filter->checkForUpdates(); - size_t dataRows = filtered().size() > 0 ? filtered().size() : getDataSetRowCount(); + size_t dataRows = _filter && _filter->filtered().size() > 0 ? _filter->filtered().size() : getDataSetRowCount(); if (_acceptedRows.size() != dataRows) _acceptedRows = std::vector(dataRows, true); @@ -427,41 +439,3 @@ void ListModelFilteredDataEntry::refreshModel() ListModel::refresh(); } -bool ListModelFilteredDataEntry::filterNameIsFree(const std::string& name) -{ - return DesktopCommunicator::singleton()->filterNameIsFree(name); -} - -void ListModelFilteredDataEntry::filterBuild() -{ - if (!_filterName.empty()) - DesktopCommunicator::singleton()->filterBuild(_filterName); -} - -void ListModelFilteredDataEntry::filterDelete() -{ - if (!_filterName.empty()) - DesktopCommunicator::singleton()->filterDelete(_filterName); -} - -void ListModelFilteredDataEntry::filterSetRScript(const std::string& script) -{ - if (!_filterName.empty()) - DesktopCommunicator::singleton()->filterSetRScript(_filterName, script); -} - -bool ListModelFilteredDataEntry::filterCheckForUpdate() -{ - return !_filterName.empty() ? DesktopCommunicator::singleton()->filterCheckForUpdate(_filterName) : false; -} - -std::vector ListModelFilteredDataEntry::filtered() -{ - return !_filterName.empty() ? DesktopCommunicator::singleton()->filtered(_filterName) : std::vector(); -} - -int ListModelFilteredDataEntry::filteredRowCount() -{ - return !_filterName.empty() ? DesktopCommunicator::singleton()->filteredRowCount(_filterName) : 0; -} - diff --git a/QMLComponents/models/listmodelfiltereddataentry.h b/QMLComponents/models/listmodelfiltereddataentry.h index 71ca457a62..663bbeb349 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.h +++ b/QMLComponents/models/listmodelfiltereddataentry.h @@ -22,6 +22,7 @@ #include "listmodeltableviewbase.h" +class Filter; class ListModelFilteredDataEntry : public ListModelTableViewBase { Q_OBJECT @@ -74,16 +75,6 @@ private slots: size_t getDataSetRowCount() const; void fillTable(); - bool filterNameIsFree(const std::string& name); - void filterBuild(); - void filterDelete(); - void filterSetRScript(const std::string& script); - bool filterCheckForUpdate(); - std::vector filtered(); - int filteredRowCount(); - - - private: boolvec _acceptedRows; @@ -94,6 +85,7 @@ private slots: QStringList _dataColumns, _extraColsStr; std::string _filterName; + Filter * _filter = nullptr; bool _informOnce = false; }; diff --git a/QMLComponents/utilities/desktopcommunicator.cpp b/QMLComponents/utilities/desktopcommunicator.cpp index 8dfc3188a7..cc3536d6da 100644 --- a/QMLComponents/utilities/desktopcommunicator.cpp +++ b/QMLComponents/utilities/desktopcommunicator.cpp @@ -16,59 +16,6 @@ DesktopCommunicator *DesktopCommunicator::singleton() return _singleton; } -void DesktopCommunicator::setFilterFunctions( - std::function _builderFunc, - std::function _deleteFunc, - std::function _setRFilterFunc, - std::function _checkForUpdateFunc, - std::function(const std::string&)> _filteredFunc, - std::function _filteredRowCountFunc, - std::function _filterExistFunc) -{ - _filterBuilderFunc = _builderFunc; - _filterDeleteFunc = _deleteFunc; - _filterSetRFilterFunc = _setRFilterFunc; - _filterCheckForUpdateFunc = _checkForUpdateFunc; - _filterFilteredFunc = _filteredFunc; - _filterFilteredRowCountFunc = _filteredRowCountFunc; - _filterNameExistFunc = _filterExistFunc; -} - -void DesktopCommunicator::filterBuild(const std::string &name) -{ - _filterBuilderFunc(name); -} - -void DesktopCommunicator::filterDelete(const std::string& name) -{ - _filterDeleteFunc(name); -} - -void DesktopCommunicator::filterSetRScript(const std::string& name, const std::string& rFilter) -{ - _filterSetRFilterFunc(name, rFilter); -} - -bool DesktopCommunicator::filterCheckForUpdate(const std::string& name) -{ - return _filterCheckForUpdateFunc(name); -} - -std::vector DesktopCommunicator::filtered(const std::string& name) -{ - return _filterFilteredFunc(name); -} - -int DesktopCommunicator::filteredRowCount(const std::string& name) -{ - return _filterFilteredRowCountFunc(name); -} - -bool DesktopCommunicator::filterNameIsFree(const std::string &name) -{ - return _filterNameExistFunc(name); -} - bool DesktopCommunicator::useNativeFileDialog() { #ifdef BUILDING_JASP diff --git a/QMLComponents/utilities/desktopcommunicator.h b/QMLComponents/utilities/desktopcommunicator.h index 0b79f7d36d..3e8873bd6b 100644 --- a/QMLComponents/utilities/desktopcommunicator.h +++ b/QMLComponents/utilities/desktopcommunicator.h @@ -14,21 +14,6 @@ class DesktopCommunicator : public QObject static DesktopCommunicator * singleton(); bool useNativeFileDialog(); - void setFilterFunctions( - std::function _builderFunc, - std::function _deleteFunc, - std::function _setRFilterFunc, - std::function _checkForUpdateFunc, - std::function(const std::string&)> _filteredFunc, - std::function _filteredRowCountFunc, - std::function _filterExistFunc); - void filterBuild(const std::string& name); - void filterDelete(const std::string& name); - void filterSetRScript(const std::string& name, const std::string& rFilter); - bool filterCheckForUpdate(const std::string& name); - std::vector filtered(const std::string& name); - int filteredRowCount(const std::string& name); - bool filterNameIsFree(const std::string& name); signals: void currentJaspThemeChanged(); @@ -38,14 +23,6 @@ class DesktopCommunicator : public QObject private: static DesktopCommunicator * _singleton; - - std::function _filterBuilderFunc; - std::function _filterDeleteFunc; - std::function _filterSetRFilterFunc; - std::function _filterCheckForUpdateFunc; - std::function(const std::string&)> _filterFilteredFunc; - std::function _filterFilteredRowCountFunc; - std::function _filterNameExistFunc; }; #endif // DESKTOPCOMMUNICATOR_H diff --git a/QMLComponents/variableinfo.cpp b/QMLComponents/variableinfo.cpp index 331f000246..ac30e55936 100644 --- a/QMLComponents/variableinfo.cpp +++ b/QMLComponents/variableinfo.cpp @@ -2,6 +2,8 @@ #include "jasptheme.h" #include "QQmlContext" #include "QTimer" +#include "databaseinterface.h" +#include "dataset.h" VariableInfo* VariableInfo::_singleton = nullptr; @@ -65,3 +67,15 @@ bool VariableInfo::dataAvailable() { return _provider ? _provider->provideInfo(VariableInfo::DataAvailable).toBool() : false; } + +DataSet *VariableInfo::dataSet() +{ + static DataSet* singleDataSet = nullptr; + + if (!singleDataSet) + { + DatabaseInterface* db = new DatabaseInterface(false); + singleDataSet = new DataSet(db->dataSetGetId()); + } + return singleDataSet; +} diff --git a/QMLComponents/variableinfo.h b/QMLComponents/variableinfo.h index 2158c6880b..166da51068 100644 --- a/QMLComponents/variableinfo.h +++ b/QMLComponents/variableinfo.h @@ -55,6 +55,7 @@ class VariableInfo : public QObject int rowCount(); bool dataAvailable(); + DataSet * dataSet(); signals: void namesChanged( QMap changedNames); From 6b458a9d6755c8c5cfcd54cd3e99691c2ec6cd1d Mon Sep 17 00:00:00 2001 From: boutinb Date: Tue, 14 Jan 2025 22:06:28 +0100 Subject: [PATCH 08/14] Final touch --- CommonData/dataset.cpp | 6 ++++++ CommonData/dataset.h | 1 + CommonData/filter.cpp | 5 ----- CommonData/filter.h | 5 +---- QMLComponents/ALTNavigation/altnavscope.cpp | 2 -- QMLComponents/models/listmodelfiltereddataentry.cpp | 3 ++- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/CommonData/dataset.cpp b/CommonData/dataset.cpp index 2600b129c8..67a281d273 100644 --- a/CommonData/dataset.cpp +++ b/CommonData/dataset.cpp @@ -619,3 +619,9 @@ bool DataSet::initColumnWithStrings(int colIndex, const std::string & newName, c return anyChanges || column->type() != prevType; } +bool DataSet::isFilterNameFree(const std::string& filterName) +{ + return -1 == db().filterGetId(filterName); +} + + diff --git a/CommonData/dataset.h b/CommonData/dataset.h index 1c5165a18c..704fa7cf44 100644 --- a/CommonData/dataset.h +++ b/CommonData/dataset.h @@ -83,6 +83,7 @@ class DataSet : public DataSetBaseNode void setWorkspaceEmptyValues( const stringset& values); const std::string & description() const { return _description; } void setDescription( const std::string& desc); + bool isFilterNameFree( const std::string& filterName); private: void upgradeTo019(const Json::Value & emptyVals); diff --git a/CommonData/filter.cpp b/CommonData/filter.cpp index 439fe4cbbc..4931838036 100644 --- a/CommonData/filter.cpp +++ b/CommonData/filter.cpp @@ -170,11 +170,6 @@ bool Filter::checkForUpdates() return false; } -bool Filter::filterNameIsFree(const std::string &filterName) -{ - return -1 == DatabaseInterface::singleton()->filterGetId(filterName); -} - void Filter::reset() { if(!_data->writeBatchedToDB()) diff --git a/CommonData/filter.h b/CommonData/filter.h index 3ea7225634..1b47fde1c9 100644 --- a/CommonData/filter.h +++ b/CommonData/filter.h @@ -53,10 +53,7 @@ class Filter : public DataSetBaseNode bool dbLoadResultAndError(); ///< Loads (updated) filtervalues from database and the (possible) error msg, returns true if an error is set void dbDelete(); void incRevision() override; - bool checkForUpdates(); - - static bool filterNameIsFree(const std::string & filterName); - + bool checkForUpdates(); void reset(); DatabaseInterface & db(); diff --git a/QMLComponents/ALTNavigation/altnavscope.cpp b/QMLComponents/ALTNavigation/altnavscope.cpp index 8a571d03a7..526cf002c5 100644 --- a/QMLComponents/ALTNavigation/altnavscope.cpp +++ b/QMLComponents/ALTNavigation/altnavscope.cpp @@ -4,8 +4,6 @@ #include #include -#include -#include "log.h" ALTNavScope::ALTNavScope(QObject* attachee) : QObject{attachee} diff --git a/QMLComponents/models/listmodelfiltereddataentry.cpp b/QMLComponents/models/listmodelfiltereddataentry.cpp index 04fc2e1127..a293702f3b 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.cpp +++ b/QMLComponents/models/listmodelfiltereddataentry.cpp @@ -4,6 +4,7 @@ #include "log.h" #include "controls/jaspcontrol.h" #include "filter.h" +#include "dataset.h" ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) : ListModelTableViewBase(parent) @@ -21,7 +22,7 @@ ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) { _filterName = "ListModelFilteredDataEntry_" + std::to_string(counter++); } - while(!Filter::filterNameIsFree(_filterName)); + while(!dataSet->isFilterNameFree(_filterName)); connect(VariableInfo::info(), &VariableInfo::dataSetChanged, this, &ListModelFilteredDataEntry::dataSetChangedHandler); } From 27ea1801450f77be4456df32fba19d37efc6f34f Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Wed, 15 Jan 2025 12:27:56 +0100 Subject: [PATCH 09/14] use DataSetPointer again, jusat make sure DatabaseInterface is loaded --- CommonData/CMakeLists.txt | 6 ++++-- Desktop/CMakeLists.txt | 1 - Desktop/data/columnsmodel.cpp | 1 + QMLComponents/CMakeLists.txt | 1 - QMLComponents/analysisform.cpp | 4 ++-- QMLComponents/variableinfo.cpp | 12 ++++-------- QMLComponents/variableinfo.h | 2 +- 7 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CommonData/CMakeLists.txt b/CommonData/CMakeLists.txt index 7cfbc97e9a..572132afa8 100644 --- a/CommonData/CMakeLists.txt +++ b/CommonData/CMakeLists.txt @@ -40,9 +40,11 @@ target_link_libraries( PUBLIC Common LibArchive::LibArchive + $<$:Qt::Core> + + PRIVATE SQLite::SQLite3 - # - $<$:Qt::Core>) +) target_compile_definitions( CommonData PUBLIC $<$:JASP_USES_QT_HERE> diff --git a/Desktop/CMakeLists.txt b/Desktop/CMakeLists.txt index f1cd6bcdb8..25d2c1c297 100644 --- a/Desktop/CMakeLists.txt +++ b/Desktop/CMakeLists.txt @@ -111,7 +111,6 @@ target_include_directories( target_link_libraries( JASP PUBLIC - Common CommonData QMLComponents Qt::Core diff --git a/Desktop/data/columnsmodel.cpp b/Desktop/data/columnsmodel.cpp index eb762d5ef1..140df53c3d 100644 --- a/Desktop/data/columnsmodel.cpp +++ b/Desktop/data/columnsmodel.cpp @@ -168,6 +168,7 @@ QVariant ColumnsModel::provideInfo(VariableInfo::InfoType info, const QString& c case VariableInfo::PreviewScale: return QTransposeProxyModel::headerData(colIndex, Qt::Vertical, int(DataSetPackage::specialRoles::previewScale)); case VariableInfo::PreviewOrdinal: return QTransposeProxyModel::headerData(colIndex, Qt::Vertical, int(DataSetPackage::specialRoles::previewOrdinal)); case VariableInfo::PreviewNominal: return QTransposeProxyModel::headerData(colIndex, Qt::Vertical, int(DataSetPackage::specialRoles::previewNominal)); + case VariableInfo::DataSetPointer: return QVariant::fromValue(DataSetPackage::pkg()->dataSet()); } } catch(std::exception & e) diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index 0c47ea4185..185e8833db 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -49,7 +49,6 @@ target_include_directories( target_link_libraries( QMLComponents PUBLIC - Common CommonData Qt::Core Qt::Gui diff --git a/QMLComponents/analysisform.cpp b/QMLComponents/analysisform.cpp index 0da3d80e38..2dcaaa6a32 100644 --- a/QMLComponents/analysisform.cpp +++ b/QMLComponents/analysisform.cpp @@ -205,8 +205,8 @@ void AnalysisForm::addColumnControl(JASPControl* control, bool isComputed) { if (isComputed) { - connect(control, &JASPControl::requestComputedColumnCreation, _analysis, &AnalysisBase::requestComputedColumnCreationHandler); - connect(control, &JASPControl::requestComputedColumnDestruction, _analysis, &AnalysisBase::requestComputedColumnDestructionHandler); + connect(control, &JASPControl::requestComputedColumnCreation, _analysis, &AnalysisBase::requestComputedColumnCreationHandler, Qt::QueuedConnection); + connect(control, &JASPControl::requestComputedColumnDestruction, _analysis, &AnalysisBase::requestComputedColumnDestructionHandler, Qt::QueuedConnection); } else connect(control, &JASPControl::requestColumnCreation, _analysis, &AnalysisBase::requestColumnCreationHandler); diff --git a/QMLComponents/variableinfo.cpp b/QMLComponents/variableinfo.cpp index ac30e55936..1a9715a5eb 100644 --- a/QMLComponents/variableinfo.cpp +++ b/QMLComponents/variableinfo.cpp @@ -70,12 +70,8 @@ bool VariableInfo::dataAvailable() DataSet *VariableInfo::dataSet() { - static DataSet* singleDataSet = nullptr; - - if (!singleDataSet) - { - DatabaseInterface* db = new DatabaseInterface(false); - singleDataSet = new DataSet(db->dataSetGetId()); - } - return singleDataSet; + if(!DatabaseInterface::singleton()) + new DatabaseInterface(false); + + return _provider ? reinterpret_cast(_provider->provideInfo(VariableInfo::DataSetPointer).value()) : nullptr; } diff --git a/QMLComponents/variableinfo.h b/QMLComponents/variableinfo.h index 166da51068..e2e33640cb 100644 --- a/QMLComponents/variableinfo.h +++ b/QMLComponents/variableinfo.h @@ -38,7 +38,7 @@ class VariableInfo : public QObject { Q_OBJECT public: - enum InfoType { VariableType, VariableNames, DataSetRowCount, Labels, DoubleValues, NameRole, DataSetValue, DataSetValues, MaxWidth, SignalsBlocked, DataAvailable, TotalNumericValues, TotalLevels, PreviewScale, PreviewOrdinal, PreviewNominal }; + enum InfoType { VariableType, VariableNames, DataSetRowCount, Labels, DoubleValues, NameRole, DataSetValue, DataSetValues, MaxWidth, SignalsBlocked, DataAvailable, TotalNumericValues, TotalLevels, PreviewScale, PreviewOrdinal, PreviewNominal, DataSetPointer }; enum IconType { DefaultIconType, DisabledIconType, InactiveIconType, TransformedIconType }; public: From 73d75df9ca38a7a1e37235ac109332b83fb3ef9e Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Wed, 15 Jan 2025 12:33:08 +0100 Subject: [PATCH 10/14] _singleton should be accessed from cpp to make sure it is in the right context --- CommonData/databaseinterface.cpp | 5 +++++ CommonData/databaseinterface.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CommonData/databaseinterface.cpp b/CommonData/databaseinterface.cpp index 3cb6174560..9bdaf19e06 100644 --- a/CommonData/databaseinterface.cpp +++ b/CommonData/databaseinterface.cpp @@ -1367,6 +1367,11 @@ std::string DatabaseInterface::dbFile(bool onlyName) const return onlyName ? fileName : Utils::osPath(TempFiles::sessionDirName() + "/" + fileName).string(); } +DatabaseInterface *DatabaseInterface::singleton() +{ + return _singleton; +} + void DatabaseInterface::runQuery(const std::string & query, std::function bindParameters, std::function processRow) { JASPTIMER_SCOPE(DatabaseInterface::runQuery); diff --git a/CommonData/databaseinterface.h b/CommonData/databaseinterface.h index 26d366f93e..e0e090873f 100644 --- a/CommonData/databaseinterface.h +++ b/CommonData/databaseinterface.h @@ -60,7 +60,7 @@ class DatabaseInterface ~DatabaseInterface(); std::string dbFile(bool onlyPostfix = false) const; ///< Convenience function for getting the filename where sqlite db should be - static DatabaseInterface * singleton() { return _singleton; } ///< There can be only one! https://www.youtube.com/watch?v=sqcLjcSloXs + static DatabaseInterface * singleton(); ///< There can be only one! https://www.youtube.com/watch?v=sqcLjcSloXs bool hasConnection() { return _db; } void upgradeDBFromVersion(Version originalVersion); ///< Ensures that the database has all the fields configured as required for the current JASP version, useful when loading older sqlite-containing jasp-files From 631bbb568dd28540cfdab31d0f25bb3bc37cdb58 Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Wed, 15 Jan 2025 12:36:54 +0100 Subject: [PATCH 11/14] undo ColumnUtils::doubleToString* -> Utils:: --- Common/jaspColumnEncoder | 2 +- CommonData/column.cpp | 8 ++++---- CommonData/columnutils.cpp | 20 +++++++++++++++++++ CommonData/columnutils.h | 3 +++ Desktop/data/importers/jaspimporterold.cpp | 2 +- .../readstat/readstatimportcolumn.cpp | 6 +++--- .../models/listmodelfiltereddataentry.cpp | 3 ++- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Common/jaspColumnEncoder b/Common/jaspColumnEncoder index 1dfc2421ff..094a53c3d8 160000 --- a/Common/jaspColumnEncoder +++ b/Common/jaspColumnEncoder @@ -1 +1 @@ -Subproject commit 1dfc2421ff45ac9a52ffa888a3fac4e15ff630c7 +Subproject commit 094a53c3d8b3375bcb486ec2ded5843e15933291 diff --git a/CommonData/column.cpp b/CommonData/column.cpp index c67b7fe514..6f228ed281 100644 --- a/CommonData/column.cpp +++ b/CommonData/column.cpp @@ -983,7 +983,7 @@ stringvec Column::nonFilteredLevels() levels.insert(label->label()); } else if(!isEmptyValue(_dbls[r])) - levels.insert(Utils::doubleToString(_dbls[r])); + levels.insert(ColumnUtils::doubleToString(_dbls[r])); } // Use the right label order @@ -1164,7 +1164,7 @@ std::string Column::doubleToDisplayString(double dbl, bool fancyEmptyValue, bool ignoreEmptyValue = ignoreEmptyValue && !std::isnan(dbl); if (isEmptyValue(dbl) && !ignoreEmptyValue) return fancyEmptyValue ? EmptyValues::displayString() : ""; - else return Utils::doubleToString(dbl); + else return ColumnUtils::doubleToString(dbl); } std::string Column::operator[](size_t row) @@ -1416,7 +1416,7 @@ bool Column::replaceDoubleLabelFromRowWithDouble(size_t row, double dbl) dblsRef = dbl; _labelsTempDbls[row] = dbl; - _labelsTemp[row] = Utils::doubleToString(dbl); + _labelsTemp[row] = ColumnUtils::doubleToString(dbl); return true; } @@ -1580,7 +1580,7 @@ bool Column::setValue(size_t row, const std::string & value, const std::string & if(justAValue && !newLabel && itsADouble) { - const std::string valueDbl = Utils::doubleToString(newDoubleToSet); + const std::string valueDbl = ColumnUtils::doubleToString(newDoubleToSet); newLabel = labelByValue(valueDbl); newLabel = newLabel ? newLabel : labelByValueAndDisplay(valueDbl, valueDbl); } diff --git a/CommonData/columnutils.cpp b/CommonData/columnutils.cpp index 55e1b8a9d0..b923589868 100644 --- a/CommonData/columnutils.cpp +++ b/CommonData/columnutils.cpp @@ -210,6 +210,26 @@ std::string ColumnUtils::deEuropeaniseForImport(std::string value) return value; } +std::string ColumnUtils::doubleToStringMaxPrec(double dbl) +{ + constexpr auto max_precision{std::numeric_limits::digits10 + 1}; + return doubleToString(dbl, max_precision); +} + +std::string ColumnUtils::doubleToString(double dbl, int precision) +{ + JASPTIMER_SCOPE(ColumnUtils::doubleToString); + + if (dbl > std::numeric_limits::max()) return "∞"; + if (dbl < std::numeric_limits::lowest()) return "-∞"; + + std::stringstream conv; //Use this instead of std::to_string to make sure there are no trailing zeroes (and to get full precision) + conv << std::setprecision(precision); + conv << dbl; + return conv.str(); +} + + // hex should be 4 hexadecimals characters std::string ColumnUtils::_convertEscapedUnicodeToUTF8(std::string hex) { diff --git a/CommonData/columnutils.h b/CommonData/columnutils.h index 6bd80deece..761ac304a2 100644 --- a/CommonData/columnutils.h +++ b/CommonData/columnutils.h @@ -22,6 +22,9 @@ class ColumnUtils static void convertEscapedUnicodeToUTF8( std::string & inputStr); static std::string deEuropeaniseForImport( std::string value); //Convert a string to a double with a dot for a separator + + static std::string doubleToString( double dbl, int precision = 10); + static std::string doubleToStringMaxPrec( double dbl); static bool convertVecToInt( const stringvec & values, intvec & intValues, intset & uniqueValues); static bool convertVecToDouble( const stringvec & values, doublevec & doubleValues); diff --git a/Desktop/data/importers/jaspimporterold.cpp b/Desktop/data/importers/jaspimporterold.cpp index 802394cfb0..2e7f427865 100644 --- a/Desktop/data/importers/jaspimporterold.cpp +++ b/Desktop/data/importers/jaspimporterold.cpp @@ -200,7 +200,7 @@ void JASPImporterOld::loadDataArchive_1_00(const std::string &path, std::functio if (isScalar) { - values.push_back(Utils::doubleToString(*reinterpret_cast(buff))); + values.push_back(ColumnUtils::doubleToString(*reinterpret_cast(buff))); labels.push_back(values.back()); } else diff --git a/Desktop/data/importers/readstat/readstatimportcolumn.cpp b/Desktop/data/importers/readstat/readstatimportcolumn.cpp index fc48f7caa5..31a9c2a762 100644 --- a/Desktop/data/importers/readstat/readstatimportcolumn.cpp +++ b/Desktop/data/importers/readstat/readstatimportcolumn.cpp @@ -45,8 +45,8 @@ std::string ReadStatImportColumn::readstatValueToString(const readstat_value_t & case READSTAT_TYPE_INT8: return std::to_string (int( readstat_int8_value(value)) ); case READSTAT_TYPE_INT16: return std::to_string (int( readstat_int16_value(value)) ); case READSTAT_TYPE_INT32: return std::to_string (int( readstat_int32_value(value)) ); - case READSTAT_TYPE_FLOAT: return Utils::doubleToStringMaxPrec ( readstat_float_value(value) ); - case READSTAT_TYPE_DOUBLE: return Utils::doubleToStringMaxPrec ( readstat_double_value(value) ); + case READSTAT_TYPE_FLOAT: return ColumnUtils::doubleToStringMaxPrec ( readstat_float_value(value) ); + case READSTAT_TYPE_DOUBLE: return ColumnUtils::doubleToStringMaxPrec ( readstat_double_value(value) ); case READSTAT_TYPE_STRING_REF: throw std::runtime_error("File contains string references and we do not support this."); } @@ -69,7 +69,7 @@ const stringvec &ReadStatImportColumn::labels() const void ReadStatImportColumn::addValue(const readstat_value_t & value) { bool setMiss = readstat_value_is_tagged_missing(value) || (_readstatVariable && readstat_value_is_defined_missing(value, _readstatVariable)); - std::string valStr = Utils::doubleToString(EmptyValues::missingValueDouble); + std::string valStr = ColumnUtils::doubleToString(EmptyValues::missingValueDouble); if(readstat_value_is_tagged_missing(value)) //This is from sas/stata and actual value is NaN but there is a tag. So we use that as a value, this will be converted to NaN later anyway { diff --git a/QMLComponents/models/listmodelfiltereddataentry.cpp b/QMLComponents/models/listmodelfiltereddataentry.cpp index a293702f3b..900c266469 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.cpp +++ b/QMLComponents/models/listmodelfiltereddataentry.cpp @@ -5,6 +5,7 @@ #include "controls/jaspcontrol.h" #include "filter.h" #include "dataset.h" +#include "columnutils.h" ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) : ListModelTableViewBase(parent) @@ -365,7 +366,7 @@ void ListModelFilteredDataEntry::informDataSetOfInitialValues() QVariantList vals; for(size_t i=0; i<_initialValues.size(); i++) { - vals.append(_acceptedRows[i] ? tq(Utils::doubleToString(_initialValues[i])) : ""); + vals.append(_acceptedRows[i] ? tq(ColumnUtils::doubleToString(_initialValues[i])) : ""); if(_acceptedRows[i]) somethingFilled = true; } From 497bde822eb7c2218a35f698863db6b0134769db Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Wed, 15 Jan 2025 12:48:43 +0100 Subject: [PATCH 12/14] undo some more changes and move init of databaseinterface singleton to inside singleton() (but without creating the actual tablestructure, this remains the prerogative of DataSetPackage) --- CommonData/databaseinterface.cpp | 6 ++++++ CommonData/dataset.cpp | 6 ------ CommonData/dataset.h | 1 - CommonData/filter.cpp | 5 +++++ CommonData/filter.h | 7 +++++-- {Common => CommonData}/jsonutilities.cpp | 0 {Common => CommonData}/jsonutilities.h | 0 QMLComponents/models/listmodelfiltereddataentry.cpp | 3 +-- QMLComponents/variableinfo.cpp | 3 --- 9 files changed, 17 insertions(+), 14 deletions(-) rename {Common => CommonData}/jsonutilities.cpp (100%) rename {Common => CommonData}/jsonutilities.h (100%) diff --git a/CommonData/databaseinterface.cpp b/CommonData/databaseinterface.cpp index 9bdaf19e06..5a29f7bf11 100644 --- a/CommonData/databaseinterface.cpp +++ b/CommonData/databaseinterface.cpp @@ -1369,6 +1369,12 @@ std::string DatabaseInterface::dbFile(bool onlyName) const DatabaseInterface *DatabaseInterface::singleton() { + if(!_singleton) + { + Log::log() << "No DatabaseInterface::singleton available here yet, creating an interface for internal.sqlite without recreating the dbstructure" << std::endl; + _singleton = new DatabaseInterface(false); + } + return _singleton; } diff --git a/CommonData/dataset.cpp b/CommonData/dataset.cpp index 67a281d273..2600b129c8 100644 --- a/CommonData/dataset.cpp +++ b/CommonData/dataset.cpp @@ -619,9 +619,3 @@ bool DataSet::initColumnWithStrings(int colIndex, const std::string & newName, c return anyChanges || column->type() != prevType; } -bool DataSet::isFilterNameFree(const std::string& filterName) -{ - return -1 == db().filterGetId(filterName); -} - - diff --git a/CommonData/dataset.h b/CommonData/dataset.h index 704fa7cf44..1c5165a18c 100644 --- a/CommonData/dataset.h +++ b/CommonData/dataset.h @@ -83,7 +83,6 @@ class DataSet : public DataSetBaseNode void setWorkspaceEmptyValues( const stringset& values); const std::string & description() const { return _description; } void setDescription( const std::string& desc); - bool isFilterNameFree( const std::string& filterName); private: void upgradeTo019(const Json::Value & emptyVals); diff --git a/CommonData/filter.cpp b/CommonData/filter.cpp index 4931838036..439fe4cbbc 100644 --- a/CommonData/filter.cpp +++ b/CommonData/filter.cpp @@ -170,6 +170,11 @@ bool Filter::checkForUpdates() return false; } +bool Filter::filterNameIsFree(const std::string &filterName) +{ + return -1 == DatabaseInterface::singleton()->filterGetId(filterName); +} + void Filter::reset() { if(!_data->writeBatchedToDB()) diff --git a/CommonData/filter.h b/CommonData/filter.h index 1b47fde1c9..62ca15bfd4 100644 --- a/CommonData/filter.h +++ b/CommonData/filter.h @@ -52,8 +52,11 @@ class Filter : public DataSetBaseNode void dbLoad(); bool dbLoadResultAndError(); ///< Loads (updated) filtervalues from database and the (possible) error msg, returns true if an error is set void dbDelete(); - void incRevision() override; - bool checkForUpdates(); + void incRevision() override; + bool checkForUpdates(); + + static bool filterNameIsFree(const std::string & filterName); + void reset(); DatabaseInterface & db(); diff --git a/Common/jsonutilities.cpp b/CommonData/jsonutilities.cpp similarity index 100% rename from Common/jsonutilities.cpp rename to CommonData/jsonutilities.cpp diff --git a/Common/jsonutilities.h b/CommonData/jsonutilities.h similarity index 100% rename from Common/jsonutilities.h rename to CommonData/jsonutilities.h diff --git a/QMLComponents/models/listmodelfiltereddataentry.cpp b/QMLComponents/models/listmodelfiltereddataentry.cpp index 900c266469..12310dfde9 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.cpp +++ b/QMLComponents/models/listmodelfiltereddataentry.cpp @@ -17,13 +17,12 @@ ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) connect(_tableView, SIGNAL(colNameSignal(QString)), this, SLOT(setColName(QString)) ); connect(_tableView, SIGNAL(extraColSignal(QString)), this, SLOT(setExtraCol(QString)) ); - DataSet* dataSet = VariableInfo::info()->dataSet(); static int counter = 0; do { _filterName = "ListModelFilteredDataEntry_" + std::to_string(counter++); } - while(!dataSet->isFilterNameFree(_filterName)); + while(!Filter::filterNameIsFree(_filterName)); connect(VariableInfo::info(), &VariableInfo::dataSetChanged, this, &ListModelFilteredDataEntry::dataSetChangedHandler); } diff --git a/QMLComponents/variableinfo.cpp b/QMLComponents/variableinfo.cpp index 1a9715a5eb..94e5c7b1bb 100644 --- a/QMLComponents/variableinfo.cpp +++ b/QMLComponents/variableinfo.cpp @@ -70,8 +70,5 @@ bool VariableInfo::dataAvailable() DataSet *VariableInfo::dataSet() { - if(!DatabaseInterface::singleton()) - new DatabaseInterface(false); - return _provider ? reinterpret_cast(_provider->provideInfo(VariableInfo::DataSetPointer).value()) : nullptr; } From 2fda389dafdb3a9c1a8dce7245188f72564e5ff2 Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Wed, 15 Jan 2025 12:56:55 +0100 Subject: [PATCH 13/14] small tweaks --- QMLComponents/analysisform.cpp | 4 ++-- QMLComponents/models/listmodelfiltereddataentry.cpp | 11 +++++------ QMLComponents/models/listmodelfiltereddataentry.h | 2 +- QMLComponents/variableinfo.cpp | 2 -- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/QMLComponents/analysisform.cpp b/QMLComponents/analysisform.cpp index 2dcaaa6a32..0da3d80e38 100644 --- a/QMLComponents/analysisform.cpp +++ b/QMLComponents/analysisform.cpp @@ -205,8 +205,8 @@ void AnalysisForm::addColumnControl(JASPControl* control, bool isComputed) { if (isComputed) { - connect(control, &JASPControl::requestComputedColumnCreation, _analysis, &AnalysisBase::requestComputedColumnCreationHandler, Qt::QueuedConnection); - connect(control, &JASPControl::requestComputedColumnDestruction, _analysis, &AnalysisBase::requestComputedColumnDestructionHandler, Qt::QueuedConnection); + connect(control, &JASPControl::requestComputedColumnCreation, _analysis, &AnalysisBase::requestComputedColumnCreationHandler); + connect(control, &JASPControl::requestComputedColumnDestruction, _analysis, &AnalysisBase::requestComputedColumnDestructionHandler); } else connect(control, &JASPControl::requestColumnCreation, _analysis, &AnalysisBase::requestColumnCreationHandler); diff --git a/QMLComponents/models/listmodelfiltereddataentry.cpp b/QMLComponents/models/listmodelfiltereddataentry.cpp index 12310dfde9..6646b9e84b 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.cpp +++ b/QMLComponents/models/listmodelfiltereddataentry.cpp @@ -1,11 +1,11 @@ #include "listmodelfiltereddataentry.h" +#include "columnutils.h" #include "controls/tableviewbase.h" #include "utilities/qutils.h" #include "log.h" #include "controls/jaspcontrol.h" #include "filter.h" -#include "dataset.h" -#include "columnutils.h" + ListModelFilteredDataEntry::ListModelFilteredDataEntry(TableViewBase * parent) : ListModelTableViewBase(parent) @@ -63,13 +63,13 @@ void ListModelFilteredDataEntry::runFilter() { if(!_filter) //prob still need to bind return; - + runFilterByName(tq(_filter->name())); } void ListModelFilteredDataEntry::filterDoneHandler(const QString &name, const QString & error) { - if(name.toStdString() != _filterName) + if(name.toStdString() != _filter->name()) return; Log::log() << "ListModelFilteredDataEntry::filterDoneHandler for " << name << " and error '" << error << "'" << std::endl; @@ -224,7 +224,7 @@ void ListModelFilteredDataEntry::fillTable() _tableTerms.rowNames.clear(); _tableTerms.values.clear(); - if (_filter) + if(_filter) _filter->checkForUpdates(); size_t dataRows = _filter && _filter->filtered().size() > 0 ? _filter->filtered().size() : getDataSetRowCount(); @@ -439,4 +439,3 @@ void ListModelFilteredDataEntry::refreshModel() { ListModel::refresh(); } - diff --git a/QMLComponents/models/listmodelfiltereddataentry.h b/QMLComponents/models/listmodelfiltereddataentry.h index 663bbeb349..f4a1dc00e1 100644 --- a/QMLComponents/models/listmodelfiltereddataentry.h +++ b/QMLComponents/models/listmodelfiltereddataentry.h @@ -85,7 +85,7 @@ private slots: QStringList _dataColumns, _extraColsStr; std::string _filterName; - Filter * _filter = nullptr; + Filter * _filter = nullptr; bool _informOnce = false; }; diff --git a/QMLComponents/variableinfo.cpp b/QMLComponents/variableinfo.cpp index 94e5c7b1bb..c4862e5eac 100644 --- a/QMLComponents/variableinfo.cpp +++ b/QMLComponents/variableinfo.cpp @@ -2,8 +2,6 @@ #include "jasptheme.h" #include "QQmlContext" #include "QTimer" -#include "databaseinterface.h" -#include "dataset.h" VariableInfo* VariableInfo::_singleton = nullptr; From 07df33c75996fc5da43ea5101ec9e4665242080c Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Wed, 15 Jan 2025 16:55:18 +0100 Subject: [PATCH 14/14] try to get it to build on arch linux linux compiles and runs --- CMakeLists.txt | 1 + Common/CMakeLists.txt | 9 ++-- Common/jaspColumnEncoder | 2 +- Common/log.h | 12 ++--- CommonData/CMakeLists.txt | 18 ++++---- CommonData/column.cpp | 19 ++++---- CommonData/column.h | 10 ++-- CommonData/columnutils.h | 3 -- CommonData/databaseinterface.h | 3 +- CommonData/dataset.cpp | 2 +- CommonData/dataset.h | 2 +- CommonData/datasetbasenode.h | 1 + Desktop/CMakeLists.txt | 11 +++-- Desktop/data/columnmodel.cpp | 20 ++++---- Desktop/data/columnmodel.h | 4 +- Desktop/data/datasetpackage.cpp | 2 +- Desktop/data/datasetpackage.h | 2 +- Desktop/data/undostack.cpp | 8 ++-- Desktop/data/undostack.h | 4 +- Engine/CMakeLists.txt | 25 +++++----- Engine/rbridge.cpp | 1 + QMLComponents/ALTNavigation/altnavcontrol.cpp | 2 +- QMLComponents/CMakeLists.txt | 6 ++- QMLComponents/analysisform.cpp | 2 +- R-Interface/CMakeLists.txt | 46 +++++++------------ 25 files changed, 102 insertions(+), 113 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e68789c2b..14b32a8b3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ if (UNIX) add_compile_options(-Werror=return-type) endif() +set(CMAKE_POSITION_INDEPENDENT_CODE ON) if(APPLE) diff --git a/Common/CMakeLists.txt b/Common/CMakeLists.txt index 42afc5c98e..faebb8ddbd 100644 --- a/Common/CMakeLists.txt +++ b/Common/CMakeLists.txt @@ -15,7 +15,7 @@ message(STATUS "appinfo.cpp is successfully generated...") file(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/*.h") file(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") -add_library(Common ${SOURCE_FILES} ${HEADER_FILES}) +add_library(Common SHARED ${SOURCE_FILES} ${HEADER_FILES}) if(LINUX) target_link_libraries(Common PUBLIC ${_LIB_RT}) @@ -34,17 +34,16 @@ target_include_directories( target_link_libraries( Common - PUBLIC + PRIVATE Boost::system Boost::date_time Boost::timer Boost::chrono - $<$:ntdll> - $<$:Qt::Core> + $<$:ntdll> ) target_compile_definitions( - Common PUBLIC $<$:JASP_USES_QT_HERE> + Common PUBLIC $<$:PROFILE_JASP> JSONCPP_NO_LOCALE_SUPPORT ) diff --git a/Common/jaspColumnEncoder b/Common/jaspColumnEncoder index 094a53c3d8..ac8dadb07e 160000 --- a/Common/jaspColumnEncoder +++ b/Common/jaspColumnEncoder @@ -1 +1 @@ -Subproject commit 094a53c3d8b3375bcb486ec2ded5843e15933291 +Subproject commit ac8dadb07ed7300fa19d334625063f519fe702fa diff --git a/Common/log.h b/Common/log.h index 278cb7ae8a..9de28875b5 100644 --- a/Common/log.h +++ b/Common/log.h @@ -44,12 +44,12 @@ class Log static void redirectStdOut(); static const char * getTimestamp(); - static logType _default; - static logType _where; - static std::string _logFilePath; - static logError _logError; - static int _stdoutfd, - _engineNo; + static logType _default; + static logType _where; + static std::string _logFilePath; + static logError _logError; + static int _stdoutfd, + _engineNo; static std::ostream* _nullStream; static std::ofstream _logFile; diff --git a/CommonData/CMakeLists.txt b/CommonData/CMakeLists.txt index 572132afa8..15f8455ca0 100644 --- a/CommonData/CMakeLists.txt +++ b/CommonData/CMakeLists.txt @@ -14,7 +14,7 @@ file(GLOB_RECURSE HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/*.h") file(GLOB_RECURSE SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/*.cpp") file(GLOB_RECURSE SQL_FILES "${CMAKE_CURRENT_LIST_DIR}/*.sql") -add_library(CommonData ${SOURCE_FILES} ${HEADER_FILES} ${SQL_FILES}) +add_library(CommonData SHARED ${SOURCE_FILES} ${HEADER_FILES} ${SQL_FILES}) if(LINUX) @@ -36,18 +36,16 @@ target_include_directories( ) target_link_libraries( - CommonData - PUBLIC - Common - LibArchive::LibArchive - $<$:Qt::Core> - - PRIVATE - SQLite::SQLite3 + CommonData + PUBLIC + LibArchive::LibArchive #desktop needs to be able to access it + PRIVATE + Common + SQLite::SQLite3 ) target_compile_definitions( - CommonData PUBLIC $<$:JASP_USES_QT_HERE> + CommonData PUBLIC $<$:PROFILE_JASP> JSONCPP_NO_LOCALE_SUPPORT ) diff --git a/CommonData/column.cpp b/CommonData/column.cpp index 6f228ed281..b7ce5d22b5 100644 --- a/CommonData/column.cpp +++ b/CommonData/column.cpp @@ -4,6 +4,7 @@ #include "dataset.h" #include "columnutils.h" #include "databaseinterface.h" +#include bool Column::_autoSortByValuesByDefault = true; @@ -435,7 +436,7 @@ stringset Column::mergeOldMissingDataMap(const Json::Value &missingData) stringset foundEmpty; std::map displayToLabel; //Keep track of which labels we added because only those could possibly be derived from missingDataMap - for(qsizetype r=0; r<_ints.size(); r++) + for(size_t r=0; r<_ints.size(); r++) { const std::string row = std::to_string(r); if(missingData.isMember(row)) @@ -940,7 +941,7 @@ int Column::labelsTempCount() _labelsTemp . push_back(doubleLabel); _labelsTempDbls . push_back(dbl); _labelsTempToIndex[doubleLabel] = _labelsTemp.size()-1; - _labelsTempMaxWidth = std::max(_labelsTempMaxWidth, qsizetype(_labelsTemp[_labelsTemp.size()-1].size())); + _labelsTempMaxWidth = std::max(_labelsTempMaxWidth, size_t(_labelsTemp[_labelsTemp.size()-1].size())); _labelsTempNumerics ++; } } @@ -1777,7 +1778,7 @@ bool Column::labelsRemoveOrphans() return idsNotUsed.size(); } -std::set Column::labelsMoveRows(std::vector rows, bool up) +std::set Column::labelsMoveRows(std::vector rows, bool up) { JASPTIMER_SCOPE(Column::labelsMoveRows); @@ -1785,7 +1786,7 @@ std::set Column::labelsMoveRows(std::vector rows, bool up) std::sort(rows.begin(), rows.end(), [&](const auto & l, const auto & r) { return up ? l < r : r < l; }); - replaceDoublesTillLabelsRowWithLabels(std::min(qsizetype(labelsTempCount()), rows.back() + 1)); + replaceDoublesTillLabelsRowWithLabels(std::min(size_t(labelsTempCount()), rows.back() + 1)); std::vector new_labels(_labels.begin(), _labels.end()); @@ -2020,7 +2021,7 @@ void Column::upgradeExtractDoublesIntsFromLabels() { _dbls.resize(_ints.size()); - for(qsizetype r=0; r<_dbls.size(); r++) + for(size_t r=0; r<_dbls.size(); r++) { Label * label = labelByIntsId(_ints[r]); @@ -2318,7 +2319,7 @@ bool Column::isEmptyValue(const double val) const return _emptyValues->isEmptyValue(val); } -qsizetype Column::getMaximumWidthInCharactersIncludingShadow() +size_t Column::getMaximumWidthInCharactersIncludingShadow() { bool thereIsAShadow = false; @@ -2337,9 +2338,9 @@ qsizetype Column::getMaximumWidthInCharactersIncludingShadow() } -qsizetype Column::getMaximumWidthInCharacters(bool fancyEmptyValue, bool valuesPlease, qsizetype extraPad) +size_t Column::getMaximumWidthInCharacters(bool fancyEmptyValue, bool valuesPlease, size_t extraPad) { - qsizetype maxWidth = 0; + size_t maxWidth = 0; std::string takeWidth; //Call labelsTempCount() to both find out how many there are and generate them if necessary @@ -2349,7 +2350,7 @@ qsizetype Column::getMaximumWidthInCharacters(bool fancyEmptyValue, bool valuesP for(Label * label : labels()) { takeWidth = !valuesPlease ? label->label() : label->originalValueAsString(fancyEmptyValue); - maxWidth = std::max(maxWidth, qsizetype(stringUtils::approximateVisualLength(takeWidth))); + maxWidth = std::max(maxWidth, size_t(stringUtils::approximateVisualLength(takeWidth))); } diff --git a/CommonData/column.h b/CommonData/column.h index 8f0cc41ddb..0991921b8b 100644 --- a/CommonData/column.h +++ b/CommonData/column.h @@ -7,7 +7,7 @@ #include "utils.h" #include #include "emptyvalues.h" - +#include class DataSet; class Analysis; @@ -133,7 +133,7 @@ class Column : public DataSetBaseNode stringvec nonFilteredLevels(); void nonFilteredCountersReset(); - std::set labelsMoveRows(std::vector rows, bool up); + std::set labelsMoveRows(std::vector rows, bool up); void labelsReverse(); void valuesReverse(); void labelsOrderByValue(bool doDbUpdateEtc=true); @@ -226,8 +226,8 @@ class Column : public DataSetBaseNode bool isEmptyValue( const std::string & val) const; bool isEmptyValue( const double val) const; - qsizetype getMaximumWidthInCharactersIncludingShadow(); - qsizetype getMaximumWidthInCharacters(bool shortenAndFancyEmptyValue, bool valuesPlease, qsizetype extraPad = 4); ///< Tries to take into consideration that utf-8 can have more characters than codepoints and compensates for it + size_t getMaximumWidthInCharactersIncludingShadow(); + size_t getMaximumWidthInCharacters(bool shortenAndFancyEmptyValue, bool valuesPlease, size_t extraPad = 4); ///< Tries to take into consideration that utf-8 can have more characters than codepoints and compensates for it columnType resetValues(int thresholdScale); ///< "Reimport" the values it already has with a possibly different threshold of values stringset mergeOldMissingDataMap(const Json::Value & missingData); ///< <0.19 JASP collected the removed empty values values in a map in a json object... We need to be able to read at least 0.18.3 so here this function that absorbs such a map and adds any required labels. It does not add the empty values itself though! @@ -258,7 +258,7 @@ class Column : public DataSetBaseNode _labelsTempRevision = -1, ///< When were the "temporary labels" created? _labelsTempNumerics = 0, ///< Use the labelsTemp step to calculate the amount of numeric labels _highestIntsId = -1; - qsizetype _labelsTempMaxWidth = 0; + size_t _labelsTempMaxWidth = 0; stringvec _labelsTemp; ///< Contains displaystring for labels. Used to allow people to edit "double" labels. Initialized when necessary doublevec _labelsTempDbls; strintmap _labelsTempToIndex; diff --git a/CommonData/columnutils.h b/CommonData/columnutils.h index 761ac304a2..b32ae75fe5 100644 --- a/CommonData/columnutils.h +++ b/CommonData/columnutils.h @@ -2,9 +2,6 @@ #define COLUMNUTILS_H #include -#include -#include -#include #include "utils.h" class ColumnUtils diff --git a/CommonData/databaseinterface.h b/CommonData/databaseinterface.h index e0e090873f..c926ff341e 100644 --- a/CommonData/databaseinterface.h +++ b/CommonData/databaseinterface.h @@ -7,7 +7,8 @@ #include "utils.h" #include #include "version.h" - +#include +#include class DataSet; class Column; diff --git a/CommonData/dataset.cpp b/CommonData/dataset.cpp index 2600b129c8..00d28d45b1 100644 --- a/CommonData/dataset.cpp +++ b/CommonData/dataset.cpp @@ -200,7 +200,7 @@ Column * DataSet::newColumn(const std::string &name) return col; } -qsizetype DataSet::getMaximumColumnWidthInCharacters(size_t columnIndex) const +size_t DataSet::getMaximumColumnWidthInCharacters(size_t columnIndex) const { if(columnIndex >= columnCount()) return 0; diff --git a/CommonData/dataset.h b/CommonData/dataset.h index 1c5165a18c..cf43cbb0ef 100644 --- a/CommonData/dataset.h +++ b/CommonData/dataset.h @@ -52,7 +52,7 @@ class DataSet : public DataSetBaseNode bool allColumnsPassFilter() const; - qsizetype getMaximumColumnWidthInCharacters(size_t columnIndex) const; + size_t getMaximumColumnWidthInCharacters(size_t columnIndex) const; stringvec getColumnNames(); void setDataFile( const std::string & dataFilePath, long timestamp) { _dataFilePath = dataFilePath; _dataFileTimestamp = timestamp; dbUpdate(); } diff --git a/CommonData/datasetbasenode.h b/CommonData/datasetbasenode.h index 9f2d513949..1df498ab5d 100644 --- a/CommonData/datasetbasenode.h +++ b/CommonData/datasetbasenode.h @@ -2,6 +2,7 @@ #define DATASETBASENODE_H #include "enumutilities.h" +#include DECLARE_ENUM(dataSetBaseNodeType, unknown, dataSet, data, filters, filter, column, label); diff --git a/Desktop/CMakeLists.txt b/Desktop/CMakeLists.txt index 25d2c1c297..14bae563c4 100644 --- a/Desktop/CMakeLists.txt +++ b/Desktop/CMakeLists.txt @@ -94,7 +94,7 @@ target_include_directories( PUBLIC ${CMAKE_CURRENT_LIST_DIR} ${PROJECT_SOURCE_DIR}/Common - ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder + ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder ${PROJECT_SOURCE_DIR}/CommonData ${PROJECT_SOURCE_DIR}/QMLComponents # ReadStat @@ -110,7 +110,8 @@ target_include_directories( target_link_libraries( JASP - PUBLIC + PRIVATE + Common CommonData QMLComponents Qt::Core @@ -164,9 +165,9 @@ if(NOT WINDOWS) target_link_libraries( JASP - PUBLIC - # When using Conan, we need to provide the static libraries directly, for some reason! - ${Iconv_LIBRARY_LIST}) + PRIVATE + # When using Conan, we need to provide the static libraries directly, for some reason! + ${Iconv_LIBRARY_LIST}) endif() if(LINUX) diff --git a/Desktop/data/columnmodel.cpp b/Desktop/data/columnmodel.cpp index 7415f8a61a..a1e6d69b0b 100644 --- a/Desktop/data/columnmodel.cpp +++ b/Desktop/data/columnmodel.cpp @@ -336,16 +336,16 @@ void ColumnModel::setColumnType(QString type) _undoStack->pushCommand(new SetColumnTypeCommand(this, {chosenColumn()}, int(cType))); } -std::vector ColumnModel::getSortedSelection() const +std::vector ColumnModel::getSortedSelection() const { if (_virtual) return {}; - std::map mapValueToRow; + std::map mapValueToRow; - for(qsizetype r=0; r out; + std::vector out; for(const QString & v : _selected) out.push_back(mapValueToRow[v]); @@ -357,7 +357,7 @@ std::vector ColumnModel::getSortedSelection() const void ColumnModel::setValueMaxWidth() { - qsizetype maxWidthChars = std::max((tr("Value").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, true)); + size_t maxWidthChars = std::max(size_t(tr("Value").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, true)); double prevMaxWidth = _valueMaxWidth; _valueMaxWidth = JaspTheme::fontMetrics().size(Qt::TextSingleLine, QString(maxWidthChars, 'X')).width(); @@ -368,7 +368,7 @@ void ColumnModel::setValueMaxWidth() void ColumnModel::setLabelMaxWidth() { - qsizetype maxWidthChars = std::max((tr("Label").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, false)); + size_t maxWidthChars = std::max(size_t(tr("Label").size()), !column() ? 0 : column()->getMaximumWidthInCharacters(false, false)); double prevMaxWidth = _labelMaxWidth; _labelMaxWidth = JaspTheme::fontMetrics().size(Qt::TextSingleLine, QString(maxWidthChars, 'X')).width(); @@ -379,7 +379,7 @@ void ColumnModel::setLabelMaxWidth() void ColumnModel::moveSelectionUp() { - std::vector indexes = getSortedSelection(); + std::vector indexes = getSortedSelection(); if (_beingRefreshed || indexes.size() < 1) return; @@ -389,7 +389,7 @@ void ColumnModel::moveSelectionUp() void ColumnModel::moveSelectionDown() { - std::vector indexes = getSortedSelection(); + std::vector indexes = getSortedSelection(); if (_beingRefreshed || indexes.size() < 1) return; @@ -672,9 +672,9 @@ void ColumnModel::checkCurrentColumn(QStringList, QStringList missingColumns, QM void ColumnModel::removeAllSelected() { - QMap mapValueToRow; + QMap mapValueToRow; - for(qsizetype r=0; r selectedValues; diff --git a/Desktop/data/columnmodel.h b/Desktop/data/columnmodel.h index 06ca77bd63..bfe5458a32 100644 --- a/Desktop/data/columnmodel.h +++ b/Desktop/data/columnmodel.h @@ -47,7 +47,7 @@ class ColumnModel : public DataSetTableProxy static QString columnTypeFriendlyName( computedColumnType compColT); static QVariant columnTypeFriendlyMapping( computedColumnType compColT); - bool labelNeedsFilter(qsizetype col); + bool labelNeedsFilter(size_t col); QString columnNameQ(); QString columnTitle() const; QString columnDescription() const; @@ -161,7 +161,7 @@ public slots: void hasSeveralNumericValuesChanged(); private: - std::vector getSortedSelection() const; + std::vector getSortedSelection() const; void setValueMaxWidth(); void clearVirtual(); diff --git a/Desktop/data/datasetpackage.cpp b/Desktop/data/datasetpackage.cpp index 697117995f..4ab61dad1c 100644 --- a/Desktop/data/datasetpackage.cpp +++ b/Desktop/data/datasetpackage.cpp @@ -1852,7 +1852,7 @@ bool DataSetPackage::labelNeedsFilter(size_t columnIndex) const } -void DataSetPackage::labelMoveRows(size_t colIdx, std::vector rows, bool up) +void DataSetPackage::labelMoveRows(size_t colIdx, std::vector rows, bool up) { Column * column = _dataSet->columns()[colIdx]; sizetset rowsChanged = column->labelsMoveRows(rows, up); diff --git a/Desktop/data/datasetpackage.h b/Desktop/data/datasetpackage.h index 4286219c3a..39e49ba162 100644 --- a/Desktop/data/datasetpackage.h +++ b/Desktop/data/datasetpackage.h @@ -251,7 +251,7 @@ class DataSetPackage : public QAbstractItemModel //Not QAbstractTableModel becau void resetFilterAllows( size_t columnIndex); int filteredOut( size_t columnIndex) const; bool labelNeedsFilter( size_t columnIndex) const; - void labelMoveRows( size_t columnIndex, std::vector rows, bool up); + void labelMoveRows( size_t columnIndex, std::vector rows, bool up); void labelReverse( size_t columnIndex); bool setFilterData(const std::string & filter, const boolvec & filterResult); void resetAllFilters(); diff --git a/Desktop/data/undostack.cpp b/Desktop/data/undostack.cpp index 2e3ee71392..238d4f3bd7 100644 --- a/Desktop/data/undostack.cpp +++ b/Desktop/data/undostack.cpp @@ -545,7 +545,7 @@ void FilterLabelCommand::redo() _model->setData(_model->index(_labelIndex, 0), _checked, int(DataSetPackage::specialRoles::filter)); } -MoveLabelCommand::MoveLabelCommand(QAbstractItemModel *model, const std::vector &indexes, bool up) +MoveLabelCommand::MoveLabelCommand(QAbstractItemModel *model, const std::vector &indexes, bool up) : UndoModelCommandLabelChange(model), _up{up} { if (_columnModel) @@ -582,9 +582,9 @@ MoveLabelCommand::MoveLabelCommand(QAbstractItemModel *model, const std::vector< } } -std::vector MoveLabelCommand::_getIndexes() +std::vector MoveLabelCommand::_getIndexes() { - std::vector indexes; + std::vector indexes; QStringList allLabels = DataSetPackage::pkg()->getColumnLabelsAsStringList(_colId); for (const QString& label : _labels) { @@ -599,7 +599,7 @@ std::vector MoveLabelCommand::_getIndexes() void MoveLabelCommand::redo() { _columnModel->setChosenColumn(_colId); - std::vector indexes = _getIndexes(); // The indexes must be recalculated each time + std::vector indexes = _getIndexes(); // The indexes must be recalculated each time DataSetPackage::pkg()->labelMoveRows(_colId, indexes, _up); //through DataSetPackage to make sure signals get sent } diff --git a/Desktop/data/undostack.h b/Desktop/data/undostack.h index 6f36cce08a..ed8ed2041f 100644 --- a/Desktop/data/undostack.h +++ b/Desktop/data/undostack.h @@ -119,12 +119,12 @@ class FilterLabelCommand: public UndoModelCommand class MoveLabelCommand: public UndoModelCommandLabelChange { public: - MoveLabelCommand(QAbstractItemModel *model, const std::vector& indexes, bool up); + MoveLabelCommand(QAbstractItemModel *model, const std::vector& indexes, bool up); void redo() override; private: - std::vector _getIndexes(); + std::vector _getIndexes(); void _moveLabels(bool up); QStringList _labels; diff --git a/Engine/CMakeLists.txt b/Engine/CMakeLists.txt index 4ea4c84554..9c669d72f5 100644 --- a/Engine/CMakeLists.txt +++ b/Engine/CMakeLists.txt @@ -39,7 +39,8 @@ add_dependencies(JASPEngine R-Interface) target_include_directories( JASPEngine - PUBLIC ${PROJECT_SOURCE_DIR}/R-Interface + PUBLIC + ${PROJECT_SOURCE_DIR}/R-Interface ${PROJECT_SOURCE_DIR}/CommonData ${PROJECT_SOURCE_DIR}/Common ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder @@ -65,18 +66,16 @@ endif() target_link_libraries( JASPEngine - PUBLIC Common - CommonData - # - $<$:${_LIB_R_INTERFACE_STATIC_DLL_A}> - $<$>:R-Interface> - # Boost - Boost::system - Boost::date_time - Boost::timer - Boost::chrono - # - LibArchive::LibArchive) + PRIVATE + Common + CommonData + $<$:${_LIB_R_INTERFACE_STATIC_DLL_A}> + $<$>:R-Interface> + Boost::system + Boost::date_time + Boost::timer + Boost::chrono +) if(IWYU_EXECUTABLE AND RUN_IWYU) set_target_properties(JASPEngine PROPERTIES CXX_INCLUDE_WHAT_YOU_USE diff --git a/Engine/rbridge.cpp b/Engine/rbridge.cpp index c58ed7ba58..fea2d67fec 100644 --- a/Engine/rbridge.cpp +++ b/Engine/rbridge.cpp @@ -27,6 +27,7 @@ #include "enginebase.h" #include "r_functionwhitelist.h" #include +#include #ifdef _WIN32 #include diff --git a/QMLComponents/ALTNavigation/altnavcontrol.cpp b/QMLComponents/ALTNavigation/altnavcontrol.cpp index a1bca2af58..3cf9d0c497 100644 --- a/QMLComponents/ALTNavigation/altnavcontrol.cpp +++ b/QMLComponents/ALTNavigation/altnavcontrol.cpp @@ -137,7 +137,7 @@ void ALTNavControl::setAltNavActive(bool value) { _dynamicTreeUpdate = true; _currentRoot->setChildrenPrefix(); - for(ALTNavScope* node : qAsConst(_attachedScopeMap)) + for(ALTNavScope* node : std::as_const(_attachedScopeMap)) { if (node->foreground()) { diff --git a/QMLComponents/CMakeLists.txt b/QMLComponents/CMakeLists.txt index 185e8833db..4c79d33377 100644 --- a/QMLComponents/CMakeLists.txt +++ b/QMLComponents/CMakeLists.txt @@ -34,6 +34,8 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/utilities/appdirs.h.in ${CMAKE_CURRENT_LIST_DIR}/utilities//appdirs.h) message(STATUS "appdirs.h is successfully generated...") +target_compile_definitions(QMLComponents PUBLIC JASP_USES_QT_HERE) + target_include_directories( QMLComponents PUBLIC # JASP @@ -48,8 +50,8 @@ target_include_directories( target_link_libraries( QMLComponents - PUBLIC - CommonData + PRIVATE + CommonData Qt::Core Qt::Gui Qt::Widgets diff --git a/QMLComponents/analysisform.cpp b/QMLComponents/analysisform.cpp index 0da3d80e38..e6377bbb4c 100644 --- a/QMLComponents/analysisform.cpp +++ b/QMLComponents/analysisform.cpp @@ -132,7 +132,7 @@ void AnalysisForm::runScriptRequestDone(const QString& result, const QString& co bindTo(Json::nullValue); // Some controls generate extra controls (rowComponents): these extra controls must be first destroyed, because they may disturb the binding of other controls // For this, bind all controls to null and wait for the controls to be completely destroyed. - QTimer::singleShot(0, [=](){ + QTimer::singleShot(0, this, [this, options](){ bindTo(options); blockValueChangeSignal(false, false); _analysis->boundValueChangedHandler(); diff --git a/R-Interface/CMakeLists.txt b/R-Interface/CMakeLists.txt index de3bb51c17..265e794740 100644 --- a/R-Interface/CMakeLists.txt +++ b/R-Interface/CMakeLists.txt @@ -174,20 +174,15 @@ if(WIN32) target_link_libraries( R-Interface - PUBLIC # RInside - ${_LIB_RINSIDE} - # R - ${_LIB_R} - # - #${RTOOLS_LIB_JSONCPP_DLL} - # - $<$:Qt::Core>) + PRIVATE + ${_LIB_RINSIDE} + ${_LIB_R} + ) target_compile_definitions( R-Interface PUBLIC JASP_R_INTERFACE_LIBRARY QT_NO_DEPRECATED_WARNINGS - $<$:JASP_USES_QT_HERE> $<$:PRINT_ENGINE_MESSAGES>) target_compile_definitions( @@ -209,10 +204,8 @@ else() PUBLIC # JASP ${PROJECT_SOURCE_DIR}/Common ${PROJECT_SOURCE_DIR}/CommonData - ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder + ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder ${PROJECT_SOURCE_DIR}/Common/jaspColumnEncoder/json - #$<$:${_PKGCONFIG_LIB_JSONCPP_INCLUDEDIR}> - # R ${R_INCLUDE_PATH} ${RCPP_PATH}/include ${RINSIDE_PATH}/include @@ -221,28 +214,23 @@ else() target_link_libraries( R-Interface - PUBLIC Boost::filesystem - Boost::system - Boost::date_time - Boost::timer - Boost::chrono - # CPM/CMake - #$<$:${_PKGCONFIG_LIB_JSONCPP_LIBRARIES}> - #$<$:${_PKGCONFIG_LIB_JSONCPP_LINK_LIBRARIES}> - #$<$:jsoncpp::jsoncpp> - # R - ${_LIB_RINSIDE} - $<$:${_LIB_R}> - $<$:${_R_Framework}> - # - $<$:Qt::Core>) + PRIVATE + Common + CommonData + Boost::system + Boost::date_time + Boost::timer + Boost::chrono + ${_LIB_RINSIDE} + $<$:${_LIB_R}> + $<$:${_R_Framework}> +) target_compile_definitions( R-Interface PUBLIC JASP_R_INTERFACE_LIBRARY QT_NO_DEPRECATED_WARNINGS - RCPP_NO_SUGAR - $<$:JASP_USES_QT_HERE> + RCPP_NO_SUGAR $<$:PRINT_ENGINE_MESSAGES>) if(IWYU_EXECUTABLE AND RUN_IWYU)