QGIS API Documentation  3.0.2-Girona (307d082)
Public Slots | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
QgsNewNameDialog Class Reference

New name, for example new layer name dialog. More...

#include <qgsnewnamedialog.h>

Inheritance diagram for QgsNewNameDialog:
Inheritance graph
[legend]

Public Slots

void nameChanged ()
 

Public Member Functions

 QgsNewNameDialog (const QString &source=QString(), const QString &initial=QString(), const QStringList &extensions=QStringList(), const QStringList &existing=QStringList(), const QRegExp &regexp=QRegExp(), Qt::CaseSensitivity cs=Qt::CaseSensitive, QWidget *parent=nullptr, Qt::WindowFlags flags=QgsGuiUtils::ModalDialogFlags)
 New dialog constructor. 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 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...
 
- Public Member Functions inherited from QgsDialog
 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 Public Member Functions

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...
 

Protected Member Functions

QString highlightText (const QString &text)
 

Static Protected Member Functions

static QStringList fullNames (const QString &name, const QStringList &extensions)
 
static QStringList matching (const QStringList &newNames, const QStringList &existingNames, Qt::CaseSensitivity cs=Qt::CaseSensitive)
 

Protected Attributes

Qt::CaseSensitivity mCaseSensitivity
 
QString mConflictingNameWarning
 
QLabel * mErrorLabel = nullptr
 
QStringList mExiting
 
QStringList mExtensions
 
QLabel * mHintLabel = nullptr
 
QLineEdit * mLineEdit = nullptr
 
QLabel * mNamesLabel = nullptr
 List of names with extensions. More...
 
QString mOkString
 
bool mOverwriteEnabled = true
 
QRegExp mRegexp
 
- Protected Attributes inherited from QgsDialog
QDialogButtonBox * mButtonBox = nullptr
 
QVBoxLayout * mLayout = nullptr
 

Detailed Description

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 32 of file qgsnewnamedialog.h.

Constructor & Destructor Documentation

◆ QgsNewNameDialog()

QgsNewNameDialog::QgsNewNameDialog ( const QString &  source = QString(),
const QString &  initial = QString(),
const QStringList &  extensions = QStringList(),
const QStringList &  existing = QStringList(),
const QRegExp &  regexp = QRegExp(),
Qt::CaseSensitivity  cs = Qt::CaseSensitive,
QWidget *  parent = nullptr,
Qt::WindowFlags  flags = QgsGuiUtils::ModalDialogFlags 
)

New dialog constructor.

Parameters
sourceoriginal data source name, e.g. original layer name of the layer to be copied
initialinitial name
extensionsbase name extensions, e.g. raster base name band extensions or vector layer type extensions
existingexisting names
regexpregular expression to be used as validator, for example db tables should have "[A-Za-z_][A-Za-z0-9_]+"
cscase sensitivity for new name to existing names comparison
parent
flags

Definition at line 26 of file qgsnewnamedialog.cpp.

Member Function Documentation

◆ conflictingNameWarning()

QString QgsNewNameDialog::conflictingNameWarning ( ) const
inline

Returns the string used for warning users if a conflicting name exists.

Since
QGIS 2.12
See also
setConflictingNameWarning()

Definition at line 99 of file qgsnewnamedialog.h.

◆ 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
namename or base name
extensionsbase name extensions
existingexisting names
cscase sensitivity for new name to existing names comparison
Returns
true if name exists

Definition at line 196 of file qgsnewnamedialog.cpp.

◆ fullNames()

QStringList QgsNewNameDialog::fullNames ( const QString &  name,
const QStringList &  extensions 
)
staticprotected

Definition at line 163 of file qgsnewnamedialog.cpp.

◆ highlightText()

QString QgsNewNameDialog::highlightText ( const QString &  text)
protected

Definition at line 105 of file qgsnewnamedialog.cpp.

◆ hintString()

QString QgsNewNameDialog::hintString ( ) const

Returns the hint string for the dialog (the text shown above the name input box).

See also
setHintString()
Since
QGIS 2.12

Definition at line 88 of file qgsnewnamedialog.cpp.

◆ matching()

QStringList QgsNewNameDialog::matching ( const QStringList &  newNames,
const QStringList &  existingNames,
Qt::CaseSensitivity  cs = Qt::CaseSensitive 
)
staticprotected

Definition at line 178 of file qgsnewnamedialog.cpp.

◆ name()

QString QgsNewNameDialog::name ( ) const

Name entered by user.

Returns
new name

Definition at line 158 of file qgsnewnamedialog.cpp.

◆ nameChanged

void QgsNewNameDialog::nameChanged ( )
slot

Definition at line 110 of file qgsnewnamedialog.cpp.

◆ overwriteEnabled()

bool QgsNewNameDialog::overwriteEnabled ( ) const
inline

Returns whether users are permitted to overwrite existing names.

Since
QGIS 2.12
See also
setOverwriteEnabled()

Definition at line 84 of file qgsnewnamedialog.h.

◆ setConflictingNameWarning()

void QgsNewNameDialog::setConflictingNameWarning ( const QString &  string)

Sets the string used for warning users if a conflicting name exists.

Parameters
stringwarning string. If empty a default warning string will be used.
Since
QGIS 2.12
See also
conflictingNameWarning()

Definition at line 99 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
hintStringhint text
See also
hintString()
Since
QGIS 2.12

Definition at line 83 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.

Since
QGIS 2.12
See also
overwriteEnabled()

Definition at line 93 of file qgsnewnamedialog.cpp.

Member Data Documentation

◆ mCaseSensitivity

Qt::CaseSensitivity QgsNewNameDialog::mCaseSensitivity
protected

Definition at line 123 of file qgsnewnamedialog.h.

◆ mConflictingNameWarning

QString QgsNewNameDialog::mConflictingNameWarning
protected

Definition at line 132 of file qgsnewnamedialog.h.

◆ mErrorLabel

QLabel* QgsNewNameDialog::mErrorLabel = nullptr
protected

Definition at line 128 of file qgsnewnamedialog.h.

◆ mExiting

QStringList QgsNewNameDialog::mExiting
protected

Definition at line 121 of file qgsnewnamedialog.h.

◆ mExtensions

QStringList QgsNewNameDialog::mExtensions
protected

Definition at line 122 of file qgsnewnamedialog.h.

◆ mHintLabel

QLabel* QgsNewNameDialog::mHintLabel = nullptr
protected

Definition at line 124 of file qgsnewnamedialog.h.

◆ mLineEdit

QLineEdit* QgsNewNameDialog::mLineEdit = nullptr
protected

Definition at line 125 of file qgsnewnamedialog.h.

◆ mNamesLabel

QLabel* QgsNewNameDialog::mNamesLabel = nullptr
protected

List of names with extensions.

Definition at line 127 of file qgsnewnamedialog.h.

◆ mOkString

QString QgsNewNameDialog::mOkString
protected

Definition at line 129 of file qgsnewnamedialog.h.

◆ mOverwriteEnabled

bool QgsNewNameDialog::mOverwriteEnabled = true
protected

Definition at line 131 of file qgsnewnamedialog.h.

◆ mRegexp

QRegExp QgsNewNameDialog::mRegexp
protected

Definition at line 130 of file qgsnewnamedialog.h.


The documentation for this class was generated from the following files: