mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-02-01 09:09:58 +01:00
Reworked the DiagramContext class to sort custom variables.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1884 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -21,8 +21,18 @@
|
||||
/**
|
||||
@return a list containing all the keys in the context object.
|
||||
*/
|
||||
QList<QString> DiagramContext::keys() const {
|
||||
return(content_.keys());
|
||||
QList<QString> DiagramContext::keys(DiagramContext::KeyOrder order) const {
|
||||
if (order == None) {
|
||||
return content_.keys();
|
||||
} else {
|
||||
QList<QString> keys_list = content_.keys();
|
||||
if (order == Alphabetical) {
|
||||
qSort(keys_list);
|
||||
} else {
|
||||
qSort(keys_list.begin(), keys_list.end(), DiagramContext::stringLongerThan);
|
||||
}
|
||||
return(keys_list);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +81,13 @@ QString DiagramContext::validKeyRegExp() {
|
||||
return("^[a-z0-9-]+$");
|
||||
}
|
||||
|
||||
/**
|
||||
@return True if \a a is longer than \a b, false otherwise.
|
||||
*/
|
||||
bool DiagramContext::stringLongerThan(const QString &a, const QString &b) {
|
||||
return (a.length() > b.length());
|
||||
}
|
||||
|
||||
/**
|
||||
@param key a key string
|
||||
@return true if that key is acceptable, false otherwise
|
||||
|
||||
Reference in New Issue
Block a user