DiagramContextWidget: Fix verification of keys

This commit is contained in:
Peter Keresztes Schmidt
2021-09-22 14:02:33 +02:00
committed by Laurent Trinques
parent a8d42b0f9a
commit e9a5fded5c
3 changed files with 11 additions and 11 deletions

View File

@@ -92,7 +92,7 @@ const QVariant DiagramContext::operator[](const QString &key) const
@return true if the insertion succeeds, false otherwise
*/
bool DiagramContext::addValue(const QString &key, const QVariant &value, bool show) {
if (keyIsAcceptable(key)) {
if (isKeyAcceptable(key)) {
m_content.insert(key, value);
m_content_show.insert(key, show);
return(true);
@@ -240,10 +240,11 @@ bool DiagramContext::stringLongerThan(const QString &a, const QString &b) {
@param key a key string
@return true if that key is acceptable, false otherwise
*/
bool DiagramContext::keyIsAcceptable(const QString &key) const
bool DiagramContext::isKeyAcceptable(const QString &key)
{
QRegularExpression re(DiagramContext::validKeyRegExp());
QRegularExpressionMatch match =re.match(key);
static const QRegularExpression re(DiagramContext::validKeyRegExp());
QRegularExpressionMatch match = re.match(key);
return match.hasMatch();
}