Skip to content

Commit

Permalink
Add a newNameChanged signal to QgsNewNameDialog
Browse files Browse the repository at this point in the history
Handy for subclasses.

(cherry-picked from 8d5e5c9)
  • Loading branch information
nyalldawson committed May 14, 2018
1 parent 83a8d01 commit 2d0810c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/gui/qgsnewnamedialog.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Returns the string used for warning users if a conflicting name exists.
Name entered by user.

:return: new name

.. seealso:: :py:func:`newNameChanged`
%End

static bool exists( const QString &name, const QStringList &extensions,
Expand All @@ -121,6 +123,16 @@ Test if name or name with at least one extension exists.

:return: true if name exists
%End
signals:


void newNameChanged();
%Docstring
Emitted when the name is changed in the dialog.

.. versionadded:: 3.2
%End

public slots:
void nameChanged();

Expand Down
1 change: 1 addition & 0 deletions src/gui/qgsnewnamedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ QgsNewNameDialog::QgsNewNameDialog( const QString &source, const QString &initia
}
mLineEdit->setMinimumWidth( mLineEdit->fontMetrics().width( QStringLiteral( "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" ) ) );
connect( mLineEdit, &QLineEdit::textChanged, this, &QgsNewNameDialog::nameChanged );
connect( mLineEdit, &QLineEdit::textChanged, this, &QgsNewNameDialog::newNameChanged );
layout()->addWidget( mLineEdit );

mNamesLabel = new QLabel( QStringLiteral( " " ), this );
Expand Down
12 changes: 12 additions & 0 deletions src/gui/qgsnewnamedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class GUI_EXPORT QgsNewNameDialog : public QgsDialog
/**
* Name entered by user.
* \returns new name
* \see newNameChanged()
*/
QString name() const;

Expand All @@ -114,7 +115,18 @@ class GUI_EXPORT QgsNewNameDialog : public QgsDialog
*/
static bool exists( const QString &name, const QStringList &extensions,
const QStringList &existing, Qt::CaseSensitivity cs = Qt::CaseSensitive );
signals:

// TODO QGIS 4.0 - rename to nameChanged

/**
* Emitted when the name is changed in the dialog.
* \since QGIS 3.2
*/
void newNameChanged();

public slots:
// TODO QGIS 4.0 - rename to onNameChanged
void nameChanged();

protected:
Expand Down

0 comments on commit 2d0810c

Please sign in to comment.