diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b84593c7f..13568df6cd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,6 +105,7 @@ if(GUI) find_package( Qt6 COMPONENTS Core + Charts DBusTools Gui Widgets @@ -378,7 +379,7 @@ if(GUI) # Module gui libs gui-qml ${NO_WHOLE_ARCHIVE_FLAG} PRIVATE # External libs - Qt6::Qml ${CORE_LINK_LIBS} ${THREADING_LINK_LIBS} + Qt6::Qml Qt6::Widgets ${CORE_LINK_LIBS} ${THREADING_LINK_LIBS} ) qt_generate_deploy_qml_app_script( diff --git a/flake.nix b/flake.nix index 9f72004137..1e3d5fb695 100644 --- a/flake.nix +++ b/flake.nix @@ -48,6 +48,8 @@ libglvnd.dev q.qtbase q.qtbase.dev + q.qtcharts + q.qtcharts.dev q.qtsvg q.qtshadertools q.qttools @@ -179,8 +181,7 @@ CMAKE_C_COMPILER_LAUNCHER = "${pkgs.ccache}/bin/ccache;${pkgs.distcc}/bin/distcc"; CMAKE_CXX_FLAGS_DEBUG = "-g -O0"; CXXL = "${pkgs.stdenv.cc.cc.lib}"; - QML_IMPORT_PATH = "${qt-idaaas.packages.${system}.qtdeclarative}/lib/qt-6/qml/"; - QML2_IMPORT_PATH = "${qt-idaaas.packages.${system}.qtdeclarative}/lib/qt-6/qml/"; + QML_IMPORT_PATH = "${qt-idaaas.packages.${system}.qtdeclarative}/lib/qt-6/qml/:${qt-idaaas.packages.${system}.qtcharts}/lib/qt-6/qml/"; }; apps = { diff --git a/src/dissolve-gui-qml.cpp b/src/dissolve-gui-qml.cpp index acd6f4be41..9a6f9cfd53 100644 --- a/src/dissolve-gui-qml.cpp +++ b/src/dissolve-gui-qml.cpp @@ -8,7 +8,8 @@ #include "main/cli.h" #include "main/dissolve.h" #include "main/version.h" -#include +#include +//#include #include #include #include @@ -27,7 +28,9 @@ int main(int args, char **argv) // Initialise random seed srand(options.randomSeed().value_or((unsigned)time(nullptr))); - QGuiApplication app(args, argv); + Types::registerDissolveQmlTypes(); + + QApplication app(args, argv); QQmlApplicationEngine engine; const QUrl url(u"qrc:/main/qml/DissolveMain.qml"_qs); @@ -37,7 +40,6 @@ int main(int args, char **argv) Qt::QueuedConnection); engine.load(url); - Types::registerDissolveQmlTypes(); QCoreApplication::setOrganizationName("Team Dissolve"); QCoreApplication::setOrganizationDomain("www.projectdissolve.com"); QCoreApplication::setApplicationName("Dissolve-GUI-QML"); diff --git a/src/gui-qml/CMakeLists.txt b/src/gui-qml/CMakeLists.txt index bc491a57fa..efd18f924f 100644 --- a/src/gui-qml/CMakeLists.txt +++ b/src/gui-qml/CMakeLists.txt @@ -3,4 +3,4 @@ add_library(gui-qml) target_include_directories(gui-qml PRIVATE ${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src Qt6::Core) -target_link_libraries(gui-qml PRIVATE models base Qt6::QuickWidgets) +target_link_libraries(gui-qml PRIVATE models base Qt6::QuickWidgets Qt6::Charts) diff --git a/src/gui-qml/qml/DissolveMain.qml b/src/gui-qml/qml/DissolveMain.qml index 1e9667eb0f..c0eb73748d 100644 --- a/src/gui-qml/qml/DissolveMain.qml +++ b/src/gui-qml/qml/DissolveMain.qml @@ -1,6 +1,8 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts +import Dissolve +import "charting" as C ApplicationWindow { id: dissolveWindow @@ -9,6 +11,19 @@ ApplicationWindow { visible: true width: 819 + /* + Test chart in window + */ + Window { + id: chartWindow + height: dissolveWindow.height/2; width: dissolveWindow.width/2 + + C.Data1D { + id: data1DChart + height: parent.height; width: parent.width + } + } + TabBar { id: tabBar width: parent.width @@ -59,5 +74,14 @@ ApplicationWindow { text: "Quit" } } + + Menu { + title: "&TEST_CHART" + + MenuItem { + text: "&1D..." + onTriggered: chartWindow.show() + } + } } } diff --git a/src/gui-qml/qml/charting/Data1D.qml b/src/gui-qml/qml/charting/Data1D.qml new file mode 100644 index 0000000000..b5b5d562cf --- /dev/null +++ b/src/gui-qml/qml/charting/Data1D.qml @@ -0,0 +1,24 @@ +import QtQuick +import QtCharts + +ChartView { + title: "1D Chart" + anchors.fill: parent + antialiasing: true + + LineSeries { + id: lineSeries + name: "Test Line" + XYPoint{x: 0; y: 0} + XYPoint{x: 1; y: 2} + XYPoint{x: 2; y: 4} + XYPoint{x: 3; y: 6} + XYPoint{x: 4; y: 8} + XYPoint{x: 5; y: 10} + XYPoint{x: 6; y: 12} + XYPoint{x: 7; y: 14} + XYPoint{x: 8; y: 16} + XYPoint{x: 9; y: 18} + XYPoint{x: 10; y: 20} + } +} diff --git a/src/gui-qml/resources.qrc b/src/gui-qml/resources.qrc index 0823de7016..c255c3c615 100644 --- a/src/gui-qml/resources.qrc +++ b/src/gui-qml/resources.qrc @@ -1,5 +1,6 @@ qml/DissolveMain.qml + qml/charting/Data1D.qml \ No newline at end of file