mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04: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>
|
<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>
|
</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
|
\subsection qgis_api_break_3_0_QgsPluginLayer QgsPluginLayer
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -19,26 +19,33 @@ class QgsPanelWidgetStack: public QWidget
|
|||||||
QgsPanelWidgetStack( QWidget* parent = nullptr );
|
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
|
* The main widget can not be closed and only the showPanel signal is attached
|
||||||
* to handle children widget opening panels.
|
* to handle children widget opening panels.
|
||||||
* @param panel The panel to set as the first widget in the stack.
|
* @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.
|
* and doesn't display a back button.
|
||||||
* @return The main QgsPanelWidget that is active in the stack.
|
* @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.
|
* caller.
|
||||||
* @return The main widget that is set in the stack.
|
* @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
|
* 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";
|
QString undoName = "Style Change";
|
||||||
|
|
||||||
QWidget* current = mWidgetStack->mainWidget();
|
QWidget* current = mWidgetStack->mainPanel();
|
||||||
|
|
||||||
bool styleWasChanged = false;
|
bool styleWasChanged = false;
|
||||||
if ( QgsLabelingWidget* widget = qobject_cast<QgsLabelingWidget*>( current ) )
|
if ( QgsLabelingWidget* widget = qobject_cast<QgsLabelingWidget*>( current ) )
|
||||||
@ -307,7 +307,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
|||||||
|
|
||||||
mStackedWidget->setCurrentIndex( mLayerPage );
|
mStackedWidget->setCurrentIndex( mLayerPage );
|
||||||
|
|
||||||
QgsPanelWidget* current = mWidgetStack->takeMainWidget();
|
QgsPanelWidget* current = mWidgetStack->takeMainPanel();
|
||||||
if ( current )
|
if ( current )
|
||||||
{
|
{
|
||||||
if ( QgsLabelingWidget* widget = qobject_cast<QgsLabelingWidget*>( current ) )
|
if ( QgsLabelingWidget* widget = qobject_cast<QgsLabelingWidget*>( current ) )
|
||||||
@ -334,15 +334,14 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
|||||||
if ( panel )
|
if ( panel )
|
||||||
{
|
{
|
||||||
connect( panel, SIGNAL( widgetChanged( QgsPanelWidget* ) ), this, SLOT( autoApply() ) );
|
connect( panel, SIGNAL( widgetChanged( QgsPanelWidget* ) ), this, SLOT( autoApply() ) );
|
||||||
panel->setDockMode( true );
|
mWidgetStack->setMainPanel( panel );
|
||||||
mWidgetStack->addMainPanel( panel );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The last widget is always the undo stack.
|
// The last widget is always the undo stack.
|
||||||
if ( row == mOptionsListWidget->count() - 1 )
|
if ( row == mOptionsListWidget->count() - 1 )
|
||||||
{
|
{
|
||||||
mWidgetStack->addMainPanel( mUndoWidget );
|
mWidgetStack->setMainPanel( mUndoWidget );
|
||||||
}
|
}
|
||||||
else if ( mCurrentLayer->type() == QgsMapLayer::VectorLayer )
|
else if ( mCurrentLayer->type() == QgsMapLayer::VectorLayer )
|
||||||
{
|
{
|
||||||
@ -359,7 +358,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
|||||||
QgsPanelWidgetWrapper* wrapper = new QgsPanelWidgetWrapper( styleWidget, mStackedWidget );
|
QgsPanelWidgetWrapper* wrapper = new QgsPanelWidgetWrapper( styleWidget, mStackedWidget );
|
||||||
wrapper->setDockMode( true );
|
wrapper->setDockMode( true );
|
||||||
connect( styleWidget, SIGNAL( showPanel( QgsPanelWidget* ) ), wrapper, SLOT( openPanel( QgsPanelWidget* ) ) );
|
connect( styleWidget, SIGNAL( showPanel( QgsPanelWidget* ) ), wrapper, SLOT( openPanel( QgsPanelWidget* ) ) );
|
||||||
mWidgetStack->addMainPanel( wrapper );
|
mWidgetStack->setMainPanel( wrapper );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1: // Labels
|
case 1: // Labels
|
||||||
@ -371,7 +370,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
|||||||
connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
connect( mLabelingWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
||||||
}
|
}
|
||||||
mLabelingWidget->setLayer( vlayer );
|
mLabelingWidget->setLayer( vlayer );
|
||||||
mWidgetStack->addMainPanel( mLabelingWidget );
|
mWidgetStack->setMainPanel( mLabelingWidget );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -388,14 +387,14 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
|||||||
mRasterStyleWidget = new QgsRendererRasterPropertiesWidget( rlayer, mMapCanvas, mWidgetStack );
|
mRasterStyleWidget = new QgsRendererRasterPropertiesWidget( rlayer, mMapCanvas, mWidgetStack );
|
||||||
mRasterStyleWidget->setDockMode( true );
|
mRasterStyleWidget->setDockMode( true );
|
||||||
connect( mRasterStyleWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
connect( mRasterStyleWidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
||||||
mWidgetStack->addMainPanel( mRasterStyleWidget );
|
mWidgetStack->setMainPanel( mRasterStyleWidget );
|
||||||
break;
|
break;
|
||||||
case 1: // Transparency
|
case 1: // Transparency
|
||||||
{
|
{
|
||||||
QgsRasterTransparencyWidget* transwidget = new QgsRasterTransparencyWidget( rlayer, mMapCanvas, mWidgetStack );
|
QgsRasterTransparencyWidget* transwidget = new QgsRasterTransparencyWidget( rlayer, mMapCanvas, mWidgetStack );
|
||||||
transwidget->setDockMode( true );
|
transwidget->setDockMode( true );
|
||||||
connect( transwidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
connect( transwidget, SIGNAL( widgetChanged() ), this, SLOT( autoApply() ) );
|
||||||
mWidgetStack->addMainPanel( transwidget );
|
mWidgetStack->setMainPanel( transwidget );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 2: // Histogram
|
case 2: // Histogram
|
||||||
@ -417,7 +416,7 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
|
|||||||
widget->setRendererWidget( name, mRasterStyleWidget->currentRenderWidget() );
|
widget->setRendererWidget( name, mRasterStyleWidget->currentRenderWidget() );
|
||||||
widget->setDockMode( true );
|
widget->setDockMode( true );
|
||||||
|
|
||||||
mWidgetStack->addMainPanel( widget );
|
mWidgetStack->setMainPanel( widget );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ QgsPanelWidgetStack::QgsPanelWidgetStack( QWidget *parent )
|
|||||||
connect( mBackButton, SIGNAL( pressed() ), this, SLOT( acceptCurrentPanel() ) );
|
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.
|
// 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* ) ),
|
connect( panel, SIGNAL( showPanel( QgsPanelWidget* ) ), this, SLOT( showPanel( QgsPanelWidget* ) ),
|
||||||
@ -43,12 +43,12 @@ void QgsPanelWidgetStack::addMainPanel( QgsPanelWidget *panel )
|
|||||||
mStackedWidget->setCurrentIndex( 0 );
|
mStackedWidget->setCurrentIndex( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPanelWidget *QgsPanelWidgetStack::mainWidget()
|
QgsPanelWidget *QgsPanelWidgetStack::mainPanel()
|
||||||
{
|
{
|
||||||
return qobject_cast<QgsPanelWidget*>( mStackedWidget->widget( 0 ) );
|
return qobject_cast<QgsPanelWidget*>( mStackedWidget->widget( 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsPanelWidget *QgsPanelWidgetStack::takeMainWidget()
|
QgsPanelWidget *QgsPanelWidgetStack::takeMainPanel()
|
||||||
{
|
{
|
||||||
QWidget* widget = mStackedWidget->widget( 0 );
|
QWidget* widget = mStackedWidget->widget( 0 );
|
||||||
mStackedWidget->removeWidget( widget );
|
mStackedWidget->removeWidget( widget );
|
||||||
|
@ -43,26 +43,33 @@ class GUI_EXPORT QgsPanelWidgetStack : public QWidget, private Ui::QgsRendererWi
|
|||||||
QgsPanelWidgetStack( QWidget* parent = nullptr );
|
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
|
* The main widget can not be closed and only the showPanel signal is attached
|
||||||
* to handle children widget opening panels.
|
* to handle children widget opening panels.
|
||||||
* @param panel The panel to set as the first widget in the stack.
|
* @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.
|
* and doesn't display a back button.
|
||||||
* @return The main QgsPanelWidget that is active in the stack.
|
* @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.
|
* caller.
|
||||||
* @return The main widget that is set in the stack.
|
* @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
|
* Clear the stack of all widgets. Unless the panels autoDelete is set to false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user