Title block properties: now warn users when they enter invalid keys.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1780 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-05-09 17:21:46 +00:00
parent 626ff78ae0
commit a161ce0bd4
4 changed files with 62 additions and 1 deletions

View File

@@ -63,11 +63,19 @@ bool DiagramContext::operator!=(const DiagramContext &dc) const {
return(!(*this == dc));
}
/**
@return the regular expression used to check whether a given key is acceptable.
@see keyIsAcceptable()
*/
QString DiagramContext::validKeyRegExp() {
return("^[a-z0-9-]+$");
}
/**
@param key a key string
@return true if that key is acceptable, false otherwise
*/
bool DiagramContext::keyIsAcceptable(const QString &key) const {
static QRegExp re("^[a-z0-9-]+$");
static QRegExp re(DiagramContext::validKeyRegExp());
return(re.exactMatch(key));
}