本文整理汇总了C++中KDialog::show方法的典型用法代码示例。如果您正苦于以下问题:C++ KDialog::show方法的具体用法?C++ KDialog::show怎么用?C++ KDialog::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDialog
的用法示例。
在下文中一共展示了KDialog::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: checkSourceExists
bool KNewFileMenuPrivate::checkSourceExists(const QString& src)
{
if (!QFile::exists(src)) {
kWarning(1203) << src << "doesn't exist" ;
KDialog* dialog = new KDialog(m_parentWidget);
dialog->setCaption( i18n("Sorry") );
dialog->setButtons( KDialog::Ok );
dialog->setObjectName( "sorry" );
dialog->setModal(q->isModal());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setDefaultButton( KDialog::Ok );
dialog->setEscapeButton( KDialog::Ok );
KMessageBox::createKMessageBox(dialog, QMessageBox::Warning,
i18n("<qt>The template file <b>%1</b> does not exist.</qt>", src),
QStringList(), QString(), 0, KMessageBox::NoExec,
QString());
dialog->show();
return false;
}
return true;
}
示例2: main
int main(int argc, char *argv[])
{
KAboutData aboutData("itemview-test", 0, ki18n("test for item view"),
"0.1", ki18n("test app"),
KAboutData::License_GPL,
ki18n("(c) 2008 Alessandro Diaferia"),
KLocalizedString(), "", "[email protected]");
aboutData.addAuthor(ki18n("Alessandro Diaferia"), KLocalizedString(), "[email protected]");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions(options);
KCmdLineArgs::parsedArgs();
KApplication app;
KDialog *window = new KDialog();
RaptorItemsView *itemsView = new RaptorItemsView(window);
Kickoff::ApplicationModel *model = new Kickoff::ApplicationModel();
itemsView->setModel(model);
RaptorItemDelegate *delegate = new RaptorItemDelegate();
itemsView->setItemDelegate(delegate);
window->setMainWidget(itemsView);
window->show();
return app.exec();
}
示例3: executeOtherDesktopFile
void KNewFileMenuPrivate::executeOtherDesktopFile(const KNewFileMenuSingleton::Entry& entry)
{
if (!checkSourceExists(entry.templatePath)) {
return;
}
KUrl::List::const_iterator it = m_popupFiles.constBegin();
for (; it != m_popupFiles.constEnd(); ++it)
{
QString text = entry.text;
text.remove("..."); // the ... is fine for the menu item but not for the default filename
text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
// KDE5 TODO: remove the "..." from link*.desktop files and use i18n("%1...") when making
// the action.
KUrl defaultFile(*it);
defaultFile.addPath(KIO::encodeFileName(text));
if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
text = KIO::RenameDialog::suggestName(*it, text);
const KUrl templateUrl(entry.templatePath);
KDialog* dlg = new KPropertiesDialog(templateUrl, *it, text, m_parentWidget);
dlg->setModal(q->isModal());
dlg->setAttribute(Qt::WA_DeleteOnClose);
QObject::connect(dlg, SIGNAL(applied()), q, SLOT(_k_slotOtherDesktopFile()));
dlg->show();
}
// We don't set m_src here -> there will be no copy, we are done.
}
示例4: 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();
}
}
示例5: metrics
void ExtendedAboutDialog::Private::_k_showLicense( const QString &number )
{
KDialog *dialog = new KDialog(q);
dialog->setCaption(i18n("License Agreement"));
dialog->setButtons(KDialog::Close);
dialog->setDefaultButton(KDialog::Close);
const QFont font = KGlobalSettings::fixedFont();
QFontMetrics metrics(font);
const QString licenseText = aboutData->licenses().at(number.toInt()).text();
KTextBrowser *licenseBrowser = new KTextBrowser;
licenseBrowser->setFont(font);
licenseBrowser->setLineWrapMode(QTextEdit::NoWrap);
licenseBrowser->setText(licenseText);
dialog->setMainWidget(licenseBrowser);
// try to set up the dialog such that the full width of the
// document is visible without horizontal scroll-bars being required
const qreal idealWidth = licenseBrowser->document()->idealWidth() + (2 * dialog->marginHint())
+ licenseBrowser->verticalScrollBar()->width() * 2;
// try to allow enough height for a reasonable number of lines to be shown
const int idealHeight = metrics.height() * 30;
dialog->setInitialSize(dialog->sizeHint().expandedTo(QSize((int)idealWidth,idealHeight)));
dialog->show();
}
示例6: confirmCreatingHiddenDir
void KNewFileMenuPrivate::confirmCreatingHiddenDir(const QString& name)
{
if(!KMessageBox::shouldBeShownContinue("confirm_create_hidden_dir")){
_k_slotCreateHiddenDirectory();
return;
}
KGuiItem continueGuiItem(KStandardGuiItem::cont());
continueGuiItem.setText(i18nc("@action:button", "Create directory"));
KGuiItem cancelGuiItem(KStandardGuiItem::cancel());
cancelGuiItem.setText(i18nc("@action:button", "Enter a different name"));
KDialog* confirmDialog = new KDialog(m_parentWidget);
confirmDialog->setCaption(i18n("Create hidden directory?"));
confirmDialog->setModal(m_modal);
confirmDialog->setAttribute(Qt::WA_DeleteOnClose);
KMessageBox::createKMessageBox(confirmDialog, QMessageBox::Warning,
i18n("The name \"%1\" starts with a dot, so the directory will be hidden by default.", name),
QStringList(),
i18n("Do not ask again"),
0,
KMessageBox::NoExec,
QString());
confirmDialog->setButtonGuiItem(KDialog::Ok, continueGuiItem);
confirmDialog->setButtonGuiItem(KDialog::Cancel, cancelGuiItem);
QObject::connect(confirmDialog, SIGNAL(accepted()), q, SLOT(_k_slotCreateHiddenDirectory()));
QObject::connect(confirmDialog, SIGNAL(rejected()), q, SLOT(createDirectory()));
m_fileDialog = confirmDialog;
confirmDialog->show();
}
示例7: showDmesg
void ConfigurationDialog::showDmesg()
{
KDialog *dialog = new DmesgDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose, true);
dialog->setModal(true);
dialog->show();
}
示例8: qDebug
void TaskWidgetItem::TaskWidgetItem::editTask()
{
qDebug() << (int)parentWidget()->geometry().width();
m_editor = new TaskEditor();
m_editor->setAllDay(m_todo->allDay());
if (m_todo->hasStartDate()) {
m_editor->setStartDate(m_todo->dtStart());
} else {
m_editor->disableStartDate();
if (m_todo->hasDueDate()) {
if (m_todo->dtDue().date() < QDate::currentDate()) {
m_editor->setStartDate(m_todo->dtDue());
}
}
}
if (m_todo->hasDueDate()) {
m_editor->setDueDate(m_todo->dtDue());
} else {
m_editor->disableDueDate();
}
m_editor->setName(m_todo->summary());
m_editor->setDescription(m_todo->description());
KDialog * dialog = new KDialog();
dialog->setCaption(m_todo->summary());
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
dialog->setMainWidget(m_editor);
connect(dialog, SIGNAL(okClicked()), SLOT(saveTask()));
connect(dialog, SIGNAL(okClicked()), dialog, SLOT(delayedDestruct()));
connect(dialog, SIGNAL(cancelClicked()), dialog, SLOT(delayedDestruct()));
dialog->show();
}
示例9: slotProfile
void DebuggerManager::slotProfile()
{
if(m_debugger)
{
KDialog* d = m_debugger->profileDialog();
if(d) {
d->show();
m_debugger->profile();
}
}
}
示例10: displayCollection
void NotifyCollection::displayCollection( QWidget *p ) const
{
//KMessageBox::information(p,collection(),i18n("Collected Notes"));
KDialog *dlg = new KDialog( p );
dlg->setCaption( i18n( "Collected Notes" ) );
dlg->setButtons( KDialog::Close );
dlg->setDefaultButton( KDialog::Close );
dlg->setModal( false );
KTextEdit *text = new KTextEdit( dlg );
text->setReadOnly( true );
text->setText( collection() );
dlg->setMainWidget( text );
dlg->setMinimumWidth( 300 );
dlg->setMinimumHeight( 300 );
dlg->show();
}
示例11: 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();
}
}
示例12: executeRealFileOrDir
void KNewFileMenuPrivate::executeRealFileOrDir(const KNewFileMenuSingleton::Entry& entry)
{
// The template is not a desktop file
// Show the small dialog for getting the destination filename
QString text = entry.text;
text.remove("..."); // the ... is fine for the menu item but not for the default filename
text = text.trimmed(); // In some languages, there is a space in front of "...", see bug 268895
m_strategy.m_src = entry.templatePath;
KUrl defaultFile(m_popupFiles.first());
defaultFile.addPath(KIO::encodeFileName(text));
if (defaultFile.isLocalFile() && QFile::exists(defaultFile.toLocalFile()))
text = KIO::RenameDialog::suggestName(m_popupFiles.first(), text);
KDialog* fileDialog = new KDialog(m_parentWidget);
fileDialog->setAttribute(Qt::WA_DeleteOnClose);
fileDialog->setModal(q->isModal());
fileDialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget* mainWidget = new QWidget(fileDialog);
QVBoxLayout *layout = new QVBoxLayout(mainWidget);
QLabel *label = new QLabel(entry.comment);
// We don't set the text of lineEdit in its constructor because the clear button would not be shown then.
// It seems that setClearButtonShown(true) must be called *before* the text is set to make it work.
// TODO: should probably be investigated and fixed in KLineEdit.
KLineEdit *lineEdit = new KLineEdit;
lineEdit->setClearButtonShown(true);
lineEdit->setText(text);
_k_slotTextChanged(text);
QObject::connect(lineEdit, SIGNAL(textChanged(const QString &)), q, SLOT(_k_slotTextChanged(const QString &)));
layout->addWidget(label);
layout->addWidget(lineEdit);
fileDialog->setMainWidget(mainWidget);
QObject::connect(fileDialog, SIGNAL(accepted()), q, SLOT(_k_slotRealFileOrDir()));
QObject::connect(fileDialog, SIGNAL(rejected()), q, SLOT(_k_slotAbortDialog()));
fileDialog->show();
lineEdit->selectAll();
lineEdit->setFocus();
}
示例13: 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)));
}
示例14: showPropertiesDialog
void Task::showPropertiesDialog()
{
if (m_taskType != GroupType || !(m_applet->groupManager()->taskGrouper()->editableGroupProperties() & TaskManager::AbstractGroupingStrategy::Name))
{
return;
}
QWidget *groupWidget = new QWidget;
m_groupUi.setupUi(groupWidget);
m_groupUi.icon->setIcon(m_group->icon());
m_groupUi.name->setText(m_group->name());
KDialog *groupDialog = new KDialog;
groupDialog->setMainWidget(groupWidget);
groupDialog->setButtons(KDialog::Cancel | KDialog::Ok);
connect(groupDialog, SIGNAL(okClicked()), this, SLOT(setProperties()));
groupDialog->setWindowTitle(i18n("%1 Settings", m_group->name()));
groupDialog->show();
}
示例15: checkSection
void Changecase::checkSection(QTextDocument *document, int startPosition, int endPosition)
{
m_cursor = QTextCursor(document);
m_cursor.setPosition(startPosition);
m_cursor.setPosition(endPosition, QTextCursor::KeepAnchor);
m_document = document;
m_startPosition = startPosition;
m_endPosition = endPosition;
KDialog *dialog = new KDialog();
dialog->setCaption(i18n("Change case"));
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
QWidget *widget = new QWidget(dialog);
m_sentenceCaseRadio = new QRadioButton(i18n("Sentence case"));
m_lowerCaseRadio = new QRadioButton(i18n("lowercase"));
m_upperCaseRadio = new QRadioButton(i18n("UPPER CASE"));
m_initialCapsRadio = new QRadioButton(i18n("Initial Caps"));
m_toggleCaseRadio = new QRadioButton(i18n("tOGGLE cASE"));
QVBoxLayout *vLayout = new QVBoxLayout;
vLayout->addWidget(m_sentenceCaseRadio);
vLayout->addWidget(m_lowerCaseRadio);
vLayout->addWidget(m_upperCaseRadio);
vLayout->addWidget(m_initialCapsRadio);
vLayout->addWidget(m_toggleCaseRadio);
widget->setLayout(vLayout);
dialog->setMainWidget(widget);
dialog->show();
connect(dialog, SIGNAL(accepted()), this, SLOT(process()));
}