当前位置: 首页>>代码示例>>C++>>正文


C++ QTextDocument::isModified方法代码示例

本文整理汇总了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();
    }
}
开发者ID:wangkungit5905,项目名称:PzAssistant,代码行数:28,代码来源:notemgrform.cpp

示例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());
	}
}
开发者ID:poznyakovskiy,项目名称:gitarre,代码行数:47,代码来源:gitarre.cpp

示例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;
}
开发者ID:ClothildeC,项目名称:tonatiuh,代码行数:23,代码来源:CodeEditorWidget.cpp


注:本文中的QTextDocument::isModified方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。