mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
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:
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user