本文整理汇总了C++中IDocument::endChanges方法的典型用法代码示例。如果您正苦于以下问题:C++ IDocument::endChanges方法的具体用法?C++ IDocument::endChanges怎么用?C++ IDocument::endChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocument
的用法示例。
在下文中一共展示了IDocument::endChanges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fontMinimizeHeight_triggered
//-----------------------------------------------------------------------------
void ActionFontHandlers::fontMinimizeHeight_triggered()
{
if (this->editor() != NULL)
{
IDocument *doc = this->editor()->document();
int left = std::numeric_limits<int>::max();
int top = std::numeric_limits<int>::max();
int right = 0;
int bottom = 0;
int l, t, r, b;
// find limits
QStringList keys = doc->dataContainer()->keys();
QListIterator<QString> it(keys);
it.toFront();
while (it.hasNext())
{
QString key = it.next();
const QImage *original = doc->dataContainer()->image(key);
BitmapHelper::findEmptyArea(original, &l, &t, &r, &b);
left = qMin(left, l);
top = qMin(top, t);
right = qMin(right, r);
bottom = qMin(bottom, b);
}
DialogCanvasResize dialog(doc->dataContainer(), this->mMainWindow->parentWidget());
dialog.selectKeys(keys);
dialog.setResizeInfo(-left, -top, -right, -bottom);
if (dialog.exec() == QDialog::Accepted)
{
dialog.resizeInfo(&left, &top, &right, &bottom);
if (left != 0 || top != 0 || right != 0 || bottom != 0)
{
doc->beginChanges();
QStringListIterator iterator(keys);
while (iterator.hasNext())
{
QString key = iterator.next();
const QImage *original = doc->dataContainer()->image(key);
QImage result = BitmapHelper::crop(original, left, top, right, bottom, BitmapEditorOptions::color2());
doc->dataContainer()->setImage(key, &result);
}
doc->endChanges();
}
}
}
}