Skip to content

Commit 9c8ff01

Browse files
author
alexbruy
committedApr 17, 2011
disable Build Pyramids button if no pyramids levels selected. Also reset progressbar state after building pyramids
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15745 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed
 

‎src/app/qgsrasterlayerproperties.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
9191
connect( leBlueMin, SIGNAL( textEdited( QString ) ), this, SLOT( userDefinedMinMax_textEdited( QString ) ) );
9292
connect( leBlueMax, SIGNAL( textEdited( QString ) ), this, SLOT( userDefinedMinMax_textEdited( QString ) ) );
9393
connect( mColormapTreeWidget, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ), this, SLOT( handleColormapTreeWidgetDoubleClick( QTreeWidgetItem*, int ) ) );
94+
// enable or disable Build Pyramids button depending on selection in pyramid list
95+
connect( lbxPyramidResolutions, SIGNAL( itemSelectionChanged() ), this, SLOT( toggleBuildPyramidsButton() ) );
9496

9597
connect( mRasterLayer, SIGNAL( dataChanged( int ) ), this, SLOT( dataChanged( int ) ) );
9698

@@ -1544,6 +1546,8 @@ void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
15441546
cboResamplingMethod->currentText(),
15451547
myBuildInternalFlag );
15461548
QApplication::restoreOverrideCursor();
1549+
mPyramidProgress->setValue( 0 );
1550+
buttonBuildPyramids->setEnabled( false );
15471551
disconnect( mRasterLayer, SIGNAL( progressUpdate( int ) ), mPyramidProgress, SLOT( setValue( int ) ) );
15481552
if ( !res.isNull() )
15491553
{
@@ -3039,4 +3043,17 @@ void QgsRasterLayerProperties::on_btnResetNull_clicked( )
30393043
void QgsRasterLayerProperties::dataChanged( int change )
30403044
{
30413045
QgsDebugMsg( "entered." );
3042-
}
3046+
}
3047+
3048+
void QgsRasterLayerProperties::toggleBuildPyramidsButton()
3049+
{
3050+
if ( lbxPyramidResolutions->selectedItems().empty() )
3051+
{
3052+
buttonBuildPyramids->setEnabled( false );
3053+
}
3054+
else
3055+
{
3056+
buttonBuildPyramids->setEnabled( true );
3057+
}
3058+
}
3059+

‎src/app/qgsrasterlayerproperties.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ class QgsRasterLayerProperties : public QDialog, private Ui::QgsRasterLayerPrope
149149
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
150150
/** This slot lets you save the histogram as an image to disk */
151151
void on_mSaveAsImageButton_clicked();
152+
/**Enable or disable Build pyramids button depending on selection in pyramids list*/
153+
void toggleBuildPyramidsButton();
152154

153155
signals:
154156

‎src/ui/qgsrasterlayerpropertiesbase.ui

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,6 +1846,9 @@ p, li { white-space: pre-wrap; }
18461846
</item>
18471847
<item row="3" column="4">
18481848
<widget class="QPushButton" name="buttonBuildPyramids">
1849+
<property name="enabled">
1850+
<bool>false</bool>
1851+
</property>
18491852
<property name="text">
18501853
<string>Build pyramids</string>
18511854
</property>

0 commit comments

Comments
 (0)
Please sign in to comment.