mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
QgsSymbolSelector{Widget,Dialog} class cleanup
This commit is contained in:
parent
648af3ed89
commit
d26b7abc57
@ -72,52 +72,6 @@ Returns the symbol that is currently active in the widget. Can be ``None``.
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void loadSymbol();
|
|
||||||
%Docstring
|
|
||||||
Reload the current symbol in the view.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void updateUi();
|
|
||||||
%Docstring
|
|
||||||
Update the state of the UI based on the currently set symbol layer.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void updateLockButton();
|
|
||||||
%Docstring
|
|
||||||
Update the lock button states based on the current symbol layer.
|
|
||||||
%End
|
|
||||||
|
|
||||||
|
|
||||||
QgsSymbolLayer *currentLayer();
|
|
||||||
%Docstring
|
|
||||||
The current symbol layer that is active in the interface.
|
|
||||||
|
|
||||||
:return: The active symbol layer.
|
|
||||||
%End
|
|
||||||
|
|
||||||
void moveLayerByOffset( int offset );
|
|
||||||
%Docstring
|
|
||||||
Move the current active layer by a set offset in the list.
|
|
||||||
|
|
||||||
:param offset: The offset to move the layer by
|
|
||||||
%End
|
|
||||||
|
|
||||||
void setWidget( QWidget *widget );
|
|
||||||
%Docstring
|
|
||||||
Set the properties widget for the active symbol layer.
|
|
||||||
|
|
||||||
:param widget: The widget to set to configure the active symbol layer.
|
|
||||||
%End
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
void symbolModified();
|
|
||||||
%Docstring
|
|
||||||
Emiited when a symbol is modified in the widget.
|
|
||||||
%End
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void moveLayerDown();
|
void moveLayerDown();
|
||||||
@ -179,9 +133,12 @@ alters tree and sets proper widget when Layer Type is changed
|
|||||||
\note: The layer is received from the LayerPropertiesWidget
|
\note: The layer is received from the LayerPropertiesWidget
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
protected: // data
|
void symbolModified();
|
||||||
|
%Docstring
|
||||||
|
Emiited when a symbol is modified in the widget.
|
||||||
|
%End
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -236,6 +193,7 @@ Returns the symbol that is currently active in the widget. Can be ``None``.
|
|||||||
:return: The active symbol.
|
:return: The active symbol.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
|
||||||
QDialogButtonBox *buttonBox() const;
|
QDialogButtonBox *buttonBox() const;
|
||||||
%Docstring
|
%Docstring
|
||||||
Returns a reference to the dialog's button box.
|
Returns a reference to the dialog's button box.
|
||||||
@ -243,27 +201,8 @@ Returns a reference to the dialog's button box.
|
|||||||
.. versionadded:: 3.10
|
.. versionadded:: 3.10
|
||||||
%End
|
%End
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void keyPressEvent( QKeyEvent *e );
|
|
||||||
|
|
||||||
|
|
||||||
void loadSymbol();
|
|
||||||
|
|
||||||
|
|
||||||
void updateUi();
|
|
||||||
|
|
||||||
void updateLockButton();
|
|
||||||
|
|
||||||
QgsSymbolLayer *currentLayer();
|
|
||||||
|
|
||||||
void moveLayerByOffset( int offset );
|
|
||||||
|
|
||||||
void setWidget( QWidget *widget );
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void symbolModified();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void moveLayerDown();
|
void moveLayerDown();
|
||||||
void moveLayerUp();
|
void moveLayerUp();
|
||||||
|
|
||||||
@ -295,6 +234,15 @@ alters tree and sets proper widget when Layer Type is changed
|
|||||||
\note: The layer is received from the LayerPropertiesWidget
|
\note: The layer is received from the LayerPropertiesWidget
|
||||||
%End
|
%End
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void keyPressEvent( QKeyEvent *e );
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void symbolModified();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -414,7 +414,7 @@ void QgsSymbolSelectorWidget::loadSymbol( QgsSymbol *symbol, SymbolLayerItem *pa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void QgsSymbolSelectorWidget::loadSymbol()
|
void QgsSymbolSelectorWidget::reloadSymbol()
|
||||||
{
|
{
|
||||||
model->clear();
|
model->clear();
|
||||||
loadSymbol( mSymbol, static_cast<SymbolLayerItem *>( model->invisibleRootItem() ) );
|
loadSymbol( mSymbol, static_cast<SymbolLayerItem *>( model->invisibleRootItem() ) );
|
||||||
@ -553,7 +553,7 @@ void QgsSymbolSelectorWidget::symbolChanged()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//it is the symbol itself
|
//it is the symbol itself
|
||||||
loadSymbol();
|
reloadSymbol();
|
||||||
QModelIndex newIndex = layersTree->model()->index( 0, 0 );
|
QModelIndex newIndex = layersTree->model()->index( 0, 0 );
|
||||||
layersTree->setCurrentIndex( newIndex );
|
layersTree->setCurrentIndex( newIndex );
|
||||||
}
|
}
|
||||||
@ -824,9 +824,9 @@ void QgsSymbolSelectorDialog::keyPressEvent( QKeyEvent *e )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsSymbolSelectorDialog::loadSymbol()
|
void QgsSymbolSelectorDialog::reloadSymbol()
|
||||||
{
|
{
|
||||||
mSelectorWidget->loadSymbol();
|
mSelectorWidget->reloadSymbol();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsSymbolSelectorDialog::loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent )
|
void QgsSymbolSelectorDialog::loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent )
|
||||||
|
@ -128,58 +128,12 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
|||||||
QgsSymbol *symbol() { return mSymbol; }
|
QgsSymbol *symbol() { return mSymbol; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the given symbol into the widget.
|
* Loads the given symbol into the widget.
|
||||||
* \param symbol The symbol to load.
|
* \param symbol The symbol to load.
|
||||||
* \param parent The parent symbol layer item. If the parent parameter is null, the whole symbol and model will be reset.
|
* \param parent The parent symbol layer item. If the parent parameter is null, the whole symbol and model will be reset.
|
||||||
* \note not available in Python bindings
|
|
||||||
*/
|
*/
|
||||||
void loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent = nullptr ) SIP_SKIP;
|
void loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent = nullptr ) SIP_SKIP;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reload the current symbol in the view.
|
|
||||||
*/
|
|
||||||
void loadSymbol();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the state of the UI based on the currently set symbol layer.
|
|
||||||
*/
|
|
||||||
void updateUi();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update the lock button states based on the current symbol layer.
|
|
||||||
*/
|
|
||||||
void updateLockButton();
|
|
||||||
|
|
||||||
//! \note not available in Python bindings
|
|
||||||
SymbolLayerItem *currentLayerItem() SIP_SKIP;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The current symbol layer that is active in the interface.
|
|
||||||
* \returns The active symbol layer.
|
|
||||||
*/
|
|
||||||
QgsSymbolLayer *currentLayer();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Move the current active layer by a set offset in the list.
|
|
||||||
* \param offset The offset to move the layer by
|
|
||||||
*/
|
|
||||||
void moveLayerByOffset( int offset );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the properties widget for the active symbol layer.
|
|
||||||
* \param widget The widget to set to configure the active symbol layer.
|
|
||||||
*/
|
|
||||||
void setWidget( QWidget *widget );
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emiited when a symbol is modified in the widget.
|
|
||||||
*/
|
|
||||||
void symbolModified();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -238,8 +192,50 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
|||||||
*/
|
*/
|
||||||
void changeLayer( QgsSymbolLayer *layer );
|
void changeLayer( QgsSymbolLayer *layer );
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emiited when a symbol is modified in the widget.
|
||||||
|
*/
|
||||||
|
void symbolModified();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload the current symbol in the view.
|
||||||
|
*/
|
||||||
|
void reloadSymbol();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the state of the UI based on the currently set symbol layer.
|
||||||
|
*/
|
||||||
|
void updateUi();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the lock button states based on the current symbol layer.
|
||||||
|
*/
|
||||||
|
void updateLockButton();
|
||||||
|
|
||||||
|
SymbolLayerItem *currentLayerItem();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current symbol layer that is active in the interface.
|
||||||
|
* \returns The active symbol layer.
|
||||||
|
*/
|
||||||
|
QgsSymbolLayer *currentLayer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the current active layer by a set offset in the list.
|
||||||
|
* \param offset The offset to move the layer by
|
||||||
|
*/
|
||||||
|
void moveLayerByOffset( int offset );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the properties widget for the active symbol layer.
|
||||||
|
* \param widget The widget to set to configure the active symbol layer.
|
||||||
|
*/
|
||||||
|
void setWidget( QWidget *widget );
|
||||||
|
|
||||||
protected: // data
|
|
||||||
QgsStyle *mStyle = nullptr;
|
QgsStyle *mStyle = nullptr;
|
||||||
QgsSymbol *mSymbol = nullptr;
|
QgsSymbol *mSymbol = nullptr;
|
||||||
QMenu *mAdvancedMenu = nullptr;
|
QMenu *mAdvancedMenu = nullptr;
|
||||||
@ -248,7 +244,6 @@ class GUI_EXPORT QgsSymbolSelectorWidget: public QgsPanelWidget, private Ui::Qgs
|
|||||||
QStandardItemModel *model = nullptr;
|
QStandardItemModel *model = nullptr;
|
||||||
QWidget *mPresentWidget = nullptr;
|
QWidget *mPresentWidget = nullptr;
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<DataDefinedRestorer> mDataDefineRestorer;
|
std::unique_ptr<DataDefinedRestorer> mDataDefineRestorer;
|
||||||
QgsSymbolWidgetContext mContext;
|
QgsSymbolWidgetContext mContext;
|
||||||
QgsFeature mPreviewFeature;
|
QgsFeature mPreviewFeature;
|
||||||
@ -302,37 +297,21 @@ class GUI_EXPORT QgsSymbolSelectorDialog : public QDialog
|
|||||||
*/
|
*/
|
||||||
QgsSymbol *symbol();
|
QgsSymbol *symbol();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the given symbol into the widget.
|
||||||
|
* \param symbol The symbol to load.
|
||||||
|
* \param parent The parent symbol layer item. If the parent parameter is null, the whole symbol and model will be reset.
|
||||||
|
*/
|
||||||
|
void loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent = nullptr ) SIP_SKIP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a reference to the dialog's button box.
|
* Returns a reference to the dialog's button box.
|
||||||
* \since QGIS 3.10
|
* \since QGIS 3.10
|
||||||
*/
|
*/
|
||||||
QDialogButtonBox *buttonBox() const;
|
QDialogButtonBox *buttonBox() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
// Reimplements dialog keyPress event so we can ignore it
|
|
||||||
void keyPressEvent( QKeyEvent *e ) override;
|
|
||||||
|
|
||||||
void loadSymbol();
|
|
||||||
|
|
||||||
//! \note not available in Python bindings
|
|
||||||
void loadSymbol( QgsSymbol *symbol, SymbolLayerItem *parent ) SIP_SKIP;
|
|
||||||
|
|
||||||
void updateUi();
|
|
||||||
|
|
||||||
void updateLockButton();
|
|
||||||
|
|
||||||
//! \note not available in Python bindings
|
|
||||||
SymbolLayerItem *currentLayerItem() SIP_SKIP;
|
|
||||||
QgsSymbolLayer *currentLayer();
|
|
||||||
|
|
||||||
void moveLayerByOffset( int offset );
|
|
||||||
|
|
||||||
void setWidget( QWidget *widget );
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void symbolModified();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
void moveLayerDown();
|
void moveLayerDown();
|
||||||
void moveLayerUp();
|
void moveLayerUp();
|
||||||
|
|
||||||
@ -361,13 +340,39 @@ class GUI_EXPORT QgsSymbolSelectorDialog : public QDialog
|
|||||||
*/
|
*/
|
||||||
void changeLayer( QgsSymbolLayer *layer );
|
void changeLayer( QgsSymbolLayer *layer );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Reimplements dialog keyPress event so we can ignore it
|
||||||
|
void keyPressEvent( QKeyEvent *e ) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void showHelp();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void symbolModified();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
void reloadSymbol();
|
||||||
|
|
||||||
|
void updateUi();
|
||||||
|
|
||||||
|
void updateLockButton();
|
||||||
|
|
||||||
|
SymbolLayerItem *currentLayerItem();
|
||||||
|
|
||||||
|
QgsSymbolLayer *currentLayer();
|
||||||
|
|
||||||
|
void moveLayerByOffset( int offset );
|
||||||
|
|
||||||
|
void setWidget( QWidget *widget );
|
||||||
|
|
||||||
QgsSymbolSelectorWidget *mSelectorWidget = nullptr;
|
QgsSymbolSelectorWidget *mSelectorWidget = nullptr;
|
||||||
QDialogButtonBox *mButtonBox = nullptr;
|
QDialogButtonBox *mButtonBox = nullptr;
|
||||||
QgsSymbolWidgetContext mContext;
|
QgsSymbolWidgetContext mContext;
|
||||||
|
|
||||||
private slots:
|
|
||||||
void showHelp();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user