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:
xavier
2012-06-29 05:21:46 +00:00
parent 805ee08e1b
commit 4a01fed0ba
4 changed files with 31 additions and 8 deletions

View File

@@ -1316,13 +1316,13 @@ QString TitleBlockTemplate::finalTextForCell(const TitleBlockCell &cell, const D
}
/**
@param string A text containing 0 to n variables, e.g. "%var" or "%{var}"
@param diagram_context Diagram context to use to interprete variables
@return the provided string with variables replaced by the values from the diagram context
@param string A text containing 0 to n variables, e.g. "%var" or "%{var}"
@param diagram_context Diagram context to use to interprete variables
@return the provided string with variables replaced by the values from the diagram context
*/
QString TitleBlockTemplate::interpreteVariables(const QString &string, const DiagramContext &diagram_context) const {
QString interpreted_string = string;
foreach (QString key, diagram_context.keys()) {
foreach (QString key, diagram_context.keys(DiagramContext::DecreasingLength)) {
interpreted_string.replace("%{" + key + "}", diagram_context[key].toString());
interpreted_string.replace("%" + key, diagram_context[key].toString());
}