Skip to content
Permalink
Browse files

sort embedded layer by drawing order (fixes #7673)

  • Loading branch information
jef-n committed Sep 4, 2013
1 parent 7120b1c commit e6a4f2f808709fc7a7daa4bac18d847333ce834c
Showing with 31 additions and 5 deletions.
  1. +8 −2 scripts/update_ts_files.sh
  2. +18 −1 src/app/legend/qgslegend.cpp
  3. +1 −1 src/app/qgisapp.cpp
  4. +4 −1 src/app/qgsidentifyresultsdialog.cpp
@@ -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
@@ -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 )
{
@@ -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 );

@@ -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() ) );

0 comments on commit e6a4f2f

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