Skip to content

Commit 4358e8e

Browse files
committed
identify expand/collaps tools
1 parent 675e81c commit 4358e8e

File tree

5 files changed

+101
-9
lines changed

5 files changed

+101
-9
lines changed

images/images.qrc

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
<file>themes/default/mActionEditCut.png</file>
6868
<file>themes/default/mActionEditPaste.png</file>
6969
<file>themes/default/mActionExpandTree.png</file>
70+
<file>themes/default/mActionExpandNewTree.png</file>
7071
<file>themes/default/mActionExportMapServer.png</file>
7172
<file>themes/default/mActionFileExit.png</file>
7273
<file>themes/default/mActionFileNew.png</file>
1.09 KB
Loading

src/app/qgsidentifyresults.cpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ QgsIdentifyResults::QgsIdentifyResults( QgsMapCanvas *canvas, QWidget *parent, Q
8888
, mDock( NULL )
8989
{
9090
setupUi( this );
91+
92+
mExpandToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionExpandTree.png" ) );
93+
mCollapseToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionCollapseTree.png" ) );
94+
mExpandNewToolButton->setIcon( QgsApplication::getThemeIcon( "/mActionExpandNewTree.png" ) );
95+
9196
QSettings mySettings;
9297
restoreGeometry( mySettings.value( "/Windows/Identify/geometry" ).toByteArray() );
9398
bool myDockFlag = mySettings.value( "/qgis/dockIdentifyResults", false ).toBool();
@@ -98,6 +103,7 @@ QgsIdentifyResults::QgsIdentifyResults( QgsMapCanvas *canvas, QWidget *parent, Q
98103
mDock->setWidget( this );
99104
QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mDock );
100105
}
106+
mExpandNewToolButton->setChecked( mySettings.value( "/Map/identifyExpand", false ).toBool() );
101107
lstResults->setColumnCount( 2 );
102108
setColumnText( 0, tr( "Feature" ) );
103109
setColumnText( 1, tr( "Value" ) );
@@ -371,6 +377,12 @@ void QgsIdentifyResults::show()
371377
layItem->setExpanded( true );
372378
}
373379

380+
// expand all if enabled
381+
if ( mExpandNewToolButton->isChecked() )
382+
{
383+
lstResults->expandAll();
384+
}
385+
374386
QDialog::show();
375387
raise();
376388
}
@@ -948,7 +960,7 @@ void QgsIdentifyResults::layerProperties()
948960
void QgsIdentifyResults::layerProperties( QTreeWidgetItem *item )
949961
{
950962
QgsVectorLayer *vlayer = vectorLayer( item );
951-
if( !vlayer )
963+
if ( !vlayer )
952964
return;
953965

954966
QgisApp::instance()->showLayerProperties( vlayer );
@@ -1007,3 +1019,9 @@ void QgsIdentifyResults::openUrl( const QUrl &url )
10071019
QMessageBox::warning( this, tr( "Could not open url" ), tr( "Could not open URL '%1'" ).arg( url.toString() ) );
10081020
}
10091021
}
1022+
1023+
void QgsIdentifyResults:: on_mExpandNewToolButton_toggled( bool checked )
1024+
{
1025+
QSettings settings;
1026+
settings.setValue( "/Map/identifyExpand", checked );
1027+
}

src/app/qgsidentifyresults.h

+5
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
113113

114114
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
115115

116+
void on_mExpandNewToolButton_toggled( bool checked );
117+
118+
void on_mExpandToolButton_clicked( bool checked ) { expandAll(); }
119+
void on_mCollapseToolButton_clicked( bool checked ) { collapseAll(); }
120+
116121
void openUrl( const QUrl &url );
117122

118123
private:

src/ui/qgsidentifyresultsbase.ui

+76-8
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,82 @@
3636
</widget>
3737
</item>
3838
<item>
39-
<widget class="QDialogButtonBox" name="buttonBox">
40-
<property name="standardButtons">
41-
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
42-
</property>
43-
<property name="centerButtons">
44-
<bool>false</bool>
45-
</property>
46-
</widget>
39+
<layout class="QHBoxLayout" name="horizontalLayout">
40+
<item>
41+
<widget class="QToolButton" name="mExpandToolButton">
42+
<property name="toolTip">
43+
<string>Expand tree.</string>
44+
</property>
45+
<property name="text">
46+
<string>...</string>
47+
</property>
48+
<property name="icon">
49+
<iconset>
50+
<normaloff>../../images/themes/default/mActionExpandTree.png</normaloff>../../images/themes/default/mActionExpandTree.png</iconset>
51+
</property>
52+
</widget>
53+
</item>
54+
<item>
55+
<widget class="QToolButton" name="mCollapseToolButton">
56+
<property name="toolTip">
57+
<string>Collapse tree.</string>
58+
</property>
59+
<property name="text">
60+
<string>...</string>
61+
</property>
62+
<property name="icon">
63+
<iconset>
64+
<normaloff>../../images/themes/default/mActionCollapseTree.png</normaloff>../../images/themes/default/mActionCollapseTree.png</iconset>
65+
</property>
66+
</widget>
67+
</item>
68+
<item>
69+
<widget class="QToolButton" name="mExpandNewToolButton">
70+
<property name="toolTip">
71+
<string>New results will be expanded by default.</string>
72+
</property>
73+
<property name="text">
74+
<string>...</string>
75+
</property>
76+
<property name="icon">
77+
<iconset>
78+
<normaloff>../../images/themes/default/mActionExpandNewTree.png</normaloff>../../images/themes/default/mActionExpandNewTree.png</iconset>
79+
</property>
80+
<property name="checkable">
81+
<bool>true</bool>
82+
</property>
83+
</widget>
84+
</item>
85+
<item>
86+
<spacer name="horizontalSpacer">
87+
<property name="orientation">
88+
<enum>Qt::Horizontal</enum>
89+
</property>
90+
<property name="sizeHint" stdset="0">
91+
<size>
92+
<width>40</width>
93+
<height>20</height>
94+
</size>
95+
</property>
96+
</spacer>
97+
</item>
98+
<item>
99+
<widget class="QDialogButtonBox" name="buttonBox">
100+
<property name="sizePolicy">
101+
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
102+
<horstretch>0</horstretch>
103+
<verstretch>0</verstretch>
104+
</sizepolicy>
105+
</property>
106+
<property name="standardButtons">
107+
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
108+
</property>
109+
<property name="centerButtons">
110+
<bool>false</bool>
111+
</property>
112+
</widget>
113+
</item>
114+
</layout>
47115
</item>
48116
</layout>
49117
</widget>

0 commit comments

Comments
 (0)