New name, for example new layer name dialog.
More...
#include <qgsnewnamedialog.h>
|
| QgsNewNameDialog (const QString &source=QString(), const QString &initial=QString(), const QStringList &extensions=QStringList(), const QStringList &existing=QStringList(), Qt::CaseSensitivity cs=Qt::CaseSensitive, QWidget *parent=nullptr, Qt::WindowFlags flags=QgsGuiUtils::ModalDialogFlags) |
| New dialog constructor. More...
|
|
bool | allowEmptyName () const |
| Returns true if the widget can be left empty (no name filled). More...
|
|
QString | conflictingNameWarning () const |
| Returns the string used for warning users if a conflicting name exists. More...
|
|
QString | hintString () const |
| Returns the hint string for the dialog (the text shown above the name input box). More...
|
|
QString | name () const |
| Name entered by user. More...
|
|
bool | overwriteEnabled () const |
| Returns whether users are permitted to overwrite existing names. More...
|
|
void | setAllowEmptyName (bool allowed) |
| Sets whether users are permitted to leave the widget empty. More...
|
|
void | setConflictingNameWarning (const QString &string) |
| Sets the string used for warning users if a conflicting name exists. More...
|
|
void | setHintString (const QString &hintString) |
| Sets the hint string for the dialog (the text shown above the name input box). More...
|
|
void | setOverwriteEnabled (bool enabled) |
| Sets whether users are permitted to overwrite existing names. More...
|
|
void | setRegularExpression (const QString &expression) |
| Sets a regular expression to use for validating user-entered names in the dialog. More...
|
|
| QgsDialog (QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags, QDialogButtonBox::StandardButtons buttons=QDialogButtonBox::Close, Qt::Orientation orientation=Qt::Horizontal) |
| Constructor for QgsDialog. More...
|
|
QDialogButtonBox * | buttonBox () |
| Returns the button box. More...
|
|
QVBoxLayout * | layout () |
| Returns the central layout. Widgets added to it must have this dialog as parent. More...
|
|
|
static bool | exists (const QString &name, const QStringList &extensions, const QStringList &existing, Qt::CaseSensitivity cs=Qt::CaseSensitive) |
| Test if name or name with at least one extension exists. More...
|
|
|
static QStringList | fullNames (const QString &name, const QStringList &extensions) |
|
static QStringList | matching (const QStringList &newNames, const QStringList &existingNames, Qt::CaseSensitivity cs=Qt::CaseSensitive) |
|
New name, for example new layer name dialog.
If existing names are provided, the dialog warns users if an entered name already exists.
- Since
- QGIS 2.10
Definition at line 33 of file qgsnewnamedialog.h.
◆ QgsNewNameDialog()
QgsNewNameDialog::QgsNewNameDialog |
( |
const QString & |
source = QString() , |
|
|
const QString & |
initial = QString() , |
|
|
const QStringList & |
extensions = QStringList() , |
|
|
const QStringList & |
existing = QStringList() , |
|
|
Qt::CaseSensitivity |
cs = Qt::CaseSensitive , |
|
|
QWidget * |
parent = nullptr , |
|
|
Qt::WindowFlags |
flags = QgsGuiUtils::ModalDialogFlags |
|
) |
| |
New dialog constructor.
- Parameters
-
source | original data source name, e.g. original layer name of the layer to be copied |
initial | initial name |
extensions | base name extensions, e.g. raster base name band extensions or vector layer type extensions |
existing | existing names |
cs | case sensitivity for new name to existing names comparison |
parent | parent widget |
flags | window flags |
- Note
- Earlier versions had a similar constructor but with extra arguments for regexp which were removed in QGIS 3.22 as they relied on the deprecated QRegExp class. Use setRegularExpression() instead.
- Since
- QGIS 3.22.
Definition at line 26 of file qgsnewnamedialog.cpp.
◆ allowEmptyName()
bool QgsNewNameDialog::allowEmptyName |
( |
| ) |
const |
|
inline |
◆ conflictingNameWarning()
QString QgsNewNameDialog::conflictingNameWarning |
( |
| ) |
const |
|
inline |
◆ exists()
bool QgsNewNameDialog::exists |
( |
const QString & |
name, |
|
|
const QStringList & |
extensions, |
|
|
const QStringList & |
existing, |
|
|
Qt::CaseSensitivity |
cs = Qt::CaseSensitive |
|
) |
| |
|
static |
Test if name or name with at least one extension exists.
- Parameters
-
name | name or base name |
extensions | base name extensions |
existing | existing names |
cs | case sensitivity for new name to existing names comparison |
- Returns
true
if name exists
Definition at line 219 of file qgsnewnamedialog.cpp.
◆ fullNames()
QStringList QgsNewNameDialog::fullNames |
( |
const QString & |
name, |
|
|
const QStringList & |
extensions |
|
) |
| |
|
staticprotected |
◆ highlightText()
QString QgsNewNameDialog::highlightText |
( |
const QString & |
text | ) |
|
|
protected |
◆ hintString()
QString QgsNewNameDialog::hintString |
( |
| ) |
const |
◆ matching()
QStringList QgsNewNameDialog::matching |
( |
const QStringList & |
newNames, |
|
|
const QStringList & |
existingNames, |
|
|
Qt::CaseSensitivity |
cs = Qt::CaseSensitive |
|
) |
| |
|
staticprotected |
◆ name()
QString QgsNewNameDialog::name |
( |
| ) |
const |
◆ nameChanged
void QgsNewNameDialog::nameChanged |
( |
| ) |
|
|
slot |
◆ newNameChanged
void QgsNewNameDialog::newNameChanged |
( |
| ) |
|
|
signal |
Emitted when the name is changed in the dialog.
- Since
- QGIS 3.2
◆ overwriteEnabled()
bool QgsNewNameDialog::overwriteEnabled |
( |
| ) |
const |
|
inline |
◆ setAllowEmptyName()
void QgsNewNameDialog::setAllowEmptyName |
( |
bool |
allowed | ) |
|
Sets whether users are permitted to leave the widget empty.
If true
, the dialog will accept an empty name value.
- See also
- allowEmptyName()
- Since
- QGIS 3.14
Definition at line 98 of file qgsnewnamedialog.cpp.
◆ setConflictingNameWarning()
void QgsNewNameDialog::setConflictingNameWarning |
( |
const QString & |
string | ) |
|
Sets the string used for warning users if a conflicting name exists.
- Parameters
-
string | warning string. If empty a default warning string will be used. |
- See also
- conflictingNameWarning()
- Since
- QGIS 2.12
Definition at line 104 of file qgsnewnamedialog.cpp.
◆ setHintString()
void QgsNewNameDialog::setHintString |
( |
const QString & |
hintString | ) |
|
Sets the hint string for the dialog (the text shown above the name input box).
- Parameters
-
- See also
- hintString()
- Since
- QGIS 2.12
Definition at line 82 of file qgsnewnamedialog.cpp.
◆ setOverwriteEnabled()
void QgsNewNameDialog::setOverwriteEnabled |
( |
bool |
enabled | ) |
|
Sets whether users are permitted to overwrite existing names.
If true
, then the dialog will reflect that the new name will overwrite an existing name. If false
, then the dialog will not accept names which already exist.
- See also
- overwriteEnabled()
- Since
- QGIS 2.12
Definition at line 92 of file qgsnewnamedialog.cpp.
◆ setRegularExpression()
void QgsNewNameDialog::setRegularExpression |
( |
const QString & |
expression | ) |
|
Sets a regular expression to use for validating user-entered names in the dialog.
- Since
- QGIS 3.22
Definition at line 110 of file qgsnewnamedialog.cpp.
◆ mAllowEmptyName
bool QgsNewNameDialog::mAllowEmptyName = false |
|
protected |
◆ mCaseSensitivity
Qt::CaseSensitivity QgsNewNameDialog::mCaseSensitivity = Qt::CaseSensitive |
|
protected |
◆ mConflictingNameWarning
QString QgsNewNameDialog::mConflictingNameWarning |
|
protected |
◆ mErrorLabel
QLabel* QgsNewNameDialog::mErrorLabel = nullptr |
|
protected |
◆ mExiting
QStringList QgsNewNameDialog::mExiting |
|
protected |
◆ mExtensions
QStringList QgsNewNameDialog::mExtensions |
|
protected |
◆ mHintLabel
QLabel* QgsNewNameDialog::mHintLabel = nullptr |
|
protected |
◆ mLineEdit
QLineEdit* QgsNewNameDialog::mLineEdit = nullptr |
|
protected |
◆ mNamesLabel
QLabel* QgsNewNameDialog::mNamesLabel = nullptr |
|
protected |
◆ mOkString
QString QgsNewNameDialog::mOkString |
|
protected |
◆ mOverwriteEnabled
bool QgsNewNameDialog::mOverwriteEnabled = true |
|
protected |
◆ mRegularExpression
QRegularExpression QgsNewNameDialog::mRegularExpression |
|
protected |
The documentation for this class was generated from the following files: