Add merge format API
This commit is contained in:
@@ -1137,6 +1137,26 @@ bool Format::hasProtectionData() const
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
Merges the current format with the properties described by format \a modifier.
|
||||
*/
|
||||
void Format::mergeFormat(const Format &modifier)
|
||||
{
|
||||
if (!modifier.isValid())
|
||||
return;
|
||||
|
||||
if (!isValid()) {
|
||||
d = modifier.d;
|
||||
return;
|
||||
}
|
||||
|
||||
QMapIterator<int, QVariant> it(modifier.d->property);
|
||||
while(it.hasNext()) {
|
||||
it.next();
|
||||
setProperty(it.key(), it.value());
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the format is valid; otherwise returns false.
|
||||
*/
|
||||
|
||||
@@ -216,6 +216,7 @@ public:
|
||||
bool hidden() const;
|
||||
void setHidden(bool hidden);
|
||||
|
||||
void mergeFormat(const Format &modifier);
|
||||
bool isValid() const;
|
||||
bool isEmpty() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user