QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsnewnamedialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsnewnamedialog.h
3  -------------------
4  begin : May, 2015
5  copyright : (C) 2015 Radim Blazek
6  email : [email protected]
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef QGSNEWNAMEDIALOG_H
18 #define QGSNEWNAMEDIALOG_H
19 
20 class QLabel;
21 class QLineEdit;
22 
23 #include "qgsdialog.h"
24 
30 class GUI_EXPORT QgsNewNameDialog : public QgsDialog
31 {
32  Q_OBJECT
33  public:
44  QgsNewNameDialog( const QString& source = QString::null, const QString& initial = QString::null,
45  const QStringList& extensions = QStringList(), const QStringList& existing = QStringList(),
46  const QRegExp& regexp = QRegExp(), Qt::CaseSensitivity cs = Qt::CaseSensitive,
47  QWidget *parent = nullptr, const Qt::WindowFlags& flags = QgisGui::ModalDialogFlags );
48 
55  void setHintString( const QString& hintString );
56 
62  QString hintString() const;
63 
70  void setOverwriteEnabled( bool enabled );
71 
76  bool overwriteEnabled() const { return mOverwriteEnabled; }
77 
83  void setConflictingNameWarning( const QString& string );
84 
89  QString conflictingNameWarning() const { return mConflictingNameWarning; }
90 
94  QString name() const;
95 
103  static bool exists( const QString& name, const QStringList& extensions,
104  const QStringList& existing, Qt::CaseSensitivity cs = Qt::CaseSensitive );
105  public slots:
106  void nameChanged();
107 
108  protected:
111  Qt::CaseSensitivity mCaseSensitivity;
114  QLabel *mNamesLabel; // list of names with extensions
120 
121  QString highlightText( const QString& text );
122  static QStringList fullNames( const QString& name, const QStringList& extensions );
123  // get list of existing names
124  static QStringList matching( const QStringList& newNames, const QStringList& existingNames,
125  Qt::CaseSensitivity cs = Qt::CaseSensitive );
126 };
127 
128 #endif // QGSNEWNAMEDIALOG_H
static const Qt::WindowFlags ModalDialogFlags
Definition: qgisgui.h:50
Qt::CaseSensitivity mCaseSensitivity
QStringList mExiting
A generic dialog with layout and button box.
Definition: qgsdialog.h:30
QStringList mExtensions
const char * name() const
QString mConflictingNameWarning
bool overwriteEnabled() const
Returns whether users are permitted to overwrite existing names.
QString conflictingNameWarning() const
Returns the string used for warning users if a conflicting name exists.
New name, for example new layer name dialog.
typedef WindowFlags
QLineEdit * mLineEdit