mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Rename methods in QgsPanelWidgetStack for consistency
This commit is contained in:
parent
3b0486cc6e
commit
fbdc414957
@ -1090,6 +1090,14 @@ be used instead of a null pointer if no transformation is required.</li>
|
||||
<li>prepareGeometry() and geometryRequiresPreparation() now take a QgsCoordinateTransform reference, not a pointer. An invalid QgsCoordinateTransform should be used instead of a null pointer if no transformation is required.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsPanelWidgetStack QgsPanelWidgetStack
|
||||
|
||||
<ul>
|
||||
<li>addMainPanel() has been renamed to setMainPanel()</li>
|
||||
<li>mainWidget() has been renamed to mainPanel()</li>
|
||||
<li>takeMainWidget() has been renamed to takeMainPanel()</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsPluginLayer QgsPluginLayer
|
||||
|
||||
<ul>
|
||||
|
@ -19,26 +19,33 @@ class QgsPanelWidgetStack: public QWidget
|
||||
QgsPanelWidgetStack( QWidget* parent = nullptr );
|
||||
|
||||
/**
|
||||
* Adds the main widget to the stack and selects it for the user
|
||||
* Adds the main panel widget to the stack and selects it for the user
|
||||
* The main widget can not be closed and only the showPanel signal is attached
|
||||
* to handle children widget opening panels.
|
||||
* @param panel The panel to set as the first widget in the stack.
|
||||
* @note a stack can have only one main panel. Any existing main panel
|
||||
* should be removed by first calling takeMainPanel().
|
||||
* @see mainPanel()
|
||||
* @see takeMainPanel()
|
||||
*/
|
||||
void addMainPanel( QgsPanelWidget* panel );
|
||||
void setMainPanel( QgsPanelWidget* panel );
|
||||
|
||||
/**
|
||||
* The main widget that is set in the stack. The main widget can not be closed
|
||||
* The main panel widget that is set in the stack. The main widget can not be closed
|
||||
* and doesn't display a back button.
|
||||
* @return The main QgsPanelWidget that is active in the stack.
|
||||
* @see setMainPanel()
|
||||
*/
|
||||
QgsPanelWidget* mainWidget();
|
||||
QgsPanelWidget* mainPanel();
|
||||
|
||||
/**
|
||||
* Removes the main widget from the stack and transfers ownsership to the
|
||||
* Removes the main panel widget from the stack and transfers ownsership to the
|
||||
* caller.
|
||||
* @return The main widget that is set in the stack.
|
||||
* @see mainPanel()
|
||||
* @see setMainPanel()
|
||||
*/
|
||||
QgsPanelWidget* takeMainWidget();
|
||||
QgsPanelWidget* takeMainPanel();
|
||||
|
||||
/**
|
||||
* Clear the stack of all widgets. Unless the panels autoDelete is set to false
|
||||
|
@ -226,7 +226,7 @@ void QgsLayerStylingWidget::apply()
|
||||
|
||||
QString undoName = "Style Change";
|
||||
|
||||
QWidget* current = mWidgetStack->mainWidget();
|
||||
QWidget* current = mWidgetStack->mainPanel();
|
||||
|
||||
bool styleWasChanged = false;
|
||||
if ( QgsLabelingWidget* widget = qobject_cast<QgsLabelingWidget*>( current ) )
|
||||
@ -307,7 +307,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
||||
|
||||
mStackedWidget->setCurrentIndex( mLayerPage );
|
||||
|
||||
QgsPanelWidget* current = mWidgetStack->takeMainWidget();
|
||||
QgsPanelWidget* current = mWidgetStack->takeMainPanel();
|
||||
if ( current )
|
||||
{
|
||||
if ( QgsLabelingWidget* widget = qobject_cast<QgsLabelingWidget*>( current ) )
|
||||
@ -334,15 +334,14 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
||||
if ( panel )
|
||||
{
|
||||
connect( panel, SIGNAL( widgetChanged( QgsPanelWidget* ) ), this, SLOT( autoApply() ) );
|
||||
panel->setDockMode( true );
|
||||
mWidgetStack->addMainPanel( panel );
|
||||
mWidgetStack->setMainPanel( panel );
|
||||
}
|
||||
}
|
||||
|
||||
// The last widget is always the undo stack.
|
||||
if ( row == mOptionsListWidget->count() - 1 )
|
||||
{
|
||||
mWidgetStack->addMainPanel( mUndoWidget );
|
||||
mWidgetStack->setMainPanel( mUndoWidget );
|
||||
}
|
||||
else if ( mCurrentLayer->type() == QgsMapLayer::VectorLayer )
|
||||
{
|
||||
@ -359,7 +358,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
||||
QgsPanelWidgetWrapper* wrapper = new QgsPanelWidgetWrapper( styleWidget, mStackedWidget );
|
||||
wrapper->setDockMode( true );
|
||||
connect( styleWidget, SIGNAL( showPanel( QgsPanelWidget* ) ), wrapper, SLOT( openPanel( QgsPanelWidget* ) ) );
|
||||
mWidgetStack->addMainPanel( wrapper );
|
||||
mWidgetStack->setMainPanel( wrapper );
|
||||
break;
|
||||
}
|
||||
case 1: // Labels
|
||||
@ -371,7 +370,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
||||
connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
||||
}
|
||||
mLabelingWidget->setLayer( vlayer );
|
||||
mWidgetStack->addMainPanel( mLabelingWidget );
|
||||
mWidgetStack->setMainPanel( mLabelingWidget );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -388,14 +387,14 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
||||
mRasterStyleWidget = new QgsRendererRasterPropertiesWidget( rlayer, mMapCanvas, mWidgetStack );
|
||||
mRasterStyleWidget->setDockMode( true );
|
||||
connect( mRasterStyleWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
||||
mWidgetStack->addMainPanel( mRasterStyleWidget );
|
||||
mWidgetStack->setMainPanel( mRasterStyleWidget );
|
||||
break;
|
||||
case 1: // Transparency
|
||||
{
|
||||
QgsRasterTransparencyWidget* transwidget = new QgsRasterTransparencyWidget( rlayer, mMapCanvas, mWidgetStack );
|
||||
transwidget->setDockMode( true );
|
||||
connect( transwidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
||||
mWidgetStack->addMainPanel( transwidget );
|
||||
mWidgetStack->setMainPanel( transwidget );
|
||||
break;
|
||||
}
|
||||
case 2: // Histogram
|
||||
@ -417,7 +416,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
||||
widget->setRendererWidget( name, mRasterStyleWidget->currentRenderWidget() );
|
||||
widget->setDockMode( true );
|
||||
|
||||
mWidgetStack->addMainPanel( widget );
|
||||
mWidgetStack->setMainPanel( widget );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ QgsPanelWidgetStack::QgsPanelWidgetStack( QWidget *parent )
|
||||
connect( mBackButton, SIGNAL( pressed() ), this, SLOT( acceptCurrentPanel() ) );
|
||||
}
|
||||
|
||||
void QgsPanelWidgetStack::addMainPanel( QgsPanelWidget *panel )
|
||||
void QgsPanelWidgetStack::setMainPanel( QgsPanelWidget *panel )
|
||||
{
|
||||
// TODO Don't allow adding another main widget or else that would be strange for the user.
|
||||
connect( panel, SIGNAL( showPanel( QgsPanelWidget* ) ), this, SLOT( showPanel( QgsPanelWidget* ) ),
|
||||
@ -43,12 +43,12 @@ void QgsPanelWidgetStack::addMainPanel( QgsPanelWidget *panel )
|
||||
mStackedWidget->setCurrentIndex( 0 );
|
||||
}
|
||||
|
||||
QgsPanelWidget *QgsPanelWidgetStack::mainWidget()
|
||||
QgsPanelWidget *QgsPanelWidgetStack::mainPanel()
|
||||
{
|
||||
return qobject_cast<QgsPanelWidget*>( mStackedWidget->widget( 0 ) );
|
||||
}
|
||||
|
||||
QgsPanelWidget *QgsPanelWidgetStack::takeMainWidget()
|
||||
QgsPanelWidget *QgsPanelWidgetStack::takeMainPanel()
|
||||
{
|
||||
QWidget* widget = mStackedWidget->widget( 0 );
|
||||
mStackedWidget->removeWidget( widget );
|
||||
|
@ -43,26 +43,33 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
|
||||
QgsPanelWidgetStack( QWidget* parent = nullptr );
|
||||
|
||||
/**
|
||||
* Adds the main widget to the stack and selects it for the user
|
||||
* Adds the main panel widget to the stack and selects it for the user
|
||||
* The main widget can not be closed and only the showPanel signal is attached
|
||||
* to handle children widget opening panels.
|
||||
* @param panel The panel to set as the first widget in the stack.
|
||||
* @note a stack can have only one main panel. Any existing main panel
|
||||
* should be removed by first calling takeMainPanel().
|
||||
* @see mainPanel()
|
||||
* @see takeMainPanel()
|
||||
*/
|
||||
void addMainPanel( QgsPanelWidget* panel );
|
||||
void setMainPanel( QgsPanelWidget* panel );
|
||||
|
||||
/**
|
||||
* The main widget that is set in the stack. The main widget can not be closed
|
||||
* The main panel widget that is set in the stack. The main widget can not be closed
|
||||
* and doesn't display a back button.
|
||||
* @return The main QgsPanelWidget that is active in the stack.
|
||||
* @see setMainPanel()
|
||||
*/
|
||||
QgsPanelWidget* mainWidget();
|
||||
QgsPanelWidget* mainPanel();
|
||||
|
||||
/**
|
||||
* Removes the main widget from the stack and transfers ownsership to the
|
||||
* Removes the main panel widget from the stack and transfers ownsership to the
|
||||
* caller.
|
||||
* @return The main widget that is set in the stack.
|
||||
* @see mainPanel()
|
||||
* @see setMainPanel()
|
||||
*/
|
||||
QgsPanelWidget* takeMainWidget();
|
||||
QgsPanelWidget* takeMainPanel();
|
||||
|
||||
/**
|
||||
* Clear the stack of all widgets. Unless the panels autoDelete is set to false
|
||||
|
Loading…
x
Reference in New Issue
Block a user