本文整理汇总了C++中KDialog::button方法的典型用法代码示例。如果您正苦于以下问题:C++ KDialog::button方法的具体用法?C++ KDialog::button怎么用?C++ KDialog::button使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDialog
的用法示例。
在下文中一共展示了KDialog::button方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkConsistency
void KDocumentTextBuffer::checkConsistency()
{
QString bufferContents = codec()->toUnicode( slice(0, length())->text() );
QString documentContents = kDocument()->text();
if ( bufferContents != documentContents ) {
KUrl url = kDocument()->url();
kDocument()->setModified(false);
kDocument()->setReadWrite(false);
m_aboutToClose = true;
QTemporaryFile f;
f.setAutoRemove(false);
f.open();
f.close();
kDocument()->saveAs(f.fileName());
KDialog* dialog = new KDialog;
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QLabel* label = new QLabel(i18n("Sorry, an internal error occurred in the text synchronization component.<br>"
"You can try to reload the document or disconnect."));
label->setWordWrap(true);
dialog->setMainWidget(label);
dialog->button(KDialog::Ok)->setText(i18n("Reload document"));
dialog->button(KDialog::Cancel)->setText(i18n("Disconnect"));
DocumentReopenHelper* helper = new DocumentReopenHelper(url, kDocument());
connect(dialog, SIGNAL(accepted()), helper, SLOT(reopen()));
// We must not use exec() here, since that will create a nested event loop,
// which might handle incoming network events. This can easily get very messy.
dialog->show();
}
}
示例2: newLinkDialog
QDialog* SemanticMarkupEdition::newLinkDialog( //krazy:exclude=qclasses
const QString& url) const {
KDialog* dialog = new KDialog(mTextEdit);
dialog->setModal(true);
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
dialog->button(KDialog::Ok)->setObjectName("okButton");
dialog->button(KDialog::Cancel)->setObjectName("cancelButton");
SemanticMarkupLinkWidget* linkWidget = new SemanticMarkupLinkWidget(dialog);
linkWidget->setUrl(url);
dialog->setMainWidget(linkWidget);
dialog->setWindowTitle(linkWidget->windowTitle());
return dialog;
}
示例3: insertComponent
void ExpressionLineEdit::insertComponent()
{
if (!m_clock) {
return;
}
ComponentWidget *componentWidget = new ComponentWidget(NULL, m_clock);
KDialog *dialog = new KDialog(this);
dialog->setMainWidget(componentWidget);
dialog->setModal(false);
dialog->setWindowTitle(i18n("Insert Clock Component"));
dialog->setButtons(KDialog::Apply | KDialog::Close);
dialog->button(KDialog::Apply)->setText(i18n("Insert"));
dialog->button(KDialog::Apply)->setEnabled(false);
dialog->show();
connect(dialog->button(KDialog::Apply), SIGNAL(clicked()), componentWidget, SLOT(insertComponent()));
connect(componentWidget, SIGNAL(componentChanged(bool)), dialog->button(KDialog::Apply), SLOT(setEnabled(bool)));
connect(componentWidget, SIGNAL(insertComponent(QString,QString)), this, SLOT(insertComponent(QString,QString)));
}
示例4: checkLineEndings
void KDocumentTextBuffer::checkLineEndings()
{
QString bufferContents = kDocument()->text();
if ( bufferContents.contains("\r\n") || bufferContents.contains("\r") ) {
KDialog* dlg = new KDialog(kDocument()->activeView());
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setButtons(KDialog::Ok | KDialog::Cancel);
dlg->button(KDialog::Ok)->setText(i18n("Continue"));
QLabel* l = new QLabel(i18n("The document you opened contains non-standard line endings. "
"Do you want to convert them to the standard \"\\n\" format?<br><br>"
"<i>Note: This change will be synchronized to the server.</i>"), dlg);
l->setWordWrap(true);
dlg->setMainWidget(l);
connect(dlg, SIGNAL(okClicked()), this, SLOT(replaceLineEndings()));
dlg->show();
}
}
示例5: unrecoverableError
void ManagedDocument::unrecoverableError(Document* document, QString error)
{
Q_ASSERT(document == m_infDocument);
if ( m_document ) {
QTemporaryFile file;
file.setAutoRemove(false);
file.open();
file.close();
m_document->saveAs(KUrl(file.fileName()));
}
if ( ! error.isEmpty() ) {
// We must not use exec() here (so no KMessageBox!) or we will run into
// nested-event-loop-network-code trouble.
KDialog* dlg = new KDialog();
dlg->setCaption(i18n("Collaborative text editing"));
QLabel* message = new QLabel(error);
message->setWordWrap(true);
dlg->setMainWidget(message);
dlg->setButtons(KDialog::Cancel);
dlg->button(KDialog::Cancel)->setText(i18n("Disconnect"));
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->show();
}
}