mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
some more legend fixes
git-svn-id: http://svn.osgeo.org/qgis/trunk@4353 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
f97e9faf72
commit
78e3a756bd
@ -52,11 +52,6 @@ QgsLegend::QgsLegend(QgisApp* app, QWidget * parent, const char *name)
|
||||
connect( this, SIGNAL(selectionChanged(QTreeWidgetItem *)),
|
||||
this, SLOT(updateLegendItem(QTreeWidgetItem *)) );
|
||||
|
||||
connect( this, SIGNAL(doubleClicked(QTreeWidgetItem *, const QPoint &, int)),
|
||||
this, SLOT(handleDoubleClickEvent(QTreeWidgetItem*)));
|
||||
|
||||
//just for a test
|
||||
|
||||
connect( this, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
|
||||
this, SLOT(handleItemChange(QTreeWidgetItem*, int)));
|
||||
|
||||
@ -212,10 +207,13 @@ void QgsLegend::mouseMoveEvent(QMouseEvent * e)
|
||||
qWarning("mouseMoveEvent::INSERT");
|
||||
#endif
|
||||
setCursor( QCursor(Qt::PointingHandCursor) );
|
||||
if(origin->parent() != dest)
|
||||
{
|
||||
removeItem(origin);
|
||||
dest->insert(origin, false);
|
||||
setCurrentItem(origin);
|
||||
}
|
||||
}
|
||||
else//no action
|
||||
{
|
||||
#ifdef QGISDEBUG
|
||||
@ -321,18 +319,24 @@ void QgsLegend::mouseReleaseEvent(QMouseEvent * e)
|
||||
mItemBeingMoved = NULL;
|
||||
}
|
||||
|
||||
void QgsLegend::handleDoubleClickEvent(QTreeWidgetItem* item)
|
||||
void QgsLegend::mouseDoubleClickEvent(QMouseEvent* e)
|
||||
{
|
||||
#if 0
|
||||
QgsLegendItem* li = dynamic_cast<QgsLegendItem*>(item);
|
||||
QgsLegendItem* li = dynamic_cast<QgsLegendItem*>(currentItem());
|
||||
QgsMapLayer* ml = 0;
|
||||
|
||||
if(li)
|
||||
{
|
||||
if(li->type() == QgsLegendItem::LEGEND_LAYER_FILE)
|
||||
{
|
||||
QgsLegendLayerFile* llf = dynamic_cast<QgsLegendLayerFile*>(li);
|
||||
if(llf)
|
||||
ml = llf->layer();
|
||||
}
|
||||
else if(li->type() == QgsLegendItem::LEGEND_LAYER)
|
||||
{
|
||||
QgsMapLayer* ml = llf->layer();
|
||||
QgsLegendLayer* ll = dynamic_cast<QgsLegendLayer*>(li);
|
||||
ml = ll->firstMapLayer();
|
||||
}
|
||||
|
||||
if (ml && ml->type() == QgsMapLayer::RASTER)
|
||||
{
|
||||
QgsRasterLayerProperties *rlp = new QgsRasterLayerProperties(ml);
|
||||
@ -348,8 +352,17 @@ void QgsLegend::handleDoubleClickEvent(QTreeWidgetItem* item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QgsLegend::keyPressEvent(QKeyEvent* e)
|
||||
{
|
||||
if(e->key() == Qt::Key_Return)
|
||||
{
|
||||
QTreeWidgetItem* item = currentItem();
|
||||
if(item)
|
||||
{
|
||||
closePersistentEditor(item, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void QgsLegend::handleRightClickEvent(QTreeWidgetItem* item, const QPoint& position)
|
||||
|
@ -203,7 +203,8 @@ protected:
|
||||
* @return void
|
||||
*/
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
|
||||
void mouseDoubleClickEvent(QMouseEvent* e);
|
||||
void keyPressEvent(QKeyEvent* e);
|
||||
/**Stores the necessary information about the position of an item in the hierarchy. Afterwards,
|
||||
this item may be moved back to the original position with resetToInitialPosition()*/
|
||||
void storeInitialPosition(QTreeWidgetItem* li);
|
||||
@ -213,8 +214,6 @@ this item may be moved back to the original position with resetToInitialPosition
|
||||
|
||||
private slots:
|
||||
|
||||
/**Calls 'handleDoubleClickEvent' on the item*/
|
||||
void handleDoubleClickEvent(QTreeWidgetItem* item);
|
||||
/**Calls 'handleRightClickEvent' on the item*/
|
||||
void handleRightClickEvent(QTreeWidgetItem* item, const QPoint& position);
|
||||
/**Removes the current legend group*/
|
||||
|
@ -46,7 +46,7 @@ QgsLegendItem::DRAG_ACTION QgsLegendLayerFileGroup::accept(const QgsLegendItem*
|
||||
if(li)
|
||||
{
|
||||
LEGEND_ITEM_TYPE type = li->type();
|
||||
if ( type == LEGEND_LAYER_FILE && this != li->parent())
|
||||
if ( type == LEGEND_LAYER_FILE /*&& this != li->parent()*/)
|
||||
{
|
||||
if(child(0) == 0)
|
||||
{
|
||||
|
@ -70,14 +70,13 @@ int QgsLegendSymbologyGroup::compare (QTreeWidgetItem * i,int col, bool ascendin
|
||||
|
||||
void QgsLegendSymbologyGroup::updateLayerSymbologySettings(const QgsMapLayer* thelayer)
|
||||
{
|
||||
#if 0
|
||||
//find the legend layer group node
|
||||
QTreeWidgetItem* parent = this->parent();
|
||||
QgsLegendItem* parent = dynamic_cast<QgsLegendItem*>(this->parent());
|
||||
if(!parent)
|
||||
{
|
||||
return;
|
||||
}
|
||||
QTreeWidgetItem* sibling = 0;
|
||||
QgsLegendItem* sibling = 0;
|
||||
QgsLegendLayerFileGroup* group = 0;
|
||||
for(sibling = parent->firstChild(); sibling != 0; sibling = sibling->nextSibling())
|
||||
{
|
||||
@ -108,5 +107,4 @@ void QgsLegendSymbologyGroup::updateLayerSymbologySettings(const QgsMapLayer* th
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user