Skip to content

Commit

Permalink
Don't allow "fixed time range per band" when raster has multi-band sy…
Browse files Browse the repository at this point in the history
…mbology

Fixes #59777

Just like the equivalent fixed-elevation-range per band mode for
elevation, this temporal setting ONLY makes sense when the renderer
is a single-band renderer.
  • Loading branch information
nyalldawson committed Dec 11, 2024
1 parent 1dd6a4a commit 99fc870
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 57 deletions.
9 changes: 9 additions & 0 deletions src/gui/raster/qgsrasterlayertemporalpropertieswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "qgsexpressionbuilderdialog.h"
#include "qgsexpressioncontextutils.h"
#include "qgsunittypes.h"
#include "qgsapplication.h"
#include "qgsrasterrendererregistry.h"
#include "qgsrasterrenderer.h"

#include <QMenu>
#include <QAction>
Expand Down Expand Up @@ -155,6 +158,12 @@ void QgsRasterLayerTemporalPropertiesWidget::syncToLayer()
break;
}

if ( mLayer->renderer() && QgsApplication::rasterRendererRegistry()->rendererCapabilities( mLayer->renderer()->type() ) & Qgis::RasterRendererCapability::UsesMultipleBands )
{
mWidgetFixedRangePerBand->hide();
mFixedRangePerBandLabel->setText( tr( "This mode cannot be used with a multi-band renderer." ) );
}

mBandComboBox->setLayer( mLayer );
mBandComboBox->setBand( temporalProperties->bandNumber() );

Expand Down
125 changes: 68 additions & 57 deletions src/ui/raster/qgsrasterlayertemporalpropertieswidgetbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,6 @@ background: white;QgsCollapsibleGroupBoxBasic::title, QgsCollapsibleGroupBox::ti
</sizepolicy>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="0">
<widget class="QTableView" name="mBandRangesTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mFixedRangePerBandLabel">
<property name="sizePolicy">
Expand All @@ -246,55 +236,76 @@ background: white;QgsCollapsibleGroupBoxBasic::title, QgsCollapsibleGroupBox::ti
</property>
</widget>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="mCalculateFixedRangePerBandButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mIconExpression.svg</normaloff>:/images/themes/default/mIconExpression.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<item row="1" column="0">
<widget class="QWidget" name="mWidgetFixedRangePerBand" native="true">
<property name="minimumSize">
<size>
<width>40</width>
<height>20</height>
<width>0</width>
<height>33</height>
</size>
</property>
</spacer>
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTableView" name="mBandRangesTable">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="mCalculateFixedRangePerBandButton">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../../../images/images.qrc">
<normaloff>:/images/themes/default/mIconExpression.svg</normaloff>:/images/themes/default/mIconExpression.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::MenuButtonPopup</enum>
</property>
<property name="autoRaise">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
Expand Down Expand Up @@ -365,7 +376,7 @@ background: white;QgsCollapsibleGroupBoxBasic::title, QgsCollapsibleGroupBox::ti
<string/>
</property>
</widget>
</item>
</item>
</layout>
</item>
<item row="0" column="0" colspan="2">
Expand Down

0 comments on commit 99fc870

Please sign in to comment.