Class: QgsNewNameDialog

class qgis.gui.QgsNewNameDialog(source: str = '', initial: str = '', extensions: Iterable[str] = [], existing: Iterable[str] = [], regexp: QRegExp = QRegExp(), cs: Qt.CaseSensitivity = Qt.CaseSensitive, parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = QgsGuiUtils.ModalDialogFlags)

Bases: QgsDialog

New dialog constructor.

Parameters
  • source (str = '') – original data source name, e.g. original layer name of the layer to be copied

  • initial (str = '') – initial name

  • extensions (Iterable[str] = []) – base name extensions, e.g. raster base name band extensions or vector layer type extensions

  • existing (Iterable[str] = []) – existing names

  • regexp (QRegExp = QRegExp()) – regular expression to be used as validator, for example db tables should have “[A-Za-z_][A-Za-z0-9_]+”

  • cs (Qt.CaseSensitivity = Qt.CaseSensitive) – case sensitivity for new name to existing names comparison

  • parent (QWidget = None) –

  • flags (Union[Qt.WindowFlags) –

New name, for example new layer name dialog. If existing names are provided, the dialog warns users if an entered name already exists.

Methods

actionEvent

changeEvent

childEvent

closeEvent

conflictingNameWarning

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

connectNotify

contextMenuEvent

create

customEvent

destroy

disconnectNotify

dragEnterEvent

dragLeaveEvent

dragMoveEvent

dropEvent

enterEvent

event

eventFilter

exists

Test if name or name with at least one extension exists.

focusInEvent

focusNextChild

focusNextPrevChild

focusOutEvent

focusPreviousChild

fullNames

param name

hideEvent

highlightText

List of names with extensions

hintString

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

initPainter

inputMethodEvent

isSignalConnected

keyPressEvent

keyReleaseEvent

leaveEvent

matching

param newNames

metric

mouseDoubleClickEvent

mouseMoveEvent

mousePressEvent

mouseReleaseEvent

moveEvent

name

Name entered by user.

nameChanged

nativeEvent

overwriteEnabled

Returns whether users are permitted to overwrite existing names.

paintEvent

receivers

resizeEvent

sender

senderSignalIndex

setConflictingNameWarning

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

setHintString

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

setOverwriteEnabled

Sets whether users are permitted to overwrite existing names.

sharedPainter

showEvent

tabletEvent

timerEvent

updateMicroFocus

wheelEvent

Signals

newNameChanged

Emitted when the name is changed in the dialog.

actionEvent()
changeEvent()
childEvent()
closeEvent()
conflictingNameWarning(self) → str

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

New in version 2.12.

Return type

str

connectNotify()
contextMenuEvent()
create()
customEvent()
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
eventFilter()
exists(name: str, extensions: Iterable[str], existing: Iterable[str], cs: Qt.CaseSensitivity = Qt.CaseSensitive) → bool

Test if name or name with at least one extension exists.

Parameters
  • name (str) – name or base name

  • extensions (Iterable[str]) – base name extensions

  • existing (Iterable[str]) – existing names

  • cs (Qt.CaseSensitivity = Qt.CaseSensitive) – case sensitivity for new name to existing names comparison

Return type

bool

Returns

True if name exists

focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
fullNames(name: str, extensions: Iterable[str]) → List[str]
Parameters
  • name (str) –

  • extensions (Iterable[str]) –

Return type

List[str]

hideEvent()
highlightText(self, text: str) → str

List of names with extensions

Parameters

text (str) –

Return type

str

hintString(self) → str

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

See also

setHintString()

New in version 2.12.

Return type

str

initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
matching(newNames: Iterable[str], existingNames: Iterable[str], cs: Qt.CaseSensitivity = Qt.CaseSensitive) → List[str]
Parameters
  • newNames (Iterable[str]) –

  • existingNames (Iterable[str]) –

  • cs (Qt.CaseSensitivity = Qt.CaseSensitive) –

Return type

List[str]

metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
name(self) → str

Name entered by user.

Return type

str

Returns

new name

See also

newNameChanged()

nameChanged(self)
nativeEvent()
newNameChanged

Emitted when the name is changed in the dialog.

New in version 3.2: [signal]

overwriteEnabled(self) → bool

Returns whether users are permitted to overwrite existing names.

New in version 2.12.

Return type

bool

paintEvent()
receivers()
resizeEvent()
sender()
senderSignalIndex()
setConflictingNameWarning(self, string: str)

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

Parameters

string (str) – warning string. If empty a default warning string will be used.

New in version 2.12.

setHintString(self, hintString: str)

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

Parameters

hintString (str) – hint text

See also

hintString()

New in version 2.12.

setOverwriteEnabled(self, enabled: bool)

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.

New in version 2.12.

Parameters

enabled (bool) –

sharedPainter()
showEvent()
tabletEvent()
timerEvent()
updateMicroFocus()
wheelEvent()