Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #51323 from elpaso/text-widget
Text widget
- Loading branch information
Showing
17 changed files
with
644 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
python/core/auto_generated/editform/qgsattributeeditortextelement.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/editform/qgsattributeeditortextelement.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsAttributeEditorTextElement : QgsAttributeEditorElement | ||
{ | ||
%Docstring(signature="appended") | ||
An attribute editor widget that will represent arbitrary text code. | ||
|
||
.. versionadded:: 3.30 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsattributeeditortextelement.h" | ||
%End | ||
public: | ||
|
||
QgsAttributeEditorTextElement( const QString &name, QgsAttributeEditorElement *parent ); | ||
%Docstring | ||
Creates a new element which can display text | ||
|
||
:param name: The name of the widget | ||
:param parent: The parent (used as container) | ||
%End | ||
|
||
virtual QgsAttributeEditorElement *clone( QgsAttributeEditorElement *parent ) const /Factory/; | ||
|
||
|
||
QString text() const; | ||
%Docstring | ||
The Text that will be represented within this widget. | ||
%End | ||
|
||
void setText( const QString &text ); | ||
%Docstring | ||
Sets the text that will be represented within this widget to ``text`` | ||
%End | ||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/editform/qgsattributeeditortextelement.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
python/gui/auto_generated/editorwidgets/qgstextwidgetwrapper.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/editorwidgets/qgstextwidgetwrapper.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
class QgsTextWidgetWrapper : QgsWidgetWrapper | ||
{ | ||
%Docstring(signature="appended") | ||
Wraps a label widget to display text | ||
|
||
.. versionadded:: 3.30 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgstextwidgetwrapper.h" | ||
%End | ||
public: | ||
|
||
QgsTextWidgetWrapper( QgsVectorLayer *layer, QWidget *editor, QWidget *parent ); | ||
%Docstring | ||
Create a text widget wrapper | ||
|
||
:param layer: The layer on which the feature is | ||
:param editor: An editor widget. Can be ``None`` if one should be autogenerated. | ||
:param parent: A parent widget | ||
%End | ||
|
||
virtual bool valid() const; | ||
|
||
|
||
virtual QWidget *createWidget( QWidget *parent ); | ||
|
||
|
||
virtual void initWidget( QWidget *editor ); | ||
|
||
|
||
void reinitWidget(); | ||
%Docstring | ||
Clears the content and makes new initialization | ||
%End | ||
|
||
void setText( const QString &text ); | ||
%Docstring | ||
Sets the text code to ``htmlCode`` | ||
%End | ||
|
||
bool needsGeometry() const; | ||
%Docstring | ||
Returns true if the widget needs feature geometry | ||
%End | ||
|
||
public slots: | ||
virtual void setFeature( const QgsFeature &feature ); | ||
|
||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/editorwidgets/qgstextwidgetwrapper.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*************************************************************************** | ||
qgsattributeeditortextelement.cpp - QgsAttributeEditorTextelement | ||
--------------------- | ||
begin : 28.12.2022 | ||
copyright : (C) 2022 by Alessandro Pasotti | ||
email : elpaso at itopen dot it | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#include "qgsattributeeditortextelement.h" | ||
|
||
|
||
QgsAttributeEditorElement *QgsAttributeEditorTextElement::clone( QgsAttributeEditorElement *parent ) const | ||
{ | ||
QgsAttributeEditorTextElement *element = new QgsAttributeEditorTextElement( name(), parent ); | ||
element->setText( mText ); | ||
|
||
return element; | ||
} | ||
|
||
QString QgsAttributeEditorTextElement::text() const | ||
{ | ||
return mText; | ||
} | ||
|
||
void QgsAttributeEditorTextElement::setText( const QString &text ) | ||
{ | ||
mText = text; | ||
} | ||
|
||
void QgsAttributeEditorTextElement::saveConfiguration( QDomElement &elem, QDomDocument &doc ) const | ||
{ | ||
const QDomText textElem = doc.createTextNode( mText ); | ||
elem.appendChild( textElem ); | ||
} | ||
|
||
void QgsAttributeEditorTextElement::loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) | ||
{ | ||
Q_UNUSED( layerId ) | ||
Q_UNUSED( context ) | ||
Q_UNUSED( fields ) | ||
setText( element.text() ); | ||
} | ||
|
||
QString QgsAttributeEditorTextElement::typeIdentifier() const | ||
{ | ||
return QStringLiteral( "attributeEditorTextElement" ); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*************************************************************************** | ||
qgsattributeeditortextelement.h - QgsAttributeEditorTextElement | ||
--------------------- | ||
begin : 28.12.2022 | ||
copyright : (C) 2022 by Alessandro Pasotti | ||
email : elpaso at itopen dot it | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#ifndef QGSATTRIBUTEEDITORTEXTELEMENT_H | ||
#define QGSATTRIBUTEEDITORTEXTELEMENT_H | ||
|
||
#include "qgis_core.h" | ||
#include "qgsattributeeditorelement.h" | ||
|
||
|
||
|
||
/** | ||
* \ingroup core | ||
* \brief An attribute editor widget that will represent arbitrary text code. | ||
* | ||
* \since QGIS 3.30 | ||
*/ | ||
class CORE_EXPORT QgsAttributeEditorTextElement : public QgsAttributeEditorElement | ||
{ | ||
public: | ||
|
||
/** | ||
* Creates a new element which can display text | ||
* | ||
* \param name The name of the widget | ||
* \param parent The parent (used as container) | ||
*/ | ||
QgsAttributeEditorTextElement( const QString &name, QgsAttributeEditorElement *parent ) | ||
: QgsAttributeEditorElement( AeTypeTextElement, name, parent ) | ||
{} | ||
|
||
QgsAttributeEditorElement *clone( QgsAttributeEditorElement *parent ) const override SIP_FACTORY; | ||
|
||
/** | ||
* The Text that will be represented within this widget. | ||
*/ | ||
QString text() const; | ||
|
||
/** | ||
* Sets the text that will be represented within this widget to \a text | ||
*/ | ||
void setText( const QString &text ); | ||
|
||
private: | ||
void saveConfiguration( QDomElement &elem, QDomDocument &doc ) const override; | ||
void loadConfiguration( const QDomElement &element, const QString &layerId, const QgsReadWriteContext &context, const QgsFields &fields ) override; | ||
QString typeIdentifier() const override; | ||
QString mText; | ||
}; | ||
|
||
|
||
#endif // QGSATTRIBUTEEDITORTEXTELEMENT_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.