Added wrap mode attribute to text box.

This commit is contained in:
Jim Evins
2018-07-04 20:58:03 -04:00
parent 03a8e29396
commit 0832acabf5
13 changed files with 626 additions and 381 deletions
+50
View File
@@ -298,6 +298,33 @@ namespace glabels
}
QTextOption::WrapMode XmlUtil::getWrapModeAttr( const QDomElement& node,
const QString& name,
QTextOption::WrapMode default_value )
{
init();
QString valueString = node.attribute( name, "" );
if ( valueString != "" )
{
if ( valueString == "word" )
{
return QTextOption::WordWrap;
}
else if ( valueString == "anywhere" )
{
return QTextOption::WrapAnywhere;
}
else if ( valueString == "none" )
{
return QTextOption::NoWrap;
}
}
return default_value;
}
void XmlUtil::setStringAttr( QDomElement& node,
const QString& name,
const QString& value )
@@ -406,5 +433,28 @@ namespace glabels
}
void XmlUtil::setWrapModeAttr( QDomElement& node,
const QString& name,
QTextOption::WrapMode value )
{
switch (value)
{
case QTextOption::WordWrap:
node.setAttribute( name, "word" );
break;
case QTextOption::WrapAnywhere:
node.setAttribute( name, "anywhere" );
break;
case QTextOption::NoWrap:
case QTextOption::ManualWrap:
node.setAttribute( name, "none" );
break;
default:
node.setAttribute( name, "word" );
break;
}
}
}
}