本文整理汇总了C++中KDialog::setButtonText方法的典型用法代码示例。如果您正苦于以下问题:C++ KDialog::setButtonText方法的具体用法?C++ KDialog::setButtonText怎么用?C++ KDialog::setButtonText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDialog
的用法示例。
在下文中一共展示了KDialog::setButtonText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reportableErrorMessage
void RKErrorDialog::reportableErrorMessage (QWidget* parent_widget, const QString& user_message, const QString &details, const QString& caption, const QString& message_code) {
RK_TRACE (APP);
if (!parent_widget) parent_widget = RKWardMainWindow::getMain ();
// adjusted from KMessageBox::detailedError
KDialog *dialog = new KDialog (parent_widget, Qt::Dialog);
dialog->setCaption (caption);
if (details.isEmpty ()) dialog->setButtons (KDialog::Ok | KDialog::No);
else dialog->setButtons (KDialog::Ok | KDialog::No | KDialog::Details);
dialog->setButtonText (KDialog::No, i18n ("Report As Bug"));
dialog->setObjectName ("error");
dialog->setDefaultButton (KDialog::Ok);
dialog->setEscapeButton (KDialog::Ok);
KMessageBox::Options options = KMessageBox::Notify | KMessageBox::AllowLink;
dialog->setModal (true);
int ret = KMessageBox::createKMessageBox (dialog, QMessageBox::Critical, user_message, QStringList(), QString(), 0, options, details);
if (ret == KDialog::No) {
reportBug (parent_widget, (message_code.isEmpty () ? QString () : i18n ("Message code: %1\n", message_code)) + user_message);
}
}
示例2: PPPL_ShowLog
void PPPL_ShowLog() {
QStringList sl, result;
PPPL_MakeLog(sl);
bool foundConnect = false;
bool foundLCP = gpppdata.getPPPDebug();
QString lcp = QLatin1String("[LCP");
QString conn = QLatin1String("Connect:");
QStringList::ConstIterator it = sl.constBegin();
for( ; it != sl.constEnd(); it++) {
if((*it).indexOf(lcp) >= 0) {
foundLCP = true;
break;
}
if((*it).contains(conn))
foundConnect = true;
}
if(foundConnect && !foundLCP) {
int result = KMessageBox::warningYesNo(0,
i18n("KPPP could not prepare a PPP log. It is very likely "
"that pppd was started without the \"debug\" option.\n"
"Without this option it is difficult to find out PPP "
"problems, so in general the debug option should be used.\n"
"Enable debug now, and restart pppd?"), QString(), KGuiItem(i18n("Restart pppd")), KGuiItem(i18n("Do Not Restart")));
if(result == KMessageBox::Yes) {
gpppdata.setPPPDebug(true);
KMessageBox::information(0,
i18n("The \"debug\" option has been added. You "
"should now try to reconnect. If that fails "
"again, you will get a PPP log that may help "
"you to track down the connection problem."));
// return;
}
// return;
}
PPPL_AnalyseLog(sl, result);
KDialog *dlg = new KDialog();
dlg->setButtons(KDialog::Close | KDialog::Ok);
dlg->setWindowTitle(i18n("PPP Log"));
dlg->setButtonText(KDialog::Ok,i18n("Write to File"));
KVBox* v = new KVBox(dlg);
QTextEdit *edit = new QTextEdit(v);
edit->setReadOnly(true);
QLabel *label = new QLabel(i18n("kppp's diagnosis (just guessing):"), v);
QTextEdit *diagnosis = new QTextEdit(v);
diagnosis->setReadOnly(true);
edit->setMinimumSize(600, 250);
label->setMinimumSize(600, 15);
diagnosis->setMinimumSize(600, 60);
dlg->setMainWidget(v);
for(int i = 0; i < sl.count(); i++)
edit->append(sl.at(i));
for(int i = 0; i < result.count(); i++)
diagnosis->append(result.at(i));
if(dlg->exec()) {
QDir d = QDir::home();
QString s = d.absolutePath() + "/PPP-logfile";
int old_umask = umask(0077);
FILE *f = fopen(QFile::encodeName(s), "w");
for(int i = 0; i < sl.count(); i++)
fprintf(f, "%s\n", sl.at(i).toLocal8Bit().data());
fclose(f);
umask(old_umask);
QString msg = i18n("The PPP log has been saved\nas \"%1\".\n\nIf you want to send a bug report, or have\nproblems connecting to the Internet, please\nattach this file. It will help the maintainers\nto find the bug and to improve KPPP", s);
KMessageBox::information(0, msg);
}
delete dlg;
}
示例3: mouseDoubleClickEvent
bool Item::mouseDoubleClickEvent( const EventInfo & eventInfo )
{
Q_UNUSED(eventInfo);
Property * property = 0l;
Variant::Type::Value type = Variant::Type::None;
const VariantDataMap::iterator variantDataEnd = m_variantData.end();
for ( VariantDataMap::iterator it = m_variantData.begin(); it != variantDataEnd; ++it )
{
Property * current = *it;
if ( current->type() == Variant::Type::Multiline ||
current->type() == Variant::Type::RichText )
{
property = current;
type = current->type();
break;
}
}
if ( !property )
return false;
if ( type == Variant::Type::Multiline )
{
//KDialog * dlg = new KDialog( 0l, "", true, property->editorCaption(), KDialog::Ok|KDialog::Cancel|KDialog::User1, KDialog::Ok,
// false, KStandardGuiItem::clear() );
KDialog * dlg = new KDialog( 0 );
dlg->setModal(true);
dlg->setCaption( property->editorCaption() );
dlg->setButtons(KDialog::Ok|KDialog::Cancel|KDialog::User1);
dlg->setDefaultButton(KDialog::Ok);
dlg->showButtonSeparator(false);
dlg->setButtonText(KDialog::User1, KStandardGuiItem::clear().text());
//QFrame *frame = dlg->makeMainWidget();
QFrame *frame = new QFrame(dlg);
dlg->setMainWidget(frame);
QVBoxLayout *layout = new QVBoxLayout( frame );
layout->setMargin(0);
layout->setSpacing(dlg->spacingHint());
KTextEdit *textEdit = new KTextEdit( frame );
//textEdit->setTextFormat( Qt::PlainText ); // 2018.12.02
textEdit->setAcceptRichText(false);
textEdit->setText( property->value().toString() );
layout->addWidget( textEdit, 10 );
textEdit->setFocus();
connect( dlg, SIGNAL( user1Clicked() ), textEdit, SLOT( clear() ) );
dlg->setMinimumWidth( 600 );
if ( dlg->exec() == KDialog::Accepted )
{
property->setValue( textEdit->toPlainText() );
dataChanged();
p_itemDocument->setModified(true);
}
delete dlg;
}
else
{
// Is rich text
RichTextEditorDlg * dlg = new RichTextEditorDlg( 0l, property->editorCaption() );
dlg->setText( property->value().toString() );
if ( dlg->exec() == KDialog::Accepted )
{
property->setValue( dlg->text() );
dataChanged();
p_itemDocument->setModified(true);
}
delete dlg;
}
return true;
}