Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a iface function for plugins to add actions to the new dashboard actions toolbar #5953

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/core/appinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ void AppInterface::addItemToCanvasActionsToolbar( QQuickItem *item ) const
}
}

void AppInterface::addItemToDashboardActionsToolbar( QQuickItem *item ) const
{
if ( !mApp->rootObjects().isEmpty() )
{
QQuickItem *toolbar = mApp->rootObjects().at( 0 )->findChild<QQuickItem *>( QStringLiteral( "dashboardActionsToolbar" ) );
item->setParentItem( toolbar );
}
}

void AppInterface::addItemToMainMenuActionsToolbar( QQuickItem *item ) const
{
addItemToDashboardActionsToolbar( item );
}

QObject *AppInterface::mainWindow() const
{
if ( !mApp->rootObjects().isEmpty() )
Expand Down
14 changes: 13 additions & 1 deletion src/core/appinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,22 @@ class AppInterface : public QObject
Q_INVOKABLE void addItemToPluginsToolbar( QQuickItem *item ) const;

/**
* Adds an \a item in the main menu action toolbar container
* Adds an \a item in the map canvas menu's action toolbar container
*/
Q_INVOKABLE void addItemToCanvasActionsToolbar( QQuickItem *item ) const;

/**
* Adds an \a item in the dashboard's action toolbar container
*/
Q_INVOKABLE void addItemToDashboardActionsToolbar( QQuickItem *item ) const;

/**
* Adds an \a item in the dashboard's action toolbar container
* \note This function is deprecated and will be removed in the future, use
* the addItemToDashboardActionsToolbar function instead
*/
Q_INVOKABLE void addItemToMainMenuActionsToolbar( QQuickItem *item ) const;

/**
* Returns the main window.
*/
Expand Down
9 changes: 5 additions & 4 deletions src/qml/DashBoard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Drawer {
anchors.fill: parent

Rectangle {
height: mainWindow.sceneTopMargin + Math.max(buttonsRow.height, buttonsRow.childrenRect.height)
height: mainWindow.sceneTopMargin + Math.max(buttonsRow.height + 8, buttonsRow.childrenRect.height)
Layout.fillWidth: true
Layout.preferredHeight: height

Expand All @@ -88,7 +88,8 @@ Drawer {
anchors.left: closeButton.right
anchors.right: menuButton.left
anchors.top: parent.top
anchors.topMargin: mainWindow.sceneTopMargin
anchors.topMargin: mainWindow.sceneTopMargin + 4
anchors.bottomMargin: 4
height: buttonsRow.height
contentWidth: buttonsRow.width
contentHeight: buttonsRow.height
Expand All @@ -105,8 +106,8 @@ Drawer {

Row {
id: buttonsRow
anchors.topMargin: mainWindow.sceneTopMargin
height: 56
objectName: "dashboardActionsToolbar"
height: 48
spacing: 1

QfToolButton {
Expand Down
Loading