diff --git a/src/libs/utils/classnamevalidatinglineedit.cpp b/src/libs/utils/classnamevalidatinglineedit.cpp index 86f86a124d045e0f8f96a27e68c8e3309bb2cd99..64d2031a57c770917d8a80091466342911bf304e 100644 --- a/src/libs/utils/classnamevalidatinglineedit.cpp +++ b/src/libs/utils/classnamevalidatinglineedit.cpp @@ -84,8 +84,11 @@ bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorM if (errorMessage) *errorMessage = tr("The class name must not contain namespace delimiters."); return false; - } - if (!m_d->m_nameRegexp.exactMatch(value)) { + } else if (value.isEmpty()) { + if (errorMessage) + *errorMessage = tr("Please enter a class name."); + return false; + } else if (!m_d->m_nameRegexp.exactMatch(value)) { if (errorMessage) *errorMessage = tr("The class name contains invalid characters."); return false; diff --git a/src/libs/utils/newclasswidget.h b/src/libs/utils/newclasswidget.h index 15b21fcb0e6eeb5542390473799bb7c94c2c1fc1..674adf6c84bbab4a25386cbeb2898c642eb4bcf5 100644 --- a/src/libs/utils/newclasswidget.h +++ b/src/libs/utils/newclasswidget.h @@ -43,11 +43,12 @@ namespace Utils { 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 * 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 { Q_DISABLE_COPY(NewClassWidget) @@ -115,8 +116,10 @@ public slots: void setFormInputCheckable(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 setBaseClassName(const QString &); void setPath(const QString &path); @@ -127,13 +130,15 @@ public slots: void setAllowDirectories(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 - * changes until the class line edited is manually edited. */ + * changes until the class line edited is manually edited. + */ void suggestClassNameFromBase(); public slots: - // Trigger an update (after changing settings) + /** Trigger an update (after changing settings) */ void triggerUpdateFileNames(); private slots: