sort embedded layer by drawing order (fixes #7673)

This commit is contained in:
Juergen E. Fischer 2013-09-04 16:36:35 +02:00
parent 7120b1c947
commit e6a4f2f808
4 changed files with 31 additions and 5 deletions

View File

@ -52,8 +52,6 @@ cleanup() {
trap "" EXIT
}
trap cleanup EXIT
PATH=$QTDIR/bin:$PATH
if type qmake-qt4 >/dev/null 2>&1; then
@ -62,6 +60,11 @@ else
QMAKE=qmake
fi
if ! type pylupdate4 >/dev/null 2>&1; then
echo "pylupdate4 not found"
exit 1
fi
if type lupdate-qt4 >/dev/null 2>&1; then
LUPDATE=lupdate-qt4
else
@ -93,10 +96,13 @@ while (( $# > 0 )); do
fi
done
trap cleanup EXIT
if [ -n "$exclude" -o -n "$add" ]; then
echo Saving excluded translations
tar $fast -cf i18n/qgis_ts.tar i18n/qgis_*.ts$exclude
fi
echo Updating python translations
cd python
pylupdate4 utils.py {console,pyplugin_installer}/*.{py,ui} -ts python-i18n.ts

View File

@ -830,7 +830,8 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
// properties goes on bottom of menu for consistency with normal ui standards
// e.g. kde stuff
theMenu.addAction( tr( "&Properties" ), QgisApp::instance(), SLOT( layerProperties() ) );
if ( lyr->layer() && QgsProject::instance()->layerIsEmbedded( lyr->layer()->id() ).isEmpty() )
theMenu.addAction( tr( "&Properties" ), QgisApp::instance(), SLOT( layerProperties() ) );
if ( li->parent() && !parentGroupEmbedded( li ) )
{
@ -1383,6 +1384,14 @@ QList<QgsMapLayer *> QgsLegend::layers()
return ls;
}
static bool inReverseDrawingOrder( QgsLegendLayer *a, QgsLegendLayer *b )
{
if ( !a || !b )
return false;
return a->drawingOrder() > b->drawingOrder();
}
QList<QgsMapCanvasLayer> QgsLegend::canvasLayers()
{
QMap<int, QgsMapCanvasLayer> layers;
@ -1412,6 +1421,10 @@ QList<QgsMapCanvasLayer> QgsLegend::canvasLayers()
{
int groupDrawingOrder = lgroup->drawingOrder();
QList<QgsLegendLayer*> groupLayers = lgroup->legendLayers();
if ( !mUpdateDrawingOrder )
{
qSort( groupLayers.begin(), groupLayers.end(), inReverseDrawingOrder );
}
for ( int i = groupLayers.size() - 1; i >= 0; --i )
{
QgsLegendLayer* ll = groupLayers.at( i );
@ -1471,6 +1484,10 @@ void QgsLegend::setDrawingOrder( const QList<DrawingOrderInfo> &order )
{
group->setDrawingOrder( i );
QList<QgsLegendLayer*> groupLayers = group->legendLayers();
if ( !mUpdateDrawingOrder )
{
qSort( groupLayers.begin(), groupLayers.end(), inReverseDrawingOrder );
}
QList<QgsLegendLayer*>::iterator groupIt = groupLayers.begin();
for ( ; groupIt != groupLayers.end(); ++groupIt )
{

View File

@ -8073,7 +8073,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
return;
}
mActionLayerProperties->setEnabled( true );
mActionLayerProperties->setEnabled( QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() );
mActionAddToOverview->setEnabled( true );
mActionZoomToLayer->setEnabled( true );

View File

@ -30,6 +30,7 @@
#include "qgsfeatureaction.h"
#include "qgslogger.h"
#include "qgsnetworkaccessmanager.h"
#include "qgsproject.h"
#include <QCloseEvent>
#include <QLabel>
@ -687,6 +688,7 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent* event )
if ( !item )
return;
QgsMapLayer *layer = vectorLayer( item );
QgsVectorLayer *vlayer = vectorLayer( item );
QgsRasterLayer *rlayer = rasterLayer( item );
if ( vlayer == 0 && rlayer == 0 )
@ -745,7 +747,8 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent* event )
mActionPopup->addAction( tr( "Clear highlights" ), this, SLOT( clearHighlights() ) );
mActionPopup->addAction( tr( "Highlight all" ), this, SLOT( highlightAll() ) );
mActionPopup->addAction( tr( "Highlight layer" ), this, SLOT( highlightLayer() ) );
mActionPopup->addAction( tr( "Layer properties..." ), this, SLOT( layerProperties() ) );
if ( layer && QgsProject::instance()->layerIsEmbedded( layer->id() ).isEmpty() )
mActionPopup->addAction( tr( "Layer properties..." ), this, SLOT( layerProperties() ) );
mActionPopup->addSeparator();
mActionPopup->addAction( tr( "Expand all" ), this, SLOT( expandAll() ) );
mActionPopup->addAction( tr( "Collapse all" ), this, SLOT( collapseAll() ) );