diff --git a/src/appshell/internal/startupscenario.cpp b/src/appshell/internal/startupscenario.cpp index 0ce6136817..1f2286b1ca 100644 --- a/src/appshell/internal/startupscenario.cpp +++ b/src/appshell/internal/startupscenario.cpp @@ -94,6 +94,8 @@ void StartupScenario::run() std::string StartupScenario::startupPageUri(StartupSessionType sessionType) const { + return NOTATION_URI; + switch (sessionType) { case StartupSessionType::StartEmpty: case StartupSessionType::StartWithNewScore: diff --git a/src/appshell/qml/AppWindow.qml b/src/appshell/qml/AppWindow.qml index 2bba9517df..323ef99ce1 100644 --- a/src/appshell/qml/AppWindow.qml +++ b/src/appshell/qml/AppWindow.qml @@ -29,6 +29,8 @@ import MuseScore.AppShell 1.0 ApplicationWindow { id: root + objectName: "ApplicationWindow" + width: 1150 height: 800 diff --git a/src/appshell/qml/MainToolBar.qml b/src/appshell/qml/MainToolBar.qml index b395ebd96e..96e76daae2 100644 --- a/src/appshell/qml/MainToolBar.qml +++ b/src/appshell/qml/MainToolBar.qml @@ -28,8 +28,8 @@ import MuseScore.UiComponents 1.0 Item { id: root - width: radioButtonList.contentWidth - height: radioButtonList.contentHeight + width: radioButtonList.width + height: radioButtonList.height property alias navigation: navCtrl @@ -72,6 +72,9 @@ Item { model: root.items + width: contentItem.childrenRect.width + height: contentItem.childrenRect.height + delegate: GradientTabButton { id: radioButtonDelegate diff --git a/src/appshell/qml/NotationPage/NotationPage.qml b/src/appshell/qml/NotationPage/NotationPage.qml index ccd14ab37e..feef76895e 100644 --- a/src/appshell/qml/NotationPage/NotationPage.qml +++ b/src/appshell/qml/NotationPage/NotationPage.qml @@ -75,7 +75,6 @@ DockPage { } readonly property int defaultPanelWidth: 300 - readonly property int toolBarHeight: 48 mainToolBars: [ DockToolBar { @@ -84,9 +83,9 @@ DockPage { objectName: "notationToolBar" title: qsTrc("appshell", "Notation toolbar") - minimumWidth: 198 + movable: false - contentComponent: NotationToolBar { + NotationToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 2 @@ -104,11 +103,7 @@ DockPage { objectName: pageModel.playbackToolBarName() title: qsTrc("appshell", "Playback controls") - width: root.width / 3 - minimumWidth: floating ? 526 : 452 - minimumHeight: floating ? 56 : root.toolBarHeight - - contentComponent: PlaybackToolBar { + PlaybackToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 3 @@ -120,12 +115,9 @@ DockPage { objectName: pageModel.undoRedoToolBarName() title: qsTrc("appshell", "Undo/redo toolbar") - minimumWidth: 74 - maximumWidth: 74 - movable: false - contentComponent: UndoRedoToolBar { + UndoRedoToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 4 } @@ -139,12 +131,9 @@ DockPage { objectName: pageModel.noteInputBarName() title: qsTrc("appshell", "Note input") - horizontalPreferredSize: Qt.size(720, root.toolBarHeight) - verticalPreferredSize: Qt.size(root.toolBarHeight, 400) - allowedAreas: { Qt.AllDockWidgetAreas } - contentComponent: NoteInputBar { + NoteInputBar { orientation: noteInputBar.orientation navigation.section: root.noteInputKeyNavSec diff --git a/src/appshell/qml/PublishPage/PublishPage.qml b/src/appshell/qml/PublishPage/PublishPage.qml index a7a2b8f597..d9924ccad4 100644 --- a/src/appshell/qml/PublishPage/PublishPage.qml +++ b/src/appshell/qml/PublishPage/PublishPage.qml @@ -55,9 +55,7 @@ DockPage { objectName: root.objectName + "_notationToolBar" title: qsTrc("appshell", "Notation toolbar") - minimumWidth: 198 - - contentComponent: NotationToolBar { + NotationToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 2 @@ -75,11 +73,7 @@ DockPage { objectName: root.objectName + "_playbackToolBar" title: qsTrc("appshell", "Playback controls") - width: root.width / 3 - minimumWidth: floating ? 526 : 476 - minimumHeight: floating ? 56 : 48 - - contentComponent: PlaybackToolBar { + PlaybackToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 3 @@ -93,12 +87,9 @@ DockPage { objectName: root.objectName + "_undoRedoToolBar" title: qsTrc("appshell", "Undo/redo toolbar") - minimumWidth: 74 - maximumWidth: 74 - movable: false - contentComponent: UndoRedoToolBar { + UndoRedoToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 4 } @@ -109,7 +100,7 @@ DockPage { DockToolBar { objectName: "publishToolBar" - contentComponent: PublishToolBar { + PublishToolBar { navigation.section: root.publishToolBarKeyNavSec navigation.order: 1 } diff --git a/src/appshell/qml/WindowContent.qml b/src/appshell/qml/WindowContent.qml index ad4945838d..aa55a17e42 100644 --- a/src/appshell/qml/WindowContent.qml +++ b/src/appshell/qml/WindowContent.qml @@ -59,12 +59,9 @@ DockWindow { objectName: "mainToolBar" title: qsTrc("appshell", "Main toolbar") - width: root.width / 2 - minimumWidth: 304 - movable: false - contentComponent: MainToolBar { + MainToolBar { navigation.section: root.topToolKeyNavSec navigation.order: 1 diff --git a/src/appshell/qml/dockwindow/DockPanel.qml b/src/appshell/qml/dockwindow/DockPanel.qml index 21a415a4c6..c69dd14d10 100644 --- a/src/appshell/qml/dockwindow/DockPanel.qml +++ b/src/appshell/qml/dockwindow/DockPanel.qml @@ -26,7 +26,7 @@ import MuseScore.Dock 1.0 DockPanelView { id: root - default property alias content : contentLoader.sourceComponent + default property alias contentComponent : contentLoader.sourceComponent Loader { id: contentLoader diff --git a/src/appshell/qml/dockwindow/DockToolBar.qml b/src/appshell/qml/dockwindow/DockToolBar.qml index 7c4f055c59..076e2c52fe 100644 --- a/src/appshell/qml/dockwindow/DockToolBar.qml +++ b/src/appshell/qml/dockwindow/DockToolBar.qml @@ -29,83 +29,129 @@ import MuseScore.Dock 1.0 DockToolBarView { id: root - property Component contentComponent + default property alias contentComponent: contentLoader.sourceComponent + property alias movable: gripButton.visible + + onOrientationChanged: { + contentBackground.printInfo() + } + + onFloatingChanged: { + contentBackground.printInfo() + } Rectangle { - anchors.fill: parent + id: contentBackground + color: ui.theme.backgroundPrimaryColor - Loader { - id: loader - anchors.fill: parent - - sourceComponent: root.orientation === Qt.Horizontal ? horizontalView : verticalView - onLoaded: { - root.setDraggableMouseArea(loader.item.gripMouseArea) - } + function printInfo() { + console.debug("------------------------------") + console.debug("obj: " + objectName) + console.debug("contentSize: " + Qt.size(contentLoader.width, contentLoader.height)) + console.debug("bakgroundSize: " + Qt.size(contentBackground.width, contentBackground.height)) + console.debug("------------------------------\n") } - } - Component { - id: horizontalView + Component.onCompleted: { + Qt.callLater(printInfo) + } - RowLayout { - spacing: 0 + Item { + id: contentRect - property alias gripMouseArea: gripButton.mouseArea + readonly property int margins: 2 + readonly property int gripButtonWidth: gripButton.visible ? gripButton.width : 0 + readonly property int gripButtonHeight: gripButton.visible ? gripButton.height : 0 FlatButton { id: gripButton - Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter - Layout.margins: 2 - - mouseArea.objectName: root.objectName + "_toolBarMouseAreaHorizontal" + mouseArea.objectName: root.objectName + "_gripButton" transparent: true icon: IconCode.TOOLBAR_GRIP - visible: root.movable + Component.onCompleted: { + root.setDraggableMouseArea(mouseArea) + } } Loader { - Layout.fillWidth: true - Layout.fillHeight: true - - sourceComponent: root.contentComponent + id: contentLoader } } } - Component { - id: verticalView + states: [ + State { + name: "HORIZONTAL" + when: root.orientation === Qt.Horizontal - ColumnLayout { - spacing: 0 + PropertyChanges { + target: root - property alias gripMouseArea: gripButton.mouseArea + minimumWidth: contentLoader.item ? 2 * contentRect.margins + contentRect.gripButtonWidth + contentLoader.width : 0 + minimumHeight: contentLoader.item ? 2 * contentRect.margins + contentLoader.height : 0 + } - FlatButton { - id: gripButton + PropertyChanges { + target: gripButton - Layout.alignment: Qt.AlignTop | Qt.AlignHCenter - Layout.margins: 2 + anchors.left: parent.left + anchors.leftMargin: contentRect.margins + anchors.top: undefined - mouseArea.objectName: root.objectName + "_toolBarMouseAreaVertical" + x: 0 + y: (contentBackground.height - gripButton.height) / 2 + } + + PropertyChanges { + target: contentLoader + + anchors.left: gripButton.visible ? gripButton.right : parent.left + anchors.leftMargin: contentRect.margins + anchors.top: undefined + + x: 0 + y: (contentBackground.height - contentLoader.height) / 2 + } + }, + + State { + name: "VERTICAL" + when: root.orientation === Qt.Vertical + + PropertyChanges { + target: root + + minimumWidth: contentLoader.item ? 2 * contentRect.margins + contentLoader.width : 0 + minimumHeight: contentLoader.item ? 2 * contentRect.margins + contentRect.gripButtonHeight + contentLoader.height : 0 + } + + PropertyChanges { + target: gripButton + + anchors.top: parent.top + anchors.topMargin: contentRect.margins + anchors.left: undefined + + x: (contentBackground.width - gripButton.width) / 2 + y: 0 - transparent: true - icon: IconCode.TOOLBAR_GRIP rotation: 90 - - visible: root.movable } - Loader { - Layout.fillWidth: true - Layout.fillHeight: true + PropertyChanges { + target: contentLoader - sourceComponent: root.contentComponent + anchors.top: gripButton.bottom + anchors.topMargin: contentRect.margins + anchors.left: undefined + + x: (contentBackground.width - contentLoader.width) / 2 + y: 0 } } - } + ] } diff --git a/src/appshell/view/dockwindow/docktoolbarholder.cpp b/src/appshell/view/dockwindow/docktoolbarholder.cpp index 2c25dfa4ba..19a55f5350 100644 --- a/src/appshell/view/dockwindow/docktoolbarholder.cpp +++ b/src/appshell/view/dockwindow/docktoolbarholder.cpp @@ -28,7 +28,6 @@ DockToolBarHolder::DockToolBarHolder(QQuickItem* parent) : DockToolBarView(parent) { setVisible(false); - setMovable(false); } void DockToolBarHolder::componentComplete() diff --git a/src/appshell/view/dockwindow/docktoolbarview.cpp b/src/appshell/view/dockwindow/docktoolbarview.cpp index 1f74db02f1..c62f66f127 100644 --- a/src/appshell/view/dockwindow/docktoolbarview.cpp +++ b/src/appshell/view/dockwindow/docktoolbarview.cpp @@ -22,8 +22,6 @@ #include "docktoolbarview.h" -#include - #include "thirdparty/KDDockWidgets/src/DockWidgetQuick.h" #include "thirdparty/KDDockWidgets/src/private/TitleBar_p.h" #include "thirdparty/KDDockWidgets/src/private/DragController_p.h" @@ -32,10 +30,6 @@ using namespace mu::dock; -static constexpr qreal TOOLBAR_GRIP_MARGIN = 4; -static constexpr qreal TOOLBAR_GRIP_WIDTH = 28; -static constexpr qreal TOOLBAR_GRIP_HEIGHT = 36; - const int DockToolBarView::MIN_SIDE_SIZE = 48; const int DockToolBarView::MAX_SIDE_SIZE = std::numeric_limits::max(); @@ -94,7 +88,12 @@ public: void setDockWidget(KDDockWidgets::DockWidgetBase* dockWidget) { + IF_ASSERT_FAILED(dockWidget) { + return; + } + m_dockWidget = dockWidget; + setObjectName(dockWidget->objectName() + "_draggableArea"); } void setMouseArea(QQuickItem* mouseArea) @@ -115,19 +114,6 @@ DockToolBarView::DockToolBarView(QQuickItem* parent) { setAllowedAreas(Qt::TopDockWidgetArea); setLocation(DockLocation::Top); - - setMinimumWidth(MIN_SIDE_SIZE); - setMaximumWidth(MAX_SIDE_SIZE); - setMinimumHeight(MIN_SIDE_SIZE); - setMaximumHeight(MIN_SIDE_SIZE); - - setWidth(MAX_SIDE_SIZE); - setHeight(MIN_SIDE_SIZE); -} - -bool DockToolBarView::movable() const -{ - return m_movable; } Qt::Orientation DockToolBarView::orientation() const @@ -135,78 +121,6 @@ Qt::Orientation DockToolBarView::orientation() const return m_orientation; } -void DockToolBarView::setDraggableMouseArea(QQuickItem* mouseArea) -{ - IF_ASSERT_FAILED(m_draggableArea) { - return; - } - - m_draggableArea->setParent(mouseArea); - m_draggableArea->setMouseArea(mouseArea); -} - -QSize DockToolBarView::horizontalPreferredSize() const -{ - return m_horizontalPreferredSize; -} - -QSize DockToolBarView::verticalPreferredSize() const -{ - return m_verticalPreferredSize; -} - -void DockToolBarView::setMinimumWidth(int width) -{ - if (movable() && orientation() == Qt::Horizontal) { - width += TOOLBAR_GRIP_WIDTH + TOOLBAR_GRIP_MARGIN; - } - - DockBase::setMinimumWidth(width); -} - -void DockToolBarView::setMinimumHeight(int height) -{ - if (movable() && orientation() == Qt::Vertical) { - height += TOOLBAR_GRIP_HEIGHT + TOOLBAR_GRIP_MARGIN; - } - - DockBase::setMinimumHeight(height); -} - -void DockToolBarView::setMaximumWidth(int width) -{ - int preferredWidth = this->width(); - - if (movable() && orientation() == Qt::Horizontal) { - preferredWidth = TOOLBAR_GRIP_WIDTH + TOOLBAR_GRIP_MARGIN; - } - - width = std::max(width, preferredWidth); - DockBase::setMaximumWidth(width); -} - -void DockToolBarView::setMaximumHeight(int height) -{ - int preferredHeight = this->height(); - - if (movable() && orientation() == Qt::Horizontal) { - preferredHeight = TOOLBAR_GRIP_HEIGHT + TOOLBAR_GRIP_MARGIN; - } - - height = std::max(height, preferredHeight); - DockBase::setMaximumHeight(height); -} - -void DockToolBarView::setMovable(bool movable) -{ - if (m_movable == movable) { - return; - } - - m_movable = movable; - emit movableChanged(m_movable); -} - void DockToolBarView::setOrientation(Qt::Orientation orientation) { bool isChangingAllowed = isOrientationChangingAllowed(); @@ -218,34 +132,24 @@ void DockToolBarView::setOrientation(Qt::Orientation orientation) m_orientation = orientation; emit orientationChanged(orientation); - updateSizeConstraints(); + applySizeConstraintsByOrientation(); } -void DockToolBarView::setHorizontalPreferredSize(QSize horizontalPreferredSize) +void DockToolBarView::setDraggableMouseArea(QQuickItem* mouseArea) { - if (m_horizontalPreferredSize == horizontalPreferredSize) { + IF_ASSERT_FAILED(m_draggableArea) { return; } - m_horizontalPreferredSize = horizontalPreferredSize; - emit horizontalPreferredSizeChanged(m_horizontalPreferredSize); -} - -void DockToolBarView::setVerticalPreferredSize(QSize verticalPreferredSize) -{ - if (m_verticalPreferredSize == verticalPreferredSize) { - return; - } - - m_verticalPreferredSize = verticalPreferredSize; - emit verticalPreferredSizeChanged(m_verticalPreferredSize); + m_draggableArea->setParent(mouseArea); + m_draggableArea->setMouseArea(mouseArea); } void DockToolBarView::componentComplete() { DockBase::componentComplete(); - updateSizeConstraints(); + applySizeConstraintsByOrientation(); m_draggableArea->setDockWidget(dockWidget()); } @@ -255,36 +159,25 @@ DockType DockToolBarView::type() const return DockType::ToolBar; } -void DockToolBarView::updateSizeConstraints() -{ - bool isHorizontal = m_orientation == Qt::Horizontal; - QSize preferredSize = isHorizontal ? horizontalPreferredSize() : verticalPreferredSize(); - - if (preferredSize.isEmpty()) { - return; - } - - if (isHorizontal) { - setHeight(MIN_SIDE_SIZE); - setWidth(preferredSize.width()); - - setMinimumWidth(preferredSize.width()); - setMinimumHeight(MIN_SIDE_SIZE); - setMaximumWidth(MAX_SIDE_SIZE); - setMaximumHeight(MIN_SIDE_SIZE); - } else { - setWidth(MIN_SIDE_SIZE); - setHeight(preferredSize.height()); - - setMinimumWidth(MIN_SIDE_SIZE); - setMinimumHeight(preferredSize.height()); - setMaximumWidth(MIN_SIDE_SIZE); - setMaximumHeight(MAX_SIDE_SIZE); - } -} - bool DockToolBarView::isOrientationChangingAllowed() const { return allowedAreas().testFlag(Qt::LeftDockWidgetArea) || allowedAreas().testFlag(Qt::RightDockWidgetArea); } + +void DockToolBarView::applySizeConstraintsByOrientation() +{ + if (m_orientation == Qt::Horizontal) { + setMinimumWidth(MIN_SIDE_SIZE); + setMinimumHeight(MIN_SIDE_SIZE); + + setMaximumWidth(MAX_SIDE_SIZE); + setMaximumHeight(MIN_SIDE_SIZE); + } else { + setMinimumWidth(MIN_SIDE_SIZE); + setMinimumHeight(MIN_SIDE_SIZE); + + setMaximumWidth(MIN_SIDE_SIZE); + setMaximumHeight(MAX_SIDE_SIZE); + } +} diff --git a/src/appshell/view/dockwindow/docktoolbarview.h b/src/appshell/view/dockwindow/docktoolbarview.h index 0ff28e4b99..e1bdc4cec7 100644 --- a/src/appshell/view/dockwindow/docktoolbarview.h +++ b/src/appshell/view/dockwindow/docktoolbarview.h @@ -30,40 +30,20 @@ class DockToolBarView : public DockBase { Q_OBJECT - Q_PROPERTY(bool movable READ movable WRITE setMovable NOTIFY movableChanged) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) - Q_PROPERTY( - QSize horizontalPreferredSize READ horizontalPreferredSize WRITE setHorizontalPreferredSize NOTIFY horizontalPreferredSizeChanged) - Q_PROPERTY(QSize verticalPreferredSize READ verticalPreferredSize WRITE setVerticalPreferredSize NOTIFY verticalPreferredSizeChanged) - public: explicit DockToolBarView(QQuickItem* parent = nullptr); - bool movable() const; Qt::Orientation orientation() const; Q_INVOKABLE void setDraggableMouseArea(QQuickItem* mouseArea); - QSize horizontalPreferredSize() const; - QSize verticalPreferredSize() const; - public slots: - void setMinimumWidth(int width) override; - void setMinimumHeight(int height) override; - void setMaximumWidth(int width) override; - void setMaximumHeight(int height) override; - - void setMovable(bool movable); void setOrientation(Qt::Orientation orientation); - void setHorizontalPreferredSize(QSize horizontalPreferredSize); - void setVerticalPreferredSize(QSize verticalPreferredSize); signals: - void movableChanged(bool movable); void orientationChanged(Qt::Orientation orientation); - void horizontalPreferredSizeChanged(QSize horizontalPreferredSize); - void verticalPreferredSizeChanged(QSize verticalPreferredSize); protected: void componentComplete() override; @@ -74,17 +54,15 @@ protected: static const int MAX_SIDE_SIZE; private: - void updateSizeConstraints(); - bool isOrientationChangingAllowed() const; + void applySizeConstraintsByOrientation(); + class DraggableArea; DraggableArea* m_draggableArea = nullptr; bool m_movable = true; Qt::Orientation m_orientation = Qt::Horizontal; - QSize m_horizontalPreferredSize; - QSize m_verticalPreferredSize; }; } diff --git a/src/appshell/view/dockwindow/internal/dockbase.cpp b/src/appshell/view/dockwindow/internal/dockbase.cpp index e8618f69a2..78157e701a 100644 --- a/src/appshell/view/dockwindow/internal/dockbase.cpp +++ b/src/appshell/view/dockwindow/internal/dockbase.cpp @@ -189,11 +189,6 @@ DockType DockBase::type() const return DockType::Undefined; } -void DockBase::resize() -{ - applySizeConstraints(); -} - void DockBase::init() { applySizeConstraints(); @@ -263,8 +258,8 @@ void DockBase::componentComplete() listenFloatingChanges(); - connect(this, &DockBase::minimumSizeChanged, this, &DockBase::resize); - connect(this, &DockBase::maximumSizeChanged, this, &DockBase::resize); + connect(this, &DockBase::minimumSizeChanged, this, &DockBase::applySizeConstraints); + connect(this, &DockBase::maximumSizeChanged, this, &DockBase::applySizeConstraints); } void DockBase::applySizeConstraints() @@ -293,7 +288,10 @@ void DockBase::applySizeConstraints() if (auto floatingWindow = m_dockWidget->floatingWindow()) { QRect rect(floatingWindow->dragRect().topLeft(), minimumSize); + floatingWindow->setGeometry(rect); + floatingWindow->setMinimumSize(minimumSize); + floatingWindow->setMaximumSize(maximumSize); } } @@ -315,6 +313,7 @@ void DockBase::listenFloatingChanges() connect(frame, &KDDockWidgets::Frame::isInMainWindowChanged, this, [=]() { doSetFloating(!frame->isInMainWindow()); + applySizeConstraints(); }, Qt::UniqueConnection); }); } diff --git a/src/appshell/view/dockwindow/internal/dockbase.h b/src/appshell/view/dockwindow/internal/dockbase.h index ab5d60a17d..c4f9a5b9b4 100644 --- a/src/appshell/view/dockwindow/internal/dockbase.h +++ b/src/appshell/view/dockwindow/internal/dockbase.h @@ -84,10 +84,10 @@ public: public slots: void setTitle(const QString& title); - virtual void setMinimumWidth(int width); - virtual void setMinimumHeight(int height); - virtual void setMaximumWidth(int width); - virtual void setMaximumHeight(int height); + void setMinimumWidth(int width); + void setMinimumHeight(int height); + void setMaximumWidth(int width); + void setMaximumHeight(int height); void setAllowedAreas(Qt::DockWidgetAreas areas); @@ -115,10 +115,9 @@ protected: KDDockWidgets::DockWidgetQuick* dockWidget() const; private slots: - void resize(); + void applySizeConstraints(); private: - void applySizeConstraints(); void listenFloatingChanges(); void doSetFloating(bool floating); diff --git a/src/framework/uicomponents/qml/MuseScore/UiComponents/GridViewSectional.qml b/src/framework/uicomponents/qml/MuseScore/UiComponents/GridViewSectional.qml index 430e6cf246..1d5217a0de 100644 --- a/src/framework/uicomponents/qml/MuseScore/UiComponents/GridViewSectional.qml +++ b/src/framework/uicomponents/qml/MuseScore/UiComponents/GridViewSectional.qml @@ -33,6 +33,9 @@ Item { property Component sectionDelegate: Item {} property Component itemDelegate: Item {} + property alias contentWidth: loader.width + property alias contentHeight: loader.height + property int cellWidth: 0 property int cellHeight: 0 @@ -69,7 +72,8 @@ Item { } Loader { - anchors.fill: parent + id: loader + sourceComponent: isHorizontal ? horizontalView : verticalView } @@ -79,16 +83,17 @@ Item { Row { spacing: privateProperties.spacingBeforeSection + height: childrenRect.height + Repeater { model: Boolean(root.model) ? privateProperties.modelSections() : [] Row { spacing: privateProperties.spacingAfterSection - height: parent.height + + height: childrenRect.height GridViewSection { - anchors.verticalCenter: parent.verticalCenter - width: root.sectionWidth height: root.sectionHeight @@ -96,8 +101,6 @@ Item { } GridViewDelegate { - anchors.verticalCenter: parent.verticalCenter - model: Boolean(root.model) ? root.model : null itemDelegate: root.itemDelegate @@ -122,16 +125,17 @@ Item { Column { spacing: privateProperties.spacingBeforeSection + width: childrenRect.width + Repeater { model: Boolean(root.model) ? privateProperties.modelSections() : [] Column { spacing: privateProperties.spacingAfterSection - width: parent.width + + width: childrenRect.width GridViewSection { - anchors.horizontalCenter: parent.horizontalCenter - width: root.sectionWidth height: root.sectionHeight @@ -139,8 +143,6 @@ Item { } GridViewDelegate { - anchors.horizontalCenter: parent.horizontalCenter - model: Boolean(root.model) ? root.model : null itemDelegate: root.itemDelegate diff --git a/src/notation/qml/MuseScore/NotationScene/NotationToolBar.qml b/src/notation/qml/MuseScore/NotationScene/NotationToolBar.qml index eac46a87a2..958a1f50bf 100644 --- a/src/notation/qml/MuseScore/NotationScene/NotationToolBar.qml +++ b/src/notation/qml/MuseScore/NotationScene/NotationToolBar.qml @@ -31,6 +31,9 @@ Rectangle { signal activeFocusRequested() + width: view.width + height: view.height + color: ui.theme.backgroundPrimaryColor Component.onCompleted: { @@ -57,9 +60,7 @@ Rectangle { ListView { id: view - anchors.verticalCenter: parent.verticalCenter - - width: contentWidth + width: contentItem.childrenRect.width height: contentItem.childrenRect.height orientation: Qt.Horizontal diff --git a/src/notation/qml/MuseScore/NotationScene/NoteInputBar.qml b/src/notation/qml/MuseScore/NotationScene/NoteInputBar.qml index ae2035bbed..1a087b210f 100644 --- a/src/notation/qml/MuseScore/NotationScene/NoteInputBar.qml +++ b/src/notation/qml/MuseScore/NotationScene/NoteInputBar.qml @@ -37,6 +37,9 @@ Rectangle { property bool floating: false + width: gridView.width + height: gridView.height + color: ui.theme.backgroundPrimaryColor QtObject { @@ -62,7 +65,9 @@ Rectangle { GridViewSectional { id: gridView - anchors.fill: parent + + width: contentWidth + height: contentHeight sectionRole: "section" @@ -193,7 +198,7 @@ Rectangle { width: gridView.cellWidth height: gridView.cellHeight - icon: IconCode.CONFIGURE + icon: IconCode.SETTINGS_COG iconFont: ui.theme.toolbarIconsFont transparent: true navigation.panel: keynavSub @@ -218,22 +223,21 @@ Rectangle { PropertyChanges { target: gridView sectionWidth: 1 - sectionHeight: root.height + sectionHeight: gridView.height rows: 1 columns: gridView.noLimit } AnchorChanges { target: customizeButton - anchors.right: root.right - anchors.verticalCenter: root.verticalCenter + anchors.left: gridView.right } }, State { when: !privatesProperties.isHorizontal PropertyChanges { target: gridView - sectionWidth: root.width + sectionWidth: gridView.width sectionHeight: 1 rows: gridView.noLimit columns: 2 @@ -241,8 +245,7 @@ Rectangle { AnchorChanges { target: customizeButton - anchors.bottom: root.bottom - anchors.right: root.right + anchors.top: gridView.bottom } } ] diff --git a/src/notation/qml/MuseScore/NotationScene/UndoRedoToolBar.qml b/src/notation/qml/MuseScore/NotationScene/UndoRedoToolBar.qml index 82d9a073ac..a22f0030b0 100644 --- a/src/notation/qml/MuseScore/NotationScene/UndoRedoToolBar.qml +++ b/src/notation/qml/MuseScore/NotationScene/UndoRedoToolBar.qml @@ -30,6 +30,9 @@ Rectangle { property alias navigation: navPanel + width: content.width + height: content.height + color: ui.theme.backgroundPrimaryColor Component.onCompleted: { @@ -48,7 +51,7 @@ Rectangle { } Row { - anchors.centerIn: parent + id: content height: childrenRect.height spacing: 2 diff --git a/src/playback/qml/MuseScore/Playback/PlaybackToolBar.qml b/src/playback/qml/MuseScore/Playback/PlaybackToolBar.qml index 884901f831..c59387f35d 100644 --- a/src/playback/qml/MuseScore/Playback/PlaybackToolBar.qml +++ b/src/playback/qml/MuseScore/Playback/PlaybackToolBar.qml @@ -36,6 +36,9 @@ Rectangle { property alias navigation: navPanel property bool floating: false + width: content.width + height: content.height + color: ui.theme.backgroundPrimaryColor NavigationPanel { @@ -55,10 +58,11 @@ Rectangle { } Column { + id: content + spacing: 14 - anchors.verticalCenter: parent.verticalCenter - width: parent.width + width: childrenRect.width enabled: playbackModel.isPlayAllowed @@ -68,8 +72,8 @@ Rectangle { spacing: 0 ListView { - Layout.preferredWidth: childrenRect.width - Layout.preferredHeight: childrenRect.height + Layout.preferredWidth: contentItem.childrenRect.width + Layout.preferredHeight: contentItem.childrenRect.height contentHeight: root.floating ? 32 : 48 spacing: 4 @@ -81,7 +85,6 @@ Rectangle { delegate: Loader { id: itemLoader - anchors.verticalCenter: parent ? parent.verticalCenter : undefined sourceComponent: Boolean(model.code) || model.subitems.length !== 0 ? menuItemComp : separatorComp