本文整理汇总了C++中KGuiItem类的典型用法代码示例。如果您正苦于以下问题:C++ KGuiItem类的具体用法?C++ KGuiItem怎么用?C++ KGuiItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KGuiItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q3Wizard
K3Wizard::K3Wizard( QWidget *parent, const char *name, bool modal, Qt::WFlags f )
: Q3Wizard( parent, name, modal, f )
{
bool useIcons = KGlobalSettings::showIconsOnPushButtons();
if ( useIcons )
{
KGuiItem back = KStandardGuiItem::back( KStandardGuiItem::UseRTL );
KGuiItem forward = KStandardGuiItem::forward( KStandardGuiItem::UseRTL );
backButton()->setIcon( back.icon() );
nextButton()->setIcon( forward.icon() );
finishButton()->setIcon( KIcon( "dialog-ok-apply" ) );
cancelButton()->setIcon( KIcon( "dialog-cancel" ) );
helpButton()->setIcon( KIcon( "help-contents" ) );
backButton()->setText( i18n( "&Back" ) );
nextButton()->setText( i18nc( "Opposite to Back","&Next" ) );
}
QFont font = titleFont();
font.setBold( true );
setTitleFont( font );
}
示例2: caption
bool Document::fileClose()
{
if ( isModified() )
{
// If the filename is empty then it must be an untitled file.
QString name = m_url.fileName().isEmpty() ? caption() : m_url.fileName();
if ( ViewContainer * viewContainer = (activeView() ? activeView()->viewContainer() : 0l) )
KTechlab::self()->tabWidget()->setCurrentPage( KTechlab::self()->tabWidget()->indexOf(viewContainer) );
KGuiItem saveItem = KStandardGuiItem::yes();
saveItem.setText( i18n("Save") );
saveItem.setIconName( "filesave" );
KGuiItem discardItem = KStandardGuiItem::no();
discardItem.setText( i18n("Discard") );
int choice = KMessageBox::warningYesNoCancel( KTechlab::self(),
i18n("The document \'%1\' has been modified.\nDo you want to save it?").arg(name),
i18n("Save Document?"),
saveItem,
discardItem );
if ( choice == KMessageBox::Cancel )
return false;
if ( choice == KMessageBox::Yes )
fileSave();
}
deleteLater();
return true;
}
示例3: KDialogBase
//-----------------------------------------------------------------------------
SolvingRateDialog::SolvingRateDialog(const BaseField &field, QWidget *parent)
: KDialogBase(Plain, i18n("Compute Solving Rate"), Ok|Close,
Close, parent, "compute_solving_rate", true, true),
_refField(field)
{
connect(&_solver, SIGNAL(solvingDone(bool)), SLOT(solvingDone(bool)));
KGuiItem item = KStdGuiItem::ok();
item.setText(i18n("Start"));
setButtonOK(item);
QVBoxLayout *top = new QVBoxLayout(plainPage(), 0, spacingHint());
QLabel *label = new QLabel(i18n("Width: %1").arg(field.width()),
plainPage());
top->addWidget(label);
label = new QLabel(i18n("Height: %1").arg(field.height()), plainPage());
top->addWidget(label);
label = new QLabel(i18n("Mines: %1 (%2%)").arg(field.nbMines())
.arg( field.nbMines() * 100.0 / field.size()),
plainPage());
top->addWidget(label);
top->addSpacing(spacingHint());
_progress = new KProgress(NB_STEPS, plainPage());
_progress->setTextEnabled(true);
_progress->setFormat("%v");
top->addWidget(_progress);
_label = new QLabel(i18n("Success rate:"), plainPage());
top->addWidget(_label);
}
示例4: KDialogBase
ProgrammerDlg::ProgrammerDlg( const QString & picID, QWidget *parent, const char *name )
: KDialogBase( parent, name, true, i18n("PIC Programmer"), Ok|Cancel )
{
// Change the "Ok" button to a "Burn" button
KGuiItem burnItem = KStdGuiItem::ok();
burnItem.setText( i18n("Burn") );
setButtonOK( burnItem );
m_bAccepted = false;
m_pProgrammerWidget = new ProgrammerWidget( this );
m_pProgrammerSettings = new PicProgrammerSettings;
// Setup the list of programmers
KComboBox * programmerCombo = m_pProgrammerWidget->m_pProgrammerProgram;
QStringList programmerNames = m_pProgrammerSettings->configNames( false );
programmerCombo->insertStringList( programmerNames );
programmerCombo->setSizeLimit( programmerNames.size() );
programmerCombo->setCurrentText( KTLConfig::picProgrammerProgram() );
// Sets up the list of ports
m_pProgrammerWidget->m_pPicProgrammerPort->insertStringList( Port::ports( Port::ExistsAndRW ) );
m_pProgrammerWidget->m_pPicProgrammerPort->setCurrentText( KTLConfig::picProgrammerPort() );
// Set the pic type to the one requested
if ( !picID.isEmpty() )
m_pProgrammerWidget->m_pMicroSelect->setMicro( picID );
setMainWidget( m_pProgrammerWidget );
}
示例5: QWizard
KWizard::KWizard( QWidget *parent, const char *name, bool modal, WFlags f )
: QWizard( parent, name, modal, f )
{
bool useIcons = KGlobalSettings::showIconsOnPushButtons();
if ( useIcons )
{
KGuiItem back = KStdGuiItem::back( KStdGuiItem::UseRTL );
KGuiItem forward = KStdGuiItem::forward( KStdGuiItem::UseRTL );
backButton()->setIconSet( back.iconSet() );
nextButton()->setIconSet( forward.iconSet() );
finishButton()->setIconSet( SmallIconSet( "apply" ) );
cancelButton()->setIconSet( SmallIconSet( "button_cancel" ) );
helpButton()->setIconSet( SmallIconSet( "help" ) );
backButton()->setText( i18n( "&Back" ) );
nextButton()->setText( i18n( "Opposite to Back","&Next" ) );
}
QFont font = titleFont();
font.setBold( true );
setTitleFont( font );
}
示例6: QObject
KAction::KAction( const KGuiItem& item, const KShortcut& cut,
const QObject* receiver, const char* slot,
KActionCollection* parent, const char* name )
: QObject( parent, name ), d(new KActionPrivate)
{
initPrivate( item.text(), cut, receiver, slot );
if( item.hasIcon() )
setIcon( item.iconName() );
setToolTip( item.toolTip() );
setWhatsThis( item.whatsThis() );
}
示例7: slotClearHistory
void KonqSidebarHistoryModule::slotClearHistory()
{
KGuiItem guiitem = KStdGuiItem::clear();
guiitem.setIconSet( SmallIconSet("history_clear"));
if ( KMessageBox::warningContinueCancel( tree(),
i18n("Do you really want to clear "
"the entire history?"),
i18n("Clear History?"), guiitem )
== KMessageBox::Continue )
KonqHistoryManager::kself()->emitClear();
}
示例8: QWidget
ChooseProvidersPage::ChooseProvidersPage( QWidget *parent, Qt::WindowFlags f )
: QWidget( parent, f )
, m_providersModel( 0 )
{
setupUi( this );
KGuiItem configure = KStandardGuiItem::configure();
configure.setText( i18n( "Configure Synchronization..." ) );
buttonBox->addButton( configure, QDialogButtonBox::ActionRole, this, SLOT(openConfiguration()) );
buttonBox->addButton( KGuiItem( i18n( "Next" ), "go-next" ), QDialogButtonBox::AcceptRole );
connect( buttonBox, SIGNAL(accepted()), SIGNAL(accepted()) );
connect( buttonBox, SIGNAL(rejected()), SIGNAL(rejected()) );
progressBar->hide();
}
示例9: slotEditReset
void ContextHelp::slotEditReset()
{
if ( isEditChanged() )
{
KGuiItem continueItem = KStandardGuiItem::cont(); //KStandardGuiItem::cont();
continueItem.setText( i18n("Reset") );
int answer = KMessageBox::warningContinueCancel( this, i18n("Reset item help to last saved changes?"), i18n("Reset"), continueItem );
if ( answer == KMessageBox::Cancel )
return;
}
m_pWidgetStack->raiseWidget( 0 );
}
示例10: setObjectName
void KexiDBConnectionDialog::init(const KGuiItem& acceptButtonGuiItem)
{
setObjectName("KexiDBConnectionDialog");
setButtons(KDialog::User1 | KDialog::Cancel | KDialog::Help);
setButtonGuiItem(KDialog::User1,
acceptButtonGuiItem.text().isEmpty()
? KGuiItem(i18n("&Open"), "document-open", i18n("Open Database Connection"))
: acceptButtonGuiItem
);
setModal(true);
setMainWidget(m_tabWidget);
connect(this, SIGNAL(user1Clicked()), this, SLOT(accept()));
connect(m_tabWidget->mainWidget, SIGNAL(saveChanges()), this, SIGNAL(saveChanges()));
connect(m_tabWidget, SIGNAL(testConnection()), this, SIGNAL(testConnection()));
adjustSize();
resize(width(), m_tabWidget->height());
if (m_tabWidget->mainWidget->connectionOnly())
m_tabWidget->mainWidget->driversCombo()->setFocus();
else if (m_tabWidget->mainWidget->nameCombo->currentText().isEmpty())
m_tabWidget->mainWidget->nameCombo->setFocus();
else if (m_tabWidget->mainWidget->userEdit->text().isEmpty())
m_tabWidget->mainWidget->userEdit->setFocus();
else if (m_tabWidget->mainWidget->passwordEdit->text().isEmpty())
m_tabWidget->mainWidget->passwordEdit->setFocus();
else //back
m_tabWidget->mainWidget->nameCombo->setFocus();
}
示例11: assign
void KGuiItem::assign(QPushButton *button, const KGuiItem &item)
{
button->setText(item.d->m_text);
button->setIcon(item.icon());
button->setToolTip(item.d->m_toolTip);
button->setWhatsThis(item.d->m_whatsThis);
}
示例12: KoDialog
CharacterSelectDialog::CharacterSelectDialog(QWidget *parent, const QString &name, const QChar &_chr, const QString &_font, bool _modal)
: KoDialog(parent),
d(new Private())
{
setCaption(i18n("Select Character"));
setModal(_modal);
setButtons(Ok | Cancel);
setDefaultButton(Ok);
setObjectName(name);
initDialog(_chr, _font);
KGuiItem okItem = KStandardGuiItem::ok(); // start from std item to keep the OK icon...
okItem.setText(i18n("&Insert"));
okItem.setWhatsThis(i18n("Insert the selected character in the text"));
setButtonGuiItem(KoDialog::Ok, okItem);
}
示例13: removeSlot
void ConfigDialog::removeSlot()
{
KGuiItem gi = KStandardGuiItem::clear();
gi.setText(i18n("Remove"));
int res = KMessageBox::warningContinueCancel(this,
i18n("This will permanently remove your "
"registration key. You will not be able to use "
"the currently registered nickname anymore."),
QString(), gi);
if ( res==KMessageBox::Continue ) {
internal->playerInfos().removeKey();
_registeredName->clear();
_key->clear();
_removeButton->setEnabled(false);
_WWHEnabled->setChecked(false);
modifiedSlot();
}
}
示例14: tr
void HighscoresDialog::slotUser2()
{
// kDebug(11001) ;
QUrl url = QFileDialog::getSaveFileUrl(this, tr("HighscoresDialog"), QUrl(), QString());
if ( url.isEmpty() ) return;
if ( KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this) ) {
KGuiItem gi = KStandardGuiItem::save();
gi.setText(i18n("Overwrite"));
int res = KMessageBox::warningContinueCancel(this,
i18n("The file already exists. Overwrite?"),
i18n("Export"), gi);
if ( res==KMessageBox::Cancel ) return;
}
QTemporaryFile tmp;
tmp.open();
QTextStream stream(&tmp);
internal->exportHighscores(stream);
stream.flush();
KIO::NetAccess::upload(tmp.fileName(), url, this);
}
示例15: i18nc
void GvCore::slotSaveResult(KJob* _job)
{
SaveJob* job = static_cast<SaveJob*>(_job);
KUrl oldUrl = job->oldUrl();
KUrl newUrl = job->newUrl();
if (job->error()) {
QString name = newUrl.fileName().isEmpty() ? newUrl.pathOrUrl() : newUrl.fileName();
QString msg = i18nc("@info", "<b>Saving <filename>%1</filename> failed:</b><br>%2",
name, job->errorString());
int result = KMessageBox::warningContinueCancel(
d->mMainWindow, msg,
QString() /* caption */,
KStandardGuiItem::saveAs());
if (result == KMessageBox::Continue) {
saveAs(newUrl);
}
return;
}
if (oldUrl != newUrl) {
d->mMainWindow->goToUrl(newUrl);
ViewMainPage* page = d->mMainWindow->viewMainPage();
if (page->isVisible()) {
HudMessageBubble* bubble = new HudMessageBubble();
bubble->setText(i18n("You are now viewing the new document."));
KGuiItem item = KStandardGuiItem::back();
item.setText(i18n("Go back to the original"));
HudButton* button = bubble->addButton(item);
BinderRef<MainWindow, KUrl>::bind(button, SIGNAL(clicked()), d->mMainWindow, &MainWindow::goToUrl, oldUrl);
connect(button, SIGNAL(clicked()),
bubble, SLOT(deleteLater()));
page->showMessageWidget(bubble);
}
}
}