本文整理汇总了C++中QTextDocument::isModified方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextDocument::isModified方法的具体用法?C++ QTextDocument::isModified怎么用?C++ QTextDocument::isModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextDocument
的用法示例。
在下文中一共展示了QTextDocument::isModified方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_btnReturn_clicked
void NoteMgrForm::on_btnReturn_clicked()
{
bool isNote = ui->stackedWidget->currentIndex() == 1;
if(isNote){
QListWidgetItem* item = ui->lwTitles->currentItem();
if(ui->edtTitle->text() != item->text()){
NoteStruct* note = item->data(NDR_OBJECT).value<NoteStruct*>();
note->title = ui->edtTitle->text();
item->setText(ui->edtTitle->text());
item->setData(NDR_MODIFY_TAG,true);
}
QTextDocument* doc = ui->NoteTexts->document();
if(doc->isModified()){
NoteStruct* note = item->data(NDR_OBJECT).value<NoteStruct*>();
note->content = doc->toHtml("utf-8");
note->lastEditTime = QDateTime::currentDateTime().toMSecsSinceEpoch();
item->setData(NDR_MODIFY_TAG,true);
doc->setModified(false);
}
if(item->data(NDR_MODIFY_TAG).toBool())
ui->btnSave->setEnabled(true);
ui->stackedWidget->setCurrentIndex(0);
ui->btnReturn->setEnabled(false);
ui->edtTitle->clear();
ui->edtCrtTime->clear();
ui->edtLastTime->clear();
}
}
示例2: onRepoViewItemChanged
void Gitarre::onRepoViewItemChanged (QTreeWidgetItem * current, QTreeWidgetItem * previous)
{
PurgeRepoViewContextMenu ();
int topLevelIndex = RepoView->indexOfTopLevelItem(current);
if (topLevelIndex != -1) // item is a top level item
{
Repository *repo = Repos [topLevelIndex];
// create context menu for the specific item
if (repo->GetGitRepo())
{
RepoView->addAction(CommitRepoAction);
RepoView->addAction(PushRepoAction);
CommitAction->setEnabled(true);
PushAction->setEnabled(true);
}
else
{
RepoView->addAction(FindRepoAction);
CommitAction->setEnabled(false);
PushAction->setEnabled(false);
}
RepoView->addAction(RemoveSeparator);
RepoView->addAction(RemoveRepoAction);
// refresh remotes menu
if (current != previous)
RefreshRemotesMenu (repo);
}
else // provide the corresponding top level index
{
QTreeWidgetItem *parent = current; // move all the way up the item hierarchy
while (parent->parent()) // while item "parent" has a parent
parent = parent->parent(); // set parent to its parent
topLevelIndex = RepoView->indexOfTopLevelItem(parent);
}
Repository *repo = Repos [topLevelIndex];
QTextDocument *doc = repo->GetIgnoreDocument();
if (IgnoreEditor->document() != doc)
{
IgnoreEditor->setDocument(doc);
UpdateIgnoreEditorTab (doc->isModified());
}
}
示例3: OkToContinue
/*!
* Returns \a true if the application is ready to start with other script. Otherwise,
* returns \a false.
*/
bool CodeEditorWidget::OkToContinue()
{
QTextDocument* document = codeEditor->document();
if ( document->isModified () )
{
int answer = QMessageBox::warning( this, tr( "Tonatiuh" ),
tr( "The document has been modified.\n"
"Do you want to save your changes?"),
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::No,
QMessageBox::Cancel | QMessageBox::Escape );
if ( answer == QMessageBox::Yes ) return SaveScript();
else if ( answer == QMessageBox::Cancel ) return false;
}
return true;
}