Skip to content
Permalink
Browse files

Allow adding QToolButton's to the toolbars

 * iface.addToolBarWidget()
 * iface.addRasterToolBarWidget()
 * iface.addVectorToolBarWidget()
 * iface.addDatabaseToolBarWidget()
 * iface.addWebToolBarWidget()
  • Loading branch information
m-kuhn committed Apr 28, 2013
1 parent ddbfb2e commit d90f167be92d65eca97c8782516cc720172f1978
Showing with 242 additions and 0 deletions.
  1. +51 −0 python/gui/qgisinterface.sip
  2. +25 −0 src/app/qgisapp.cpp
  3. +45 −0 src/app/qgisapp.h
  4. +25 −0 src/app/qgisappinterface.cpp
  5. +45 −0 src/app/qgisappinterface.h
  6. +51 −0 src/gui/qgisinterface.h
@@ -71,9 +71,29 @@ class QgisInterface : QObject
//! Add an icon to the plugins toolbar
virtual int addToolBarIcon( QAction *qAction ) = 0;

/**
* Add a widget to the plugins toolbar.
* To remove this widget again, call {@link removeToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
virtual QAction* addToolBarWidget( QWidget* widget ) = 0;

//! Remove an action (icon) from the plugin toolbar
virtual void removeToolBarIcon( QAction *qAction ) = 0;

/**
* Add a widget to the raster toolbar.
* To remove this widget again, call {@link removeRasterToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
virtual QAction* addRasterToolBarWidget( QWidget* widget ) = 0;

//! Add an icon to the Raster toolbar
//! @note added in 2.0
virtual int addRasterToolBarIcon( QAction *qAction ) = 0;
@@ -84,8 +104,19 @@ class QgisInterface : QObject

//! Add an icon to the Vector toolbar
//! @note added in 2.0

virtual int addVectorToolBarIcon( QAction *qAction ) = 0;

/**
* Add a widget to the vector toolbar.
* To remove this widget again, call {@link removeVectorToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
virtual QAction* addVectorToolBarWidget( QWidget* widget ) = 0;

//! Remove an action (icon) from the Vector toolbar
//! @note added in 2.0
virtual void removeVectorToolBarIcon( QAction *qAction ) = 0;
@@ -94,6 +125,16 @@ class QgisInterface : QObject
//! @note added in 2.0
virtual int addDatabaseToolBarIcon( QAction *qAction ) = 0;

/**
* Add a widget to the database toolbar.
* To remove this widget again, call {@link removeDatabaseToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
virtual QAction* addDatabaseToolBarWidget( QWidget* widget ) = 0;

//! Remove an action (icon) from the Database toolbar
//! @note added in 2.0
virtual void removeDatabaseToolBarIcon( QAction *qAction ) = 0;
@@ -102,6 +143,16 @@ class QgisInterface : QObject
//! @note added in 2.0
virtual int addWebToolBarIcon( QAction *qAction ) = 0;

/**
* Add a widget to the web toolbar.
* To remove this widget again, call {@link removeWebToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
virtual QAction* addWebToolBarWidget( QWidget* widget ) = 0;

//! Remove an action (icon) from the Web toolbar
//! @note added in 2.0
virtual void removeWebToolBarIcon( QAction *qAction ) = 0;
@@ -7342,6 +7342,11 @@ int QgisApp::addPluginToolBarIcon( QAction * qAction )
return 0;
}

QAction*QgisApp::addPluginToolBarWidget( QWidget* widget )
{
return mPluginToolBar->addWidget( widget );
}

void QgisApp::removePluginToolBarIcon( QAction *qAction )
{
mPluginToolBar->removeAction( qAction );
@@ -7353,6 +7358,11 @@ int QgisApp::addRasterToolBarIcon( QAction * qAction )
return 0;
}

QAction*QgisApp::addRasterToolBarWidget( QWidget* widget )
{
return mRasterToolBar->addWidget( widget );
}

void QgisApp::removeRasterToolBarIcon( QAction *qAction )
{
mRasterToolBar->removeAction( qAction );
@@ -7364,6 +7374,11 @@ int QgisApp::addVectorToolBarIcon( QAction * qAction )
return 0;
}

QAction*QgisApp::addVectorToolBarWidget( QWidget* widget )
{
return mVectorToolBar->addWidget( widget );
}

void QgisApp::removeVectorToolBarIcon( QAction *qAction )
{
mVectorToolBar->removeAction( qAction );
@@ -7375,6 +7390,11 @@ int QgisApp::addDatabaseToolBarIcon( QAction * qAction )
return 0;
}

QAction*QgisApp::addDatabaseToolBarWidget( QWidget* widget )
{
return mDatabaseToolBar->addWidget( widget );
}

void QgisApp::removeDatabaseToolBarIcon( QAction *qAction )
{
mDatabaseToolBar->removeAction( qAction );
@@ -7386,6 +7406,11 @@ int QgisApp::addWebToolBarIcon( QAction * qAction )
return 0;
}

QAction*QgisApp::addWebToolBarWidget( QWidget* widget )
{
return mWebToolBar->addWidget( widget );
}

void QgisApp::removeWebToolBarIcon( QAction *qAction )
{
mWebToolBar->removeAction( qAction );
@@ -724,22 +724,67 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void removeAddLayerAction( QAction* action );
//! Add an icon to the plugin toolbar
int addPluginToolBarIcon( QAction * qAction );
/**
* Add a widget to the plugins toolbar.
* To remove this widget again, call {@link removeToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addPluginToolBarWidget( QWidget* widget );
//! Remove an icon from the plugin toolbar
void removePluginToolBarIcon( QAction *qAction );
//! Add an icon to the Raster toolbar
int addRasterToolBarIcon( QAction * qAction );
/**
* Add a widget to the raster toolbar.
* To remove this widget again, call {@link removeRasterToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addRasterToolBarWidget( QWidget* widget );
//! Remove an icon from the Raster toolbar
void removeRasterToolBarIcon( QAction *qAction );
//! Add an icon to the Vector toolbar
int addVectorToolBarIcon( QAction * qAction );
/**
* Add a widget to the vector toolbar.
* To remove this widget again, call {@link removeVectorToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addVectorToolBarWidget( QWidget* widget );
//! Remove an icon from the Vector toolbar
void removeVectorToolBarIcon( QAction *qAction );
//! Add an icon to the Database toolbar
int addDatabaseToolBarIcon( QAction * qAction );
/**
* Add a widget to the database toolbar.
* To remove this widget again, call {@link removeDatabaseToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addDatabaseToolBarWidget( QWidget* widget );
//! Remove an icon from the Database toolbar
void removeDatabaseToolBarIcon( QAction *qAction );
//! Add an icon to the Web toolbar
int addWebToolBarIcon( QAction * qAction );
/**
* Add a widget to the web toolbar.
* To remove this widget again, call {@link removeWebToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addWebToolBarWidget( QWidget* widget );
//! Remove an icon from the Web toolbar
void removeWebToolBarIcon( QAction *qAction );
//! Save window state
@@ -203,6 +203,11 @@ int QgisAppInterface::addToolBarIcon( QAction * qAction )
return qgis->addPluginToolBarIcon( qAction );
}

QAction*QgisAppInterface::addToolBarWidget( QWidget* widget )
{
return qgis->addPluginToolBarWidget( widget );
}

void QgisAppInterface::removeToolBarIcon( QAction *qAction )
{
qgis->removePluginToolBarIcon( qAction );
@@ -213,6 +218,11 @@ int QgisAppInterface::addRasterToolBarIcon( QAction * qAction )
return qgis->addRasterToolBarIcon( qAction );
}

QAction*QgisAppInterface::addRasterToolBarWidget( QWidget* widget )
{
return qgis->addRasterToolBarWidget( widget );
}

void QgisAppInterface::removeRasterToolBarIcon( QAction *qAction )
{
qgis->removeRasterToolBarIcon( qAction );
@@ -223,6 +233,11 @@ int QgisAppInterface::addVectorToolBarIcon( QAction * qAction )
return qgis->addVectorToolBarIcon( qAction );
}

QAction*QgisAppInterface::addVectorToolBarWidget(QWidget* widget)
{
return qgis->addVectorToolBarWidget( widget );
}

void QgisAppInterface::removeVectorToolBarIcon( QAction *qAction )
{
qgis->removeVectorToolBarIcon( qAction );
@@ -233,6 +248,11 @@ int QgisAppInterface::addDatabaseToolBarIcon( QAction * qAction )
return qgis->addDatabaseToolBarIcon( qAction );
}

QAction*QgisAppInterface::addDatabaseToolBarWidget(QWidget* widget)
{
return qgis->addDatabaseToolBarWidget( widget );
}

void QgisAppInterface::removeDatabaseToolBarIcon( QAction *qAction )
{
qgis->removeDatabaseToolBarIcon( qAction );
@@ -243,6 +263,11 @@ int QgisAppInterface::addWebToolBarIcon( QAction * qAction )
return qgis->addWebToolBarIcon( qAction );
}

QAction*QgisAppInterface::addWebToolBarWidget(QWidget* widget)
{
return qgis->addWebToolBarWidget( widget );
}

void QgisAppInterface::removeWebToolBarIcon( QAction *qAction )
{
qgis->removeWebToolBarIcon( qAction );
@@ -80,22 +80,67 @@ class QgisAppInterface : public QgisInterface

//! Add an icon to the plugins toolbar
int addToolBarIcon( QAction *qAction );
/**
* Add a widget to the plugins toolbar.
* To remove this widget again, call {@link removeToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addToolBarWidget( QWidget* widget );
//! Remove an icon (action) from the plugin toolbar
void removeToolBarIcon( QAction *qAction );
//! Add an icon to the Raster toolbar
int addRasterToolBarIcon( QAction *qAction );
/**
* Add a widget to the raster toolbar.
* To remove this widget again, call {@link removeRasterToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addRasterToolBarWidget( QWidget* widget );
//! Remove an icon (action) from the Raster toolbar
void removeRasterToolBarIcon( QAction *qAction );
//! Add an icon to the Vector toolbar
int addVectorToolBarIcon( QAction *qAction );
/**
* Add a widget to the vector toolbar.
* To remove this widget again, call {@link removeVectorToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addVectorToolBarWidget( QWidget* widget );
//! Remove an icon (action) from the Vector toolbar
void removeVectorToolBarIcon( QAction *qAction );
//! Add an icon to the Database toolbar
int addDatabaseToolBarIcon( QAction *qAction );
/**
* Add a widget to the database toolbar.
* To remove this widget again, call {@link removeDatabaseToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addDatabaseToolBarWidget( QWidget* widget );
//! Remove an icon (action) from the Database toolbar
void removeDatabaseToolBarIcon( QAction *qAction );
//! Add an icon to the Web toolbar
int addWebToolBarIcon( QAction *qAction );
/**
* Add a widget to the web toolbar.
* To remove this widget again, call {@link removeWebToolBarIcon}
* with the returned QAction.
*
* @param widget widget to add. The toolbar will take ownership of this widget
* @return the QAction you can use to remove this widget from the toolbar
*/
QAction* addWebToolBarWidget( QWidget* widget );
//! Remove an icon (action) from the Web toolbar
void removeWebToolBarIcon( QAction *qAction );

0 comments on commit d90f167

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