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


C++ MessageDialog::exec方法代码示例

本文整理汇总了C++中MessageDialog::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageDialog::exec方法的具体用法?C++ MessageDialog::exec怎么用?C++ MessageDialog::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MessageDialog的用法示例。


在下文中一共展示了MessageDialog::exec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: showStatusToEveryoneToggled

void GaduEditAccountWidget::showStatusToEveryoneToggled(bool toggled)
{
	if (toggled)
		return;

	int count = 0;

	const QVector<Contact> &contacts = m_contactManager->contacts(account());
	foreach (const Contact &contact, contacts)
		if (!contact.isAnonymous() && contact.ownerBuddy().isOfflineTo())
			count++;

	if (!count)
		return;

	MessageDialog *dialog = MessageDialog::create(m_iconsManager->iconByPath(KaduIcon("dialog-warning")), tr("Status Visibility"),
	                        tr("You are going to reveal your status to several buddies which are currently not allowed to see it.\n"
				  "Are you sure to allow them to know you are available?"));
	dialog->addButton(QMessageBox::Yes, tr("Make my status visible anyway"));
	dialog->addButton(QMessageBox::No, tr("Stay with private status"));
	dialog->setDefaultButton(QMessageBox::No);
	int decision = dialog->exec();

	if (decision == QMessageBox::Yes)
		return;

	ShowStatusToEveryone->setChecked(false);
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: removeAccount

void GaduEditAccountWidget::removeAccount()
{
	MessageDialog *dialog = MessageDialog::create(m_iconsManager->iconByPath(KaduIcon("dialog-warning")), tr("Confrim Account Removal"),
	                        tr("Are you sure do you want to remove account %1 (%2)?")
				.arg(account().accountIdentity().name())
				.arg(account().id()));
	dialog->addButton(QMessageBox::Yes, tr("Remove account"));
	dialog->addButton(QMessageBox::Cancel, tr("Cancel"));
	dialog->setDefaultButton(QMessageBox::Cancel);
	int decision = dialog->exec();

	if (decision == QMessageBox::Yes)
	{
		m_accountManager->removeAccountAndBuddies(account());
		deleteLater();
	}
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例3: canChangeWidget

bool YourAccounts::canChangeWidget()
{
	if (ForceWidgetChange)
		return true;

	if (!CurrentWidget)
		return true;

	if (StateNotChanged == CurrentWidget->stateNotifier()->state())
		return true;

	if (!IsCurrentWidgetEditAccount)
	{
		MessageDialog *dialog = MessageDialog::create(m_iconsManager->iconByPath(KaduIcon("dialog-warning")), tr("Unsaved changes"),
					tr("You have unsaved changes in current account.<br />Do you want to return to edit or discard changes?"));
		dialog->addButton(QMessageBox::Yes, tr("Return to edit"));
		dialog->addButton(QMessageBox::Ignore, tr("Discard changes"));
		dialog->addButton(QMessageBox::Cancel, tr("Cancel"));

		QMessageBox::StandardButton result = (QMessageBox::StandardButton) dialog->exec();

		switch (result)
		{
			case QMessageBox::Yes:
				return false;

			case QMessageBox::Ignore:
				CurrentWidget->cancel();
				return true;

			default:
				return false;
		}
	}

	if (StateChangedDataValid == CurrentWidget->stateNotifier()->state())
	{
		MessageDialog *dialog = MessageDialog::create(m_iconsManager->iconByPath(KaduIcon("dialog-warning")), tr("Unsaved changes"),
					tr("You have unsaved changes in current account.<br />Do you want to save them?"));
		dialog->addButton(QMessageBox::Save, tr("Save changes"));
		dialog->addButton(QMessageBox::Ignore, tr("Discard"));
		dialog->addButton(QMessageBox::Cancel, tr("Cancel"));

		QMessageBox::StandardButton result = (QMessageBox::StandardButton) dialog->exec();

		switch (result)
		{
			case QMessageBox::Save:
				CurrentWidget->apply();
				return true;

			case QMessageBox::Ignore:
				CurrentWidget->cancel();
				return true;

			default:
				return false;
		}
	}

	if (StateChangedDataInvalid == CurrentWidget->stateNotifier()->state())
	{
		MessageDialog *dialog = MessageDialog::create(m_iconsManager->iconByPath(KaduIcon("dialog-warning")), tr("Invalid changes"),
					tr("You have invalid changes in current account, which cannot be saved.<br />Do you want to stay in edit or discard changes?"));
		dialog->addButton(QMessageBox::Yes, tr("Stay in edit"));
		dialog->addButton(QMessageBox::Ignore, tr("Discard changes"));
		dialog->addButton(QMessageBox::Cancel, tr("Cancel"));

		QMessageBox::StandardButton result = (QMessageBox::StandardButton) dialog->exec();

		switch (result)
		{
			case QMessageBox::Yes:
				return false;

			case QMessageBox::Ignore:
				CurrentWidget->cancel();
				return true;

			default:
				return false;
		}
	}

	return true;
}
开发者ID:,项目名称:,代码行数:86,代码来源:


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