Skip to content
Permalink
Browse files

allow to add a QToolBar to QGisInterface (will allow subclassing)

  • Loading branch information
3nids committed Apr 24, 2014
1 parent d2b1c82 commit 26e94fec6f141b61c412aa669b856f118beb069e
@@ -162,6 +162,10 @@ class QgisInterface : QObject
//! Add toolbar with specified name
virtual QToolBar *addToolBar( QString name ) = 0 /Factory/;

//! Add a toolbar
//! @note added in 2.3
virtual void addToolBar( QToolBar* toolbar, Qt::ToolBarArea area = Qt::TopToolBarArea ) = 0;

/** Return a pointer to the map canvas */
virtual QgsMapCanvas * mapCanvas() = 0;

@@ -2135,6 +2135,13 @@ QToolBar *QgisApp::addToolBar( QString name )
return toolBar;
}

void QgisApp::addToolBar( QToolBar* toolBar , Qt::ToolBarArea area )
{
QMainWindow::addToolBar( area, toolBar );
// add to the Toolbar submenu
mToolbarMenu->addAction( toolBar->toggleViewAction() );
}

QgsLegend *QgisApp::legend()
{
Q_ASSERT( mMapLegend );
@@ -211,6 +211,14 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
* parent class, it will also add it to the View menu list of toolbars.*/
QToolBar *addToolBar( QString name );

/** Add a toolbar to the main window. Overloaded from QMainWindow.
* After adding the toolbar to the ui (by delegating to the QMainWindow
* parent class, it will also add it to the View menu list of toolbars.
* @note added in 2.3
*/
void addToolBar( QToolBar* toolBar, Qt::ToolBarArea area = Qt::TopToolBarArea );


/** Add window to Window menu. The action title is the window title
* and the action should raise, unminimize and activate the window. */
void addWindow( QAction *action );
@@ -285,6 +285,11 @@ QToolBar* QgisAppInterface::addToolBar( QString name )
return qgis->addToolBar( name );
}

void QgisAppInterface::addToolBar( QToolBar *toolbar, Qt::ToolBarArea area )
{
return qgis->addToolBar( toolbar, area );
}

void QgisAppInterface::openURL( QString url, bool useQgisDocDirectory )
{
qgis->openURL( url, useQgisDocDirectory );
@@ -146,6 +146,10 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
//! Add toolbar with specified name
QToolBar* addToolBar( QString name );

//! Add a toolbar
//! @note added in 2.3
void addToolBar( QToolBar* toolbar, Qt::ToolBarArea area = Qt::TopToolBarArea );

/** Open a url in the users browser. By default the QGIS doc directory is used
* as the base for the URL. To open a URL that is not relative to the installed
* QGIS documentation, set useQgisDocDirectory to false.
@@ -205,6 +205,10 @@ class GUI_EXPORT QgisInterface : public QObject
//! Add toolbar with specified name
virtual QToolBar *addToolBar( QString name ) = 0;

//! Add a toolbar
//! @note added in 2.3
virtual void addToolBar( QToolBar* toolbar, Qt::ToolBarArea area = Qt::TopToolBarArea ) = 0;

/** Return a pointer to the map canvas */
virtual QgsMapCanvas * mapCanvas() = 0;

0 comments on commit 26e94fe

Please sign in to comment.
You can’t perform that action at this time.