Skip to content
Snippets Groups Projects
Commit bb5759e8 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fix error message when erasing the class name

Now it kindly asks the user to enter a class name. As requested by
Kavindra. :)
parent 994d9107
No related branches found
No related tags found
No related merge requests found
...@@ -84,8 +84,11 @@ bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorM ...@@ -84,8 +84,11 @@ bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorM
if (errorMessage) if (errorMessage)
*errorMessage = tr("The class name must not contain namespace delimiters."); *errorMessage = tr("The class name must not contain namespace delimiters.");
return false; return false;
} } else if (value.isEmpty()) {
if (!m_d->m_nameRegexp.exactMatch(value)) { if (errorMessage)
*errorMessage = tr("Please enter a class name.");
return false;
} else if (!m_d->m_nameRegexp.exactMatch(value)) {
if (errorMessage) if (errorMessage)
*errorMessage = tr("The class name contains invalid characters."); *errorMessage = tr("The class name contains invalid characters.");
return false; return false;
......
...@@ -43,11 +43,12 @@ namespace Utils { ...@@ -43,11 +43,12 @@ namespace Utils {
struct NewClassWidgetPrivate; struct NewClassWidgetPrivate;
/* NewClassWidget: Utility widget for 'New Class' wizards. Prompts the user /**
* NewClassWidget: Utility widget for 'New Class' wizards. Prompts the user
* to enter a class name (optionally derived from some base class) and file * to enter a class name (optionally derived from some base class) and file
* names for header, source and form files. Has some smart logic to derive * names for header, source and form files. Has some smart logic to derive
* the file names from the class name. */ * the file names from the class name.
*/
class QWORKBENCH_UTILS_EXPORT NewClassWidget : public QWidget class QWORKBENCH_UTILS_EXPORT NewClassWidget : public QWidget
{ {
Q_DISABLE_COPY(NewClassWidget) Q_DISABLE_COPY(NewClassWidget)
...@@ -115,8 +116,10 @@ public slots: ...@@ -115,8 +116,10 @@ public slots:
void setFormInputCheckable(bool v); void setFormInputCheckable(bool v);
void setFormInputChecked(bool v); void setFormInputChecked(bool v);
/* The name passed into the new class widget will be reformatted to be a /**
* valid class name. */ * The name passed into the new class widget will be reformatted to be a
* valid class name.
*/
void setClassName(const QString &suggestedName); void setClassName(const QString &suggestedName);
void setBaseClassName(const QString &); void setBaseClassName(const QString &);
void setPath(const QString &path); void setPath(const QString &path);
...@@ -127,13 +130,15 @@ public slots: ...@@ -127,13 +130,15 @@ public slots:
void setAllowDirectories(bool v); void setAllowDirectories(bool v);
void setLowerCaseFiles(bool v); void setLowerCaseFiles(bool v);
/* Suggest a class name from the base class by stripping the leading 'Q' /**
* Suggest a class name from the base class by stripping the leading 'Q'
* character. This will happen automagically if the base class combo * character. This will happen automagically if the base class combo
* changes until the class line edited is manually edited. */ * changes until the class line edited is manually edited.
*/
void suggestClassNameFromBase(); void suggestClassNameFromBase();
public slots: public slots:
// Trigger an update (after changing settings) /** Trigger an update (after changing settings) */
void triggerUpdateFileNames(); void triggerUpdateFileNames();
private slots: private slots:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment