Skip to content

Commit

Permalink
Merge pull request #4649 from Holzhaus/qml-module
Browse files Browse the repository at this point in the history
Make QML UI compatible with Qt 6
  • Loading branch information
uklotzde authored Jan 31, 2022
2 parents 160cc57 + 11fd27f commit b648a88
Show file tree
Hide file tree
Showing 32 changed files with 411 additions and 289 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
os: ubuntu-20.04
# The Dockerfile for this container can be found at:
# https://github.com/Holzhaus/mixxx-ci-docker
container: holzhaus/mixxx-ci:20211016-qt6
container: holzhaus/mixxx-ci:20220128-qt6
cmake_args: >-
-DWARNINGS_FATAL=ON
-DQT6=ON
Expand Down
66 changes: 51 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -818,20 +818,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/preferences/settingsmanager.cpp
src/preferences/upgrade.cpp
src/recording/recordingmanager.cpp
src/qml/asyncimageprovider.cpp
src/qml/qmlapplication.cpp
src/qml/qmlcontrolproxy.cpp
src/qml/qmlconfigproxy.cpp
src/qml/qmldlgpreferencesproxy.cpp
src/qml/qmleffectmanifestparametersmodel.cpp
src/qml/qmleffectsmanagerproxy.cpp
src/qml/qmleffectslotproxy.cpp
src/qml/qmllibraryproxy.cpp
src/qml/qmllibrarytracklistmodel.cpp
src/qml/qmlplayermanagerproxy.cpp
src/qml/qmlplayerproxy.cpp
src/qml/qmlvisibleeffectsmodel.cpp
src/qml/qmlwaveformoverview.cpp
src/skin/legacy/colorschemeparser.cpp
src/skin/legacy/imgcolor.cpp
src/skin/legacy/imginvert.cpp
Expand Down Expand Up @@ -1024,7 +1010,24 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL
src/widget/wwidgetgroup.cpp
src/widget/wwidgetstack.cpp
)
if(NOT QT6)
if(QT6)
target_sources(mixxx-lib PRIVATE
src/qml/asyncimageprovider.cpp
src/qml/qmlapplication.cpp
src/qml/qmlcontrolproxy.cpp
src/qml/qmlconfigproxy.cpp
src/qml/qmldlgpreferencesproxy.cpp
src/qml/qmleffectmanifestparametersmodel.cpp
src/qml/qmleffectsmanagerproxy.cpp
src/qml/qmleffectslotproxy.cpp
src/qml/qmllibraryproxy.cpp
src/qml/qmllibrarytracklistmodel.cpp
src/qml/qmlplayermanagerproxy.cpp
src/qml/qmlplayerproxy.cpp
src/qml/qmlvisibleeffectsmodel.cpp
src/qml/qmlwaveformoverview.cpp
)
else()
target_sources(mixxx-lib PRIVATE
src/mixxxmainwindow.cpp
src/waveform/guitick.cpp
Expand Down Expand Up @@ -2152,6 +2155,39 @@ if(QT6)
foreach(COMPONENT ${QT6_NEW_COMPONENTS})
target_link_libraries(mixxx-lib PUBLIC Qt6::${COMPONENT})
endforeach()

set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml)
set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON)
qt_add_qml_module(mixxx-lib
URI Mixxx
VERSION 0.1
RESOURCE_PREFIX /mixxx.org/imports
QML_FILES
res/qml/Mixxx/MathUtils.mjs
res/qml/Mixxx/PlayerDropArea.qml
)
# FIXME: Currently we need to add these include directories due to
# QTBUG-87221. We should figure out a better way to fix this.
# See: https://bugreports.qt.io/browse/QTBUG-87221
target_include_directories(mixxx-lib PRIVATE src/control src/qml)
target_link_libraries(mixxx-lib PRIVATE mixxx-libplugin)

qt_add_library(mixxx-qml-mixxxcontrols STATIC)
set_target_properties(mixxx-qml-mixxxcontrols PROPERTIES AUTOMOC ON)
qt_add_qml_module(mixxx-qml-mixxxcontrols
URI Mixxx.Controls
VERSION 0.1
RESOURCE_PREFIX /mixxx.org/imports
OPTIONAL_IMPORTS Mixxx
QML_FILES
res/qml/Mixxx/Controls/Knob.qml
res/qml/Mixxx/Controls/Slider.qml
res/qml/Mixxx/Controls/Spinny.qml
res/qml/Mixxx/Controls/WaveformOverviewHotcueMarker.qml
res/qml/Mixxx/Controls/WaveformOverviewMarker.qml
res/qml/Mixxx/Controls/WaveformOverview.qml
)
target_link_libraries(mixxx-lib PRIVATE mixxx-qml-mixxxcontrolsplugin)
endif()

target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER)
Expand Down
3 changes: 1 addition & 2 deletions res/qml/Button.qml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import QtQuick 2.12
import QtQuick.Controls 2.12
import "Theme"
Expand Down Expand Up @@ -102,7 +102,6 @@ AbstractButton {
anchors.fill: parent
radius: 5
spread: 0.1
samples: 1 + radius * 2
color: label.color
source: label
}
Expand Down
2 changes: 1 addition & 1 deletion res/qml/DeckInfoBar.qml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "." as Skin
import Mixxx 0.1 as Mixxx
import Mixxx.Controls 0.1 as MixxxControls
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import QtQuick 2.12
import "Theme"

Expand Down
2 changes: 1 addition & 1 deletion res/qml/InfoBarButton.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Mixxx 0.1 as Mixxx
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import QtQuick 2.12
import QtQuick.Controls 2.12
import "Theme"
Expand Down
8 changes: 0 additions & 8 deletions res/qml/Mixxx/Controls/qmldir

This file was deleted.

3 changes: 0 additions & 3 deletions res/qml/Mixxx/qmldir

This file was deleted.

2 changes: 1 addition & 1 deletion res/qml/Slider.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Mixxx.Controls 0.1 as MixxxControls
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import QtQuick 2.12
import "Theme"

Expand Down
2 changes: 1 addition & 1 deletion res/qml/VuMeter.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Mixxx 0.1 as Mixxx
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import QtQuick 2.12
import "Theme"

Expand Down
6 changes: 6 additions & 0 deletions src/control/controlsortfiltermodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

#include <QSortFilterProxyModel>
#include <QString>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <QtQml>
#else
#define QML_ELEMENT
#endif

#include "control/controlmodel.h"

class ControlSortFilterModel : public QSortFilterProxyModel {
Q_OBJECT
Q_PROPERTY(int sortColumn READ sortColumn NOTIFY sortColumnChanged)
Q_PROPERTY(bool sortDescending READ sortDescending NOTIFY sortDescendingChanged)
QML_ELEMENT
public:
ControlSortFilterModel(QObject* pParent = nullptr);
virtual ~ControlSortFilterModel();
Expand Down
Loading

0 comments on commit b648a88

Please sign in to comment.