-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
applied patch from NathanW for ticket #3339
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14951 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
timlinux
committed
Dec 21, 2010
1 parent
80a4be9
commit f672e65
Showing
9 changed files
with
299 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*************************************************************************** | ||
qgscomposerlegendlayersdialog.cpp | ||
------------------------------- | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgscomposerlegendlayersdialog.h" | ||
|
||
#include <QStandardItem> | ||
|
||
QgsComposerLegendLayersDialog::QgsComposerLegendLayersDialog( QList<QgsMapLayer*> layers, QWidget* parent ): QDialog( parent ) | ||
{ | ||
setupUi( this ); | ||
|
||
QList<QgsMapLayer*>::iterator layerIt = layers.begin(); | ||
for (; layerIt != layers.end(); ++layerIt ) | ||
{ | ||
QListWidgetItem* item = new QListWidgetItem(( *layerIt )->name(), listMapLayers ); | ||
mItemLayerMap.insert( item, *layerIt ); | ||
} | ||
} | ||
|
||
QgsComposerLegendLayersDialog::QgsComposerLegendLayersDialog(): QDialog( 0 ) | ||
{ | ||
|
||
} | ||
|
||
QgsComposerLegendLayersDialog::~QgsComposerLegendLayersDialog() | ||
{ | ||
|
||
} | ||
|
||
QgsMapLayer* QgsComposerLegendLayersDialog::selectedLayer() | ||
{ | ||
QListWidgetItem* item = listMapLayers->currentItem(); | ||
if ( !item ) | ||
{ | ||
return 0; | ||
} | ||
|
||
QMap<QListWidgetItem*, QgsMapLayer*>::iterator it = mItemLayerMap.find( item ); | ||
QgsMapLayer* c = 0; | ||
c = it.value(); | ||
return c; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/*************************************************************************** | ||
qgscomposerlegenditemdialog.h | ||
----------------------------- | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSCOMPOSERLEGENDLAYERSDIALOG_H | ||
#define QGSCOMPOSERLEGENDLAYERSDIALOG_H | ||
|
||
#include "ui_qgscomposerlegendlayersdialogbase.h" | ||
#include "qgsmaplayer.h" | ||
|
||
/** \ingroup MapComposer | ||
* A dialog to add new layers to the legend. | ||
* */ | ||
class QgsComposerLegendLayersDialog: private Ui::QgsComposerLegendLayersDialogBase, public QDialog | ||
{ | ||
public: | ||
QgsComposerLegendLayersDialog( QList<QgsMapLayer*> layers, QWidget* parent = 0 ); | ||
~QgsComposerLegendLayersDialog(); | ||
QgsMapLayer* selectedLayer(); | ||
|
||
private: | ||
QgsComposerLegendLayersDialog(); //forbidden | ||
|
||
/**Stores the relation between items and map layer pointers. */ | ||
QMap<QListWidgetItem*, QgsMapLayer*> mItemLayerMap; | ||
}; | ||
|
||
#endif //QGSCOMPOSERLEGENDITEMDIALOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ui version="4.0"> | ||
<class>QgsComposerLegendLayersDialogBase</class> | ||
<widget class="QDialog" name="QgsComposerLegendLayersDialogBase"> | ||
<property name="geometry"> | ||
<rect> | ||
<x>0</x> | ||
<y>0</y> | ||
<width>252</width> | ||
<height>194</height> | ||
</rect> | ||
</property> | ||
<property name="windowTitle"> | ||
<string>Add layer to legend</string> | ||
</property> | ||
<layout class="QGridLayout" name="gridLayout"> | ||
<item row="0" column="0"> | ||
<widget class="QListWidget" name="listMapLayers"/> | ||
</item> | ||
<item row="1" column="0"> | ||
<widget class="QDialogButtonBox" name="buttonBox"> | ||
<property name="orientation"> | ||
<enum>Qt::Horizontal</enum> | ||
</property> | ||
<property name="standardButtons"> | ||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> | ||
</property> | ||
</widget> | ||
</item> | ||
</layout> | ||
</widget> | ||
<resources/> | ||
<connections> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>accepted()</signal> | ||
<receiver>QgsComposerLegendLayersDialogBase</receiver> | ||
<slot>accept()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>248</x> | ||
<y>254</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>157</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
<connection> | ||
<sender>buttonBox</sender> | ||
<signal>rejected()</signal> | ||
<receiver>QgsComposerLegendLayersDialogBase</receiver> | ||
<slot>reject()</slot> | ||
<hints> | ||
<hint type="sourcelabel"> | ||
<x>316</x> | ||
<y>260</y> | ||
</hint> | ||
<hint type="destinationlabel"> | ||
<x>286</x> | ||
<y>274</y> | ||
</hint> | ||
</hints> | ||
</connection> | ||
</connections> | ||
</ui> |
Oops, something went wrong.