mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
disable toolbar buttons when not appropriate for current layer type
git-svn-id: http://svn.osgeo.org/qgis/trunk@696 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
4f1f1f384c
commit
3d259ba65b
8
TODO
8
TODO
@ -1,4 +1,4 @@
|
||||
TODO,v 1.12 2004/01/28 04:53:14 gsherman Exp
|
||||
TODO,v 1.13 2004/02/04 19:40:47 stevehalasz Exp
|
||||
TODO List for getting to version 0.1 (in no order of importance)
|
||||
1. Fix QgsProjectIo so that qgis projects can be saved and loaded. Major areas
|
||||
needing attention are customized raster settings and symbology for vector
|
||||
@ -9,9 +9,9 @@ TODO List for getting to version 0.1 (in no order of importance)
|
||||
name and a suitable pixmap. Will improve later.
|
||||
4. [DONE (TS/GS)] Implement context menus for raster and vector layers.
|
||||
Will add advanced functions later.
|
||||
5. Toolbar buttons related to layer functions need to be disabled when not
|
||||
appropriate (eg. table and select buttons when a raster is selected in
|
||||
the legend)
|
||||
5. [DONE (SH)] Toolbar buttons related to layer functions need to be disabled
|
||||
when not appropriate (eg. table and select buttons when a raster is
|
||||
selected in the legend)
|
||||
6. SPIT integration needs to be completed. The libpq++ dependency must be
|
||||
removed and the current open bugs (sf.net) need to be resolved.
|
||||
7. Adjust the open dialog for "shapefiles" to allow other formats supported
|
||||
|
@ -250,6 +250,8 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
|
||||
connect(legendView, SIGNAL(rightButtonPressed(QListViewItem *, const QPoint &, int)),
|
||||
this, SLOT(rightClickLegendMenu(QListViewItem *, const QPoint &, int)));
|
||||
connect(legendView, SIGNAL(zOrderChanged(QgsLegendView *)), mapCanvas, SLOT(setZOrderFromLegend(QgsLegendView *)));
|
||||
connect(legendView, SIGNAL(currentChanged(QListViewItem *)),
|
||||
this, SLOT(clickLegendMenu(QListViewItem *)));
|
||||
|
||||
// create the layer popup menu
|
||||
/* popMenu = new QPopupMenu();
|
||||
@ -1030,6 +1032,42 @@ void QgisApp::rightClickLegendMenu(QListViewItem * lvi, const QPoint & pt, int)
|
||||
}
|
||||
}
|
||||
|
||||
void QgisApp::clickLegendMenu(QListViewItem * lvi)
|
||||
{
|
||||
if (lvi) {
|
||||
// disable/enable toolbar buttons as appropriate based on selected
|
||||
// layer type
|
||||
QgsMapLayer *lyr = ((QgsLegendItem *) lvi)->layer();
|
||||
if (lyr->type() == QgsMapLayer::RASTER) {
|
||||
actionIdentify->setEnabled( FALSE );
|
||||
actionSelect->setEnabled( FALSE );
|
||||
actionOpenTable->setEnabled( FALSE );
|
||||
// if one of these map tools is selected, set cursor to default
|
||||
if (mapTool == QGis::Identify || mapTool == QGis::Select || mapTool == QGis::Table) {
|
||||
delete mapCursor;
|
||||
mapCursor = new QCursor();
|
||||
mapCanvas->setCursor(*mapCursor);
|
||||
}
|
||||
} else {
|
||||
actionIdentify->setEnabled( TRUE );
|
||||
actionSelect->setEnabled( TRUE );
|
||||
actionOpenTable->setEnabled( TRUE );
|
||||
// if one of these map tools is selected, make sure appropriate cursor gets set
|
||||
switch (mapTool) {
|
||||
case QGis::Identify:
|
||||
identify();
|
||||
break;
|
||||
case QGis::Select:
|
||||
select();
|
||||
break;
|
||||
case QGis::Table:
|
||||
attributeTable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QgisIface * QgisApp::getInterface(){
|
||||
return qgisInterface;
|
||||
}
|
||||
|
@ -105,6 +105,8 @@ class QgisApp:public QgisAppBase
|
||||
void layerProperties();
|
||||
//! Show the right-click menu for the legend
|
||||
void rightClickLegendMenu(QListViewItem *, const QPoint &, int);
|
||||
//! Disable/enable toolbar buttons as appropriate for selected layer
|
||||
void clickLegendMenu(QListViewItem *);
|
||||
//! Remove a layer from the map and legend
|
||||
void removeLayer();
|
||||
//! zoom to extent of layer
|
||||
|
Loading…
x
Reference in New Issue
Block a user