本文整理汇总了C++中Document::HasUnsavedData方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::HasUnsavedData方法的具体用法?C++ Document::HasUnsavedData怎么用?C++ Document::HasUnsavedData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Document
的用法示例。
在下文中一共展示了Document::HasUnsavedData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateWindowTitle
void MainWindow::updateWindowTitle() {
Document* doc = Application::I()->CurrentDocument();
if (doc == 0) {
setWindowTitle(VER_PRODUCTNAME_STR);
setWindowModified(false);
} else {
QString title;
title = doc->GetFilename().isEmpty() ? "<unsaved>" : doc->GetFilename();
title.append("[*] - ").append(VER_PRODUCTNAME_STR);
setWindowModified(doc->HasUnsavedData());
setWindowTitle(title);
}
}
示例2: sl_CloseDocumentAction_Triggered
void MainWindow::sl_CloseDocumentAction_Triggered(bool* actionCancelled, bool* actionDelayed, bool suppressSaving) {
Document* oldDoc = Application::I()->CurrentDocument();
if (oldDoc == 0) {
WARNING("No current document set");
return;
}
if (oldDoc->HasUnsavedData() && (suppressSaving == false)) {
CustomMessageBox msg(this, "Current document has been changed. Save it?", "Save document?",
QMessageBox::Question, QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
QMessageBox::StandardButton result = msg.show();
if (result == QMessageBox::Cancel) {
if (actionCancelled) {
*actionCancelled = true;
}
return;
}
if (result == QMessageBox::Yes) {
bool saveCancelled = false;
sl_SaveDocumentAction_Triggered(&saveCancelled);
if (saveCancelled) {
if (actionCancelled) {
*actionCancelled = saveCancelled;
}
return;
}
closeDocumentAfterSave = true;
if (actionDelayed) {
*actionDelayed = true;
}
return;
}
}
documentUpdateCheckTimer.stop();
Application::I()->SetCurrentDocument(0);
notesTabWidget->Clear();
delete oldDoc;
}