mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Link the application browser dock to the application message bar
This commit is contained in:
parent
153f1b1138
commit
310d4f94fa
@ -34,6 +34,26 @@ Constructor for QgsBrowserDockWidget
|
|||||||
void addFavoriteDirectory( const QString &favDir, const QString &name = QString() );
|
void addFavoriteDirectory( const QString &favDir, const QString &name = QString() );
|
||||||
%Docstring
|
%Docstring
|
||||||
Add directory to favorites
|
Add directory to favorites
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setMessageBar( QgsMessageBar *bar );
|
||||||
|
%Docstring
|
||||||
|
Sets a message ``bar`` to use alongside the dock widget. Setting this allows items
|
||||||
|
to utilise the message bar to provide non-blocking feedback to users, e.g.
|
||||||
|
success or failure of actions.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`messageBar`
|
||||||
|
|
||||||
|
.. versionadded:: 3.6
|
||||||
|
%End
|
||||||
|
|
||||||
|
QgsMessageBar *messageBar();
|
||||||
|
%Docstring
|
||||||
|
Returns the message bar associated with the dock.
|
||||||
|
|
||||||
|
.. seealso:: :py:func:`setMessageBar`
|
||||||
|
|
||||||
|
.. versionadded:: 3.6
|
||||||
%End
|
%End
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -1020,6 +1020,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
|||||||
mBrowserModel = new QgsBrowserModel( this );
|
mBrowserModel = new QgsBrowserModel( this );
|
||||||
mBrowserWidget = new QgsBrowserDockWidget( tr( "Browser" ), mBrowserModel, this );
|
mBrowserWidget = new QgsBrowserDockWidget( tr( "Browser" ), mBrowserModel, this );
|
||||||
mBrowserWidget->setObjectName( QStringLiteral( "Browser" ) );
|
mBrowserWidget->setObjectName( QStringLiteral( "Browser" ) );
|
||||||
|
mBrowserWidget->setMessageBar( mInfoBar );
|
||||||
|
|
||||||
QShortcut *showBrowserDock = new QShortcut( QKeySequence( tr( "Ctrl+2" ) ), this );
|
QShortcut *showBrowserDock = new QShortcut( QKeySequence( tr( "Ctrl+2" ) ), this );
|
||||||
connect( showBrowserDock, &QShortcut::activated, mBrowserWidget, &QgsDockWidget::toggleUserVisible );
|
connect( showBrowserDock, &QShortcut::activated, mBrowserWidget, &QgsDockWidget::toggleUserVisible );
|
||||||
|
@ -339,6 +339,7 @@ void QgsBrowserDockWidget::showContextMenu( QPoint pt )
|
|||||||
}
|
}
|
||||||
|
|
||||||
QgsDataItemGuiContext context;
|
QgsDataItemGuiContext context;
|
||||||
|
context.setMessageBar( mMessageBar );
|
||||||
|
|
||||||
const QList< QgsDataItemGuiProvider * > providers = QgsGui::instance()->dataItemGuiProviderRegistry()->providers();
|
const QList< QgsDataItemGuiProvider * > providers = QgsGui::instance()->dataItemGuiProviderRegistry()->providers();
|
||||||
for ( QgsDataItemGuiProvider *provider : providers )
|
for ( QgsDataItemGuiProvider *provider : providers )
|
||||||
@ -383,6 +384,16 @@ void QgsBrowserDockWidget::addFavoriteDirectory( const QString &favDir, const QS
|
|||||||
mModel->addFavoriteDirectory( favDir, name );
|
mModel->addFavoriteDirectory( favDir, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QgsBrowserDockWidget::setMessageBar( QgsMessageBar *bar )
|
||||||
|
{
|
||||||
|
mMessageBar = bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
QgsMessageBar *QgsBrowserDockWidget::messageBar()
|
||||||
|
{
|
||||||
|
return mMessageBar;
|
||||||
|
}
|
||||||
|
|
||||||
void QgsBrowserDockWidget::removeFavorite()
|
void QgsBrowserDockWidget::removeFavorite()
|
||||||
{
|
{
|
||||||
mModel->removeFavorite( mProxyModel->mapToSource( mBrowserView->currentIndex() ) );
|
mModel->removeFavorite( mProxyModel->mapToSource( mBrowserView->currentIndex() ) );
|
||||||
|
@ -33,6 +33,7 @@ class QgsDockBrowserTreeView;
|
|||||||
class QgsLayerItem;
|
class QgsLayerItem;
|
||||||
class QgsDataItem;
|
class QgsDataItem;
|
||||||
class QgsBrowserProxyModel;
|
class QgsBrowserProxyModel;
|
||||||
|
class QgsMessageBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup gui
|
* \ingroup gui
|
||||||
@ -55,6 +56,26 @@ class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBro
|
|||||||
//! Add directory to favorites
|
//! Add directory to favorites
|
||||||
void addFavoriteDirectory( const QString &favDir, const QString &name = QString() );
|
void addFavoriteDirectory( const QString &favDir, const QString &name = QString() );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a message \a bar to use alongside the dock widget. Setting this allows items
|
||||||
|
* to utilise the message bar to provide non-blocking feedback to users, e.g.
|
||||||
|
* success or failure of actions.
|
||||||
|
*
|
||||||
|
* \see messageBar()
|
||||||
|
*
|
||||||
|
* \since QGIS 3.6
|
||||||
|
*/
|
||||||
|
void setMessageBar( QgsMessageBar *bar );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the message bar associated with the dock.
|
||||||
|
*
|
||||||
|
* \see setMessageBar()
|
||||||
|
*
|
||||||
|
* \since QGIS 3.6
|
||||||
|
*/
|
||||||
|
QgsMessageBar *messageBar();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -144,6 +165,8 @@ class GUI_EXPORT QgsBrowserDockWidget : public QgsDockWidget, private Ui::QgsBro
|
|||||||
// height fraction
|
// height fraction
|
||||||
float mPropertiesWidgetHeight;
|
float mPropertiesWidgetHeight;
|
||||||
|
|
||||||
|
QgsMessageBar *mMessageBar = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user