本文整理汇总了C++中KDialog::exec方法的典型用法代码示例。如果您正苦于以下问题:C++ KDialog::exec方法的具体用法?C++ KDialog::exec怎么用?C++ KDialog::exec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KDialog
的用法示例。
在下文中一共展示了KDialog::exec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
void RKCaughtX11Window::copyDeviceToRObject () {
RK_TRACE (MISC);
// TODO: not very pretty, yet
KDialog *dialog = new KDialog (this);
dialog->setButtons (KDialog::Ok|KDialog::Cancel);
dialog->setCaption (i18n ("Specify R object"));
dialog->setModal (true);
KVBox *page = new KVBox (dialog);
dialog->setMainWidget (page);
new QLabel (i18n ("Specify the R object name, you want to save the graph to"), page);
RKSaveObjectChooser *chooser = new RKSaveObjectChooser (page, "my.plot");
connect (chooser, SIGNAL (changed(bool)), dialog, SLOT (enableButtonOk(bool)));
if (!chooser->isOk ()) dialog->enableButtonOk (false);
dialog->exec ();
if (dialog->result () == QDialog::Accepted) {
RK_ASSERT (chooser->isOk ());
QString name = chooser->currentFullName ();
RKGlobals::rInterface ()->issueCommand ("dev.set (" + QString::number (device_number) + ")\n" + name + " <- recordPlot ()", RCommand::App | RCommand::ObjectListUpdate, i18n ("Save contents of graphics device number %1 to object '%2'", device_number, name), error_dialog);
}
delete dialog;
}
示例2: main
int main( int argc, char **argv )
{
KCmdLineArgs::init( argc, argv, "klistviewtest", 0, ki18n("K3ListViewTest"), "1.0", ki18n("klistview test app"));
KApplication app;
KDialog dialog;
K3ListView *view = new K3ListView();
dialog.setMainWidget(view);
view->setSelectionModeExt( K3ListView::FileManager );
view->setDragEnabled( true );
view->setItemsMovable( false );
view->setAcceptDrops( true );
view->addColumn("Column 1");
view->addColumn("Column 2");
view->addColumn("Column 3");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 1");
new K3ListViewItem( view, "Item 2", "Some more", "Hi Mom :)" );
view->restoreLayout( KGlobal::config().data(), "ListView" );
new K3ListViewItem( view, "Item 3" );
dialog.exec();
view->saveLayout( KGlobal::config().data(), "ListView" );
return 0;
}
示例3: slotEditData
void Klipper::slotEditData()
{
const HistoryStringItem* item = dynamic_cast<const HistoryStringItem*>(m_history->first());
KDialog dlg;
dlg.setModal( true );
dlg.setCaption( i18n("Edit Contents") );
dlg.setButtons( KDialog::Ok | KDialog::Cancel );
KTextEdit *edit = new KTextEdit( &dlg );
if (item) {
edit->setText( item->text() );
}
edit->setFocus();
edit->setMinimumSize( 300, 40 );
dlg.setMainWidget( edit );
dlg.adjustSize();
if ( dlg.exec() == KDialog::Accepted ) {
QString text = edit->toPlainText();
if (item) {
m_history->remove( item );
}
m_history->insert( new HistoryStringItem(text) );
if (m_myURLGrabber) {
m_myURLGrabber->checkNewData( m_history->first() );
}
}
}
示例4: slotShowBarcode
void Klipper::slotShowBarcode()
{
using namespace prison;
const HistoryStringItem* item = dynamic_cast<const HistoryStringItem*>(m_history->first());
KDialog dlg;
dlg.setModal( true );
dlg.setCaption( i18n("Mobile Barcode") );
dlg.setButtons( KDialog::Ok );
QWidget* mw = new QWidget(&dlg);
QHBoxLayout* layout = new QHBoxLayout(mw);
BarcodeWidget* qrcode = new BarcodeWidget(new QRCodeBarcode());
BarcodeWidget* datamatrix = new BarcodeWidget(new DataMatrixBarcode());
if (item) {
qrcode->setData( item->text() );
datamatrix->setData( item->text() );
}
layout->addWidget(qrcode);
layout->addWidget(datamatrix);
mw->setFocus();
dlg.setMainWidget( mw );
dlg.adjustSize();
dlg.exec();
}
示例5: backgroundColor
KoFilter::ConversionStatus
PngExport::convert( const QByteArray& from, const QByteArray& to )
{
if ( to != "image/png" || from != "application/vnd.oasis.opendocument.graphics" )
{
return KoFilter::NotImplemented;
}
KoDocument * document = m_chain->inputDocument();
if( ! document )
return KoFilter::ParsingError;
KarbonPart * karbonPart = dynamic_cast<KarbonPart*>( document );
if( ! karbonPart )
return KoFilter::WrongFormat;
KoShapePainter painter;
painter.setShapes( karbonPart->document().shapes() );
// get the bounding rect of the content
QRectF shapesRect = painter.contentRect();
// get the size on point
QSizeF pointSize = shapesRect.size();
// get the size in pixel (100% zoom)
KoZoomHandler zoomHandler;
QSize pixelSize = zoomHandler.documentToView( pointSize ).toSize();
QColor backgroundColor( Qt::white );
if( ! m_chain->manager()->getBatchMode() )
{
PngExportOptionsWidget * widget = new PngExportOptionsWidget( pointSize );
widget->setUnit( karbonPart->unit() );
widget->setBackgroundColor( backgroundColor );
KDialog dlg;
dlg.setCaption( i18n("PNG Export Options") );
dlg.setButtons( KDialog::Ok | KDialog::Cancel );
dlg.setMainWidget( widget );
if( dlg.exec() != QDialog::Accepted )
return KoFilter::UserCancelled;
pixelSize = widget->pixelSize();
backgroundColor = widget->backgroundColor();
}
QImage image( pixelSize, QImage::Format_ARGB32 );
// draw the background of the image
image.fill( backgroundColor.rgba() );
// paint the shapes
if( ! painter.paintShapes( image ) )
return KoFilter::CreationError;
image.save( m_chain->outputFile(), "PNG" );
return KoFilter::OK;
}
示例6: KDialog
// new groups
void KNGroupDialog::slotUser2()
{
QDate lastDate = a_ccount->lastNewFetch();
KDialog *dlg = new KDialog( this );
dlg->setCaption( i18n("New Groups") );
dlg->setButtons( Ok | Cancel );
QGroupBox *btnGrp = new QGroupBox( i18n("Check for New Groups"), dlg );
dlg->setMainWidget(btnGrp);
QGridLayout *topL = new QGridLayout( btnGrp );
QRadioButton *takeLast = new QRadioButton( i18n("Created since last check:"), btnGrp );
topL->addWidget(takeLast, 0, 0, 1, 2 );
QLabel *l = new QLabel(KGlobal::locale()->formatDate(lastDate, KLocale::LongDate),btnGrp);
topL->addWidget(l, 1, 1, Qt::AlignLeft);
connect(takeLast, SIGNAL(toggled(bool)), l, SLOT(setEnabled(bool)));
QRadioButton *takeCustom = new QRadioButton( i18n("Created since this date:"), btnGrp );
topL->addWidget(takeCustom, 2, 0, 1, 2 );
dateSel = new KDatePicker( lastDate, btnGrp );
dateSel->setMinimumSize(dateSel->sizeHint());
topL->addWidget(dateSel, 3, 1, Qt::AlignLeft);
connect(takeCustom, SIGNAL(toggled(bool)), this, SLOT(slotDatePickerEnabled(bool)));
takeLast->setChecked(true);
dateSel->setEnabled(false);
topL->addItem( new QSpacerItem(30, 0 ), 0, 0 );
if (dlg->exec()) {
if (takeCustom->isChecked())
lastDate = dateSel->date();
a_ccount->setLastNewFetch(QDate::currentDate());
leftLabel->setText(i18n("Checking for new groups..."));
enableButton(User1,false);
enableButton(User2,false);
filterEdit->clear();
subCB->setChecked(false);
newCB->setChecked(true);
emit(checkNew(a_ccount,lastDate));
incrementalFilter=false;
slotRefilter();
}
delete dlg;
}
示例7: showKeyBindingEditor
void EditProfileDialog::showKeyBindingEditor(bool isNewTranslator)
{
QModelIndexList selected = _ui->keyBindingList->selectionModel()->selectedIndexes();
QAbstractItemModel* model = _ui->keyBindingList->model();
const KeyboardTranslator* translator = 0;
if ( !selected.isEmpty() )
translator = model->data(selected.first(),Qt::UserRole+1).value<const KeyboardTranslator*>();
else
translator = KeyboardTranslatorManager::instance()->defaultTranslator();
Q_ASSERT(translator);
KDialog* dialog = new KDialog(this);
if ( isNewTranslator )
dialog->setCaption(i18n("New Key Binding List"));
else
dialog->setCaption(i18n("Edit Key Binding List"));
KeyBindingEditor* editor = new KeyBindingEditor;
dialog->setMainWidget(editor);
if ( translator )
editor->setup(translator);
if ( isNewTranslator )
editor->setDescription(i18n("New Key Binding List"));
if ( dialog->exec() == QDialog::Accepted )
{
KeyboardTranslator* newTranslator = new KeyboardTranslator(*editor->translator());
if ( isNewTranslator )
newTranslator->setName(newTranslator->description());
KeyboardTranslatorManager::instance()->addTranslator( newTranslator );
updateKeyBindingsList();
const QString& currentTranslator = lookupProfile()
->property<QString>(Profile::KeyBindings);
if ( newTranslator->name() == currentTranslator )
{
_tempProfile->setProperty(Profile::KeyBindings,newTranslator->name());
}
}
}
示例8: slotUserInfo
void FacebookContact::slotUserInfo()
{
KDialog infoDialog;
infoDialog.setButtons( KDialog::Close);
infoDialog.setDefaultButton(KDialog::Close);
Ui::FacebookInfo info;
info.setupUi(infoDialog.mainWidget());
info.m_displayName->setText(nickName());
info.m_personalMessage->setPlainText(statusMessage().message());
QVariant picture(property(Kopete::Global::Properties::self()->photo()).value());
info.m_photo->setPixmap(picture.value<QPixmap>());
infoDialog.setCaption(nickName());
infoDialog.exec();
}
示例9: slotChangeEncoding
void CDInfoDialog::slotChangeEncoding()
{
KDialog* dialog = new KDialog(this);
dialog->setCaption(i18n("Change Encoding"));
dialog->setButtons( KDialog::Ok | KDialog::Cancel);
dialog->setModal( true );
QStringList songTitles;
for (int t = 0; t < m_trackModel->rowCount(); ++t) {
QString title = m_trackModel->index(t, Private::TRACK_ARTIST).data().toString().trimmed();
if (!title.isEmpty())
title.append(Private::SEPARATOR);
title.append(m_trackModel->index(t, Private::TRACK_TITLE).data().toString().trimmed());
songTitles << title;
}
KCDDB::CDInfoEncodingWidget* encWidget = new KCDDB::CDInfoEncodingWidget(
dialog, d->ui->m_artist->text(),d->ui->m_title->text(), songTitles);
dialog->setMainWidget(encWidget);
if (dialog->exec())
{
KCharsets* charsets = KGlobal::charsets();
QTextCodec* codec = charsets->codecForName(charsets->encodingForName(encWidget->selectedEncoding()));
d->ui->m_artist->setText(codec->toUnicode(d->ui->m_artist->text().toLatin1()));
d->ui->m_title->setText(codec->toUnicode(d->ui->m_title->text().toLatin1()));
d->ui->m_genre->setItemText(d->ui->m_genre->currentIndex(), codec->toUnicode(d->ui->m_genre->currentText().toLatin1()));
d->ui->m_comment->setText(codec->toUnicode(d->ui->m_comment->text().toLatin1()));
QModelIndex trackIndex = m_trackModel->index(0, 0, QModelIndex());
int trackRows = m_trackModel->rowCount(trackIndex);
for (int t = 0; t < trackRows; ++t) {
QString artist = m_trackModel->index(t, Private::TRACK_ARTIST, trackIndex).data().toString();
m_trackModel->setData(m_trackModel->index(t, Private::TRACK_ARTIST, trackIndex), codec->toUnicode(artist.toLatin1()));
QString title = m_trackModel->index(t, Private::TRACK_TITLE, trackIndex).data().toString();
m_trackModel->setData(m_trackModel->index(t, Private::TRACK_TITLE, trackIndex), codec->toUnicode(title.toLatin1()));
QString comment = m_trackModel->index(t, Private::TRACK_COMMENT, trackIndex).data().toString();
m_trackModel->setData(m_trackModel->index(t, Private::TRACK_COMMENT, trackIndex), codec->toUnicode(comment.toLatin1()));
}
}
}
示例10: ssidSelected
void Wireless80211Widget::scanClicked()
{
Q_D(Wireless80211Widget);
KDialog scanDialog;
scanDialog.setCaption(i18nc("@title:window wireless network scan dialog",
"Available Networks"));
scanDialog.setButtons( KDialog::Ok | KDialog::Cancel);
ScanWidget scanWid;
scanDialog.setMainWidget(&scanWid);
connect(&scanWid,SIGNAL(doubleClicked()),&scanDialog,SLOT(accept()));
if (scanDialog.exec() == QDialog::Accepted) {
QPair<QString,QString> accessPoint = scanWid.currentAccessPoint();
d->ui.ssid->setText(accessPoint.first);
d->ui.bssid->setText(accessPoint.second);
const QPair<Solid::Control::WirelessNetworkInterfaceNm09 *, Solid::Control::AccessPointNm09 *> pair = scanWid.currentAccessPointUni();
emit ssidSelected(pair.first, pair.second);
setAccessPointData(pair.first, pair.second);
}
}
示例11: showColorSchemeEditor
void EditProfileDialog::showColorSchemeEditor(bool isNewScheme)
{
QModelIndexList selected = _ui->colorSchemeList->selectionModel()->selectedIndexes();
QAbstractItemModel* model = _ui->colorSchemeList->model();
const ColorScheme* colors = 0;
if ( !selected.isEmpty() )
colors = model->data(selected.first(),Qt::UserRole+1).value<const ColorScheme*>();
else
colors = ColorSchemeManager::instance()->defaultColorScheme();
Q_ASSERT(colors);
KDialog* dialog = new KDialog(this);
if ( isNewScheme )
dialog->setCaption(i18n("New Color Scheme"));
else
dialog->setCaption(i18n("Edit Color Scheme"));
ColorSchemeEditor* editor = new ColorSchemeEditor;
dialog->setMainWidget(editor);
editor->setup(colors);
if ( isNewScheme )
editor->setDescription(i18n("New Color Scheme"));
if ( dialog->exec() == QDialog::Accepted )
{
ColorScheme* newScheme = new ColorScheme(*editor->colorScheme());
// if this is a new color scheme, pick a name based on the description
if ( isNewScheme )
newScheme->setName(newScheme->description());
ColorSchemeManager::instance()->addColorScheme( newScheme );
updateColorSchemeList(true);
preview(Profile::ColorScheme,newScheme->name());
}
}
示例12: showSourceDialog
void MagnatuneCollectionLocation::showSourceDialog( const Meta::TrackList &tracks, bool removeSources )
{
KDialog dialog;
dialog.setCaption( i18n( "Preview Tracks" ) );
dialog.setButtons( KDialog::Ok | KDialog::Cancel );
QLabel *label = new QLabel( i18n( "The tracks you are about to copy are Magnatune.com preview streams. For better quality and advert free streams, consider buying an album download. Remember that when buying from Magnatune the artist gets 50%. Also if you buy using Amarok, you support the Amarok project with 10%." ) );
label->setWordWrap ( true );
label->setMaximumWidth( 400 );
dialog.setMainWidget( label );
dialog.exec();
if ( dialog.result() == QDialog::Rejected )
abort();
CollectionLocation::showSourceDialog( tracks, removeSources ); // to get transcoding dialog
}
示例13: showEnvironmentEditor
void EditProfileDialog::showEnvironmentEditor()
{
const Profile::Ptr info = lookupProfile();
KDialog* dialog = new KDialog(this);
QTextEdit* edit = new QTextEdit(dialog);
QStringList currentEnvironment = info->property<QStringList>(Profile::Environment);
edit->setPlainText( currentEnvironment.join("\n") );
dialog->setPlainCaption(i18n("Edit Environment"));
dialog->setMainWidget(edit);
if ( dialog->exec() == QDialog::Accepted )
{
QStringList newEnvironment = edit->toPlainText().split('\n');
_tempProfile->setProperty(Profile::Environment,newEnvironment);
}
dialog->deleteLater();
}
示例14: configureSettings
void LogFile::configureSettings(void)
{
QPalette cgroup = monitor->palette();
lfs = new Ui_LogFileSettings;
Q_CHECK_PTR(lfs);
KDialog dlg;
dlg.setCaption( i18n("File logging settings") );
dlg.setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply );
lfs->setupUi(dlg.mainWidget());
lfs->fgColor->setColor(cgroup.color( QPalette::Text ));
lfs->fgColor->setText(i18n("Foreground color:"));
lfs->bgColor->setColor(cgroup.color( QPalette::Base ));
lfs->bgColor->setText(i18n("Background color:"));
lfs->fontRequester->setFont(monitor->font());
lfs->ruleList->addItems(filterRules);
lfs->title->setText(title());
connect(&dlg, SIGNAL(okClicked()), &dlg, SLOT(accept()));
connect(&dlg, SIGNAL(applyClicked()), this, SLOT(applySettings()));
connect(lfs->addButton, SIGNAL(clicked()), this, SLOT(settingsAddRule()));
connect(lfs->deleteButton, SIGNAL(clicked()), this, SLOT(settingsDeleteRule()));
connect(lfs->changeButton, SIGNAL(clicked()), this, SLOT(settingsChangeRule()));
connect(lfs->ruleList, SIGNAL(currentRowChanged(int)), this, SLOT(settingsRuleListSelected(int)));
connect(lfs->ruleText, SIGNAL(returnPressed()), this, SLOT(settingsAddRule()));
connect(lfs->ruleText, SIGNAL(textChanged(QString)), this, SLOT(settingsRuleTextChanged()));
settingsRuleListSelected(lfs->ruleList->currentRow());
settingsRuleTextChanged();
if (dlg.exec())
applySettings();
delete lfs;
lfs = 0;
}
示例15: selectDialog
// **** keyboard selection dialog *********************************************
int KNHelper::selectDialog(QWidget *parent, const QString &caption, const QStringList &options, int initialValue)
{
KDialog *dlg = new KDialog( parent );
dlg->setCaption( caption );
dlg->setButtons( KDialog::Ok|KDialog::Cancel );
dlg->setDefaultButton( KDialog::Ok );
QFrame *page = new QFrame( dlg );
dlg->setMainWidget( page );
QHBoxLayout *pageL = new QHBoxLayout(page);
pageL->setSpacing(5);
pageL->setMargin(8);
QListWidget *list = new QListWidget( page );
pageL->addWidget(list);
QString s;
for ( QStringList::ConstIterator it = options.begin(); it != options.end(); ++it ) {
s = (*it);
// remove accelerators
s.replace( QRegExp( "&" ), "" ); // krazy:exclude=doublequote_chars
list->addItem( s );
}
list->setCurrentRow( initialValue );
list->setFocus();
QObject::connect( list, SIGNAL( itemActivated( QListWidgetItem* ) ), dlg, SLOT( accept() ) );
restoreWindowSize("selectBox", dlg, QSize(247,174));
int ret;
if (dlg->exec())
ret = list->currentRow();
else
ret = -1;
saveWindowSize("selectBox", dlg->size());
delete dlg;
return ret;
}