本文整理汇总了C++中KToggleAction::setIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ KToggleAction::setIcon方法的具体用法?C++ KToggleAction::setIcon怎么用?C++ KToggleAction::setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KToggleAction
的用法示例。
在下文中一共展示了KToggleAction::setIcon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
ToggleViewGUIClient::ToggleViewGUIClient( KonqMainWindow *mainWindow )
: QObject( mainWindow )
{
m_mainWindow = mainWindow;
KService::List offers = KServiceTypeTrader::self()->query( "Browser/View" );
KService::List::Iterator it = offers.begin();
while ( it != offers.end() )
{
QVariant prop = (*it)->property( "X-KDE-BrowserView-Toggable" );
QVariant orientation = (*it)->property( "X-KDE-BrowserView-ToggableView-Orientation" );
if ( !prop.isValid() || !prop.toBool() ||
!orientation.isValid() || orientation.toString().isEmpty() )
{
offers.erase( it );
it = offers.begin();
}
else
++it;
}
m_empty = ( offers.count() == 0 );
if ( m_empty )
return;
KService::List::ConstIterator cIt = offers.constBegin();
KService::List::ConstIterator cEnd = offers.constEnd();
for (; cIt != cEnd; ++cIt )
{
QString description = i18n( "Show %1" , (*cIt)->name() );
QString name = (*cIt)->desktopEntryName();
//kDebug() << "ToggleViewGUIClient: name=" << name;
KToggleAction *action = new KToggleAction( description, this );
mainWindow->actionCollection()->addAction( name.toLatin1(), action );
// HACK
if ( (*cIt)->icon() != "unknown" )
action->setIcon( KIcon((*cIt)->icon()) );
connect( action, SIGNAL(toggled(bool)),
this, SLOT(slotToggleView(bool)) );
m_actions.insert( name, action );
QVariant orientation = (*cIt)->property( "X-KDE-BrowserView-ToggableView-Orientation" );
bool horizontal = orientation.toString().toLower() == "horizontal";
m_mapOrientation.insert( name, horizontal );
}
connect( m_mainWindow, SIGNAL(viewAdded(KonqView*)),
this, SLOT(slotViewAdded(KonqView*)) );
connect( m_mainWindow, SIGNAL(viewRemoved(KonqView*)),
this, SLOT(slotViewRemoved(KonqView*)) );
}
示例2: addActionCloneToCollection
void MainWindow::addActionCloneToCollection(const QString &actionName, QAction *action)
{
// XXX This is a dirty hack to avoid the warning "Attempt to use QAction with KXMLGUIFactory"
KToggleAction *actionClone = new KToggleAction(this);
actionCollection()->addAction(actionName, actionClone);
actionClone->setText(action->text());
actionClone->setIcon(action->icon());
connect(action, SIGNAL(toggled(bool)), actionClone, SLOT(setChecked(bool)));
connect(actionClone, SIGNAL(triggered()), action, SLOT(trigger()));
}
示例3: KToggleAction
KToggleAction* K3b::createToggleAction( QObject* parent,
const QString& text, const QString& icon, const
QKeySequence& shortcut, QObject* receiver, const char* slot,
KActionCollection* actionCollection,
const QString& actionName )
{
KToggleAction* action = new KToggleAction( parent );
action->setText( text );
if( !icon.isEmpty() ) {
action->setIcon( QIcon::fromTheme( icon ) );
}
action->setShortcut( shortcut );
if( receiver ) {
QObject::connect( action, SIGNAL(triggered(bool)),
receiver, slot );
}
if( actionCollection ) {
actionCollection->addAction( actionName, action );
}
return action;
}
示例4: initToolBars
void InlineEditors::initToolBars(KActionCollection *ac)
{
QFont defaultFont;
QColor textColor = (Global::bnpView && Global::bnpView->currentBasket() ?
Global::bnpView->currentBasket()->textColor() :
palette().color(QPalette::Text));
// Init the RichTextEditor Toolbar:
richTextFont = new QFontComboBox(Global::mainWindow());
focusWidgetFilter = new FocusWidgetFilter(richTextFont);
richTextFont->setFixedWidth(richTextFont->sizeHint().width() * 2 / 3);
richTextFont->setCurrentFont(defaultFont.family());
KAction *action = ac->addAction("richtext_font");
action->setDefaultWidget(richTextFont);
action->setText(i18n("Font"));
action->setShortcut(Qt::Key_F6);
richTextFontSize = new FontSizeCombo(/*rw=*/true, Global::mainWindow());
richTextFontSize->setFontSize(defaultFont.pointSize());
action = ac->addAction("richtext_font_size");
action->setDefaultWidget(richTextFontSize);
action->setText(i18n("Font Size"));
action->setShortcut(Qt::Key_F7);
richTextColor = new KColorCombo(Global::mainWindow());
richTextColor->installEventFilter(focusWidgetFilter);
richTextColor->setFixedWidth(richTextColor->sizeHint().height() * 2);
richTextColor->setColor(textColor);
action = ac->addAction("richtext_color");
action->setDefaultWidget(richTextColor);
action->setText(i18n("Color"));
KToggleAction *ta = NULL;
ta = new KToggleAction(ac);
ac->addAction("richtext_bold", ta);
ta->setText(i18n("Bold"));
ta->setIcon(KIcon("format-text-bold"));
ta->setShortcut(KShortcut("Ctrl+B"));
richTextBold = ta;
ta = new KToggleAction(ac);
ac->addAction("richtext_italic", ta);
ta->setText(i18n("Italic"));
ta->setIcon(KIcon("format-text-italic"));
ta->setShortcut(KShortcut("Ctrl+I"));
richTextItalic = ta;
ta = new KToggleAction(ac);
ac->addAction("richtext_underline", ta);
ta->setText(i18n("Underline"));
ta->setIcon(KIcon("format-text-underline"));
ta->setShortcut(KShortcut("Ctrl+U"));
richTextUnderline = ta;
#if 0
ta = new KToggleAction(ac);
ac->addAction("richtext_super", ta);
ta->setText(i18n("Superscript"));
ta->setIcon(KIcon("text_super"));
richTextSuper = ta;
ta = new KToggleAction(ac);
ac->addAction("richtext_sub", ta);
ta->setText(i18n("Subscript"));
ta->setIcon(KIcon("text_sub"));
richTextSub = ta;
#endif
ta = new KToggleAction(ac);
ac->addAction("richtext_left", ta);
ta->setText(i18n("Align Left"));
ta->setIcon(KIcon("format-justify-left"));
richTextLeft = ta;
ta = new KToggleAction(ac);
ac->addAction("richtext_center", ta);
ta->setText(i18n("Centered"));
ta->setIcon(KIcon("format-justify-center"));
richTextCenter = ta;
ta = new KToggleAction(ac);
ac->addAction("richtext_right", ta);
ta->setText(i18n("Align Right"));
ta->setIcon(KIcon("format-justify-right"));
richTextRight = ta;
ta = new KToggleAction(ac);
ac->addAction("richtext_block", ta);
ta->setText(i18n("Justified"));
ta->setIcon(KIcon("format-justify-fill"));
richTextJustified = ta;
QActionGroup *alignmentGroup = new QActionGroup(this);
alignmentGroup->addAction(richTextLeft);
alignmentGroup->addAction(richTextCenter);
alignmentGroup->addAction(richTextRight);
alignmentGroup->addAction(richTextJustified);
ta = new KToggleAction(ac);
//.........这里部分代码省略.........
示例5: initMainWidget
void ActionManagerImpl::initMainWidget(MainWidget* mainWidget)
{
if (d->mainWidget)
return;
d->mainWidget = mainWidget;
KActionCollection* coll = actionCollection();
// Feed/Feed Group popup menu
KAction* action = coll->addAction("feed_homepage");
action->setText(i18n("&Open Homepage"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotOpenHomepage()));
action->setShortcuts(KShortcut( "Ctrl+H" ));
action = coll->addAction("reload_all_tabs");
action->setIcon(KIcon("view-refresh"));
action->setText(i18n("Reload All Tabs"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotReloadAllTabs()));
action->setShortcuts(KShortcut( "Shift+F5" ));
action = coll->addAction("feed_add");
action->setIcon(KIcon("feed-subscribe"));
action->setText(i18n("&Add Feed..."));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAdd()));
action->setShortcuts(KShortcut( "Insert" ));
action = coll->addAction("feed_add_group");
action->setIcon(KIcon("folder-new"));
action->setText(i18n("Ne&w Folder..."));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedAddGroup()));
action->setShortcuts(KShortcut( "Shift+Insert" ));
action = coll->addAction("feed_remove");
action->setIcon(KIcon("edit-delete"));
action->setText(i18n("&Delete Feed"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedRemove()));
action->setShortcuts(KShortcut( "Alt+Delete" ));
action = coll->addAction("feed_modify");
action->setIcon(KIcon("document-properties"));
action->setText(i18n("&Edit Feed..."));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFeedModify()));
action->setShortcuts(KShortcut( "F2" ));
// toolbar / View
action = coll->addAction("normal_view");
action->setIcon(KIcon("view-split-top-bottom"));
action->setText(i18n("&Normal View"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotNormalView()));
action->setShortcuts(KShortcut( "Ctrl+Shift+1" ));
action = coll->addAction("widescreen_view");
action->setIcon(KIcon("view-split-left-right"));
action->setText(i18n("&Widescreen View"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotWidescreenView()));
action->setShortcuts(KShortcut( "Ctrl+Shift+2" ));
action = coll->addAction("combined_view");
action->setIcon(KIcon("view-list-text"));
action->setText(i18n("C&ombined View"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotCombinedView()));
action->setShortcuts(KShortcut( "Ctrl+Shift+3" ));
// toolbar / feed menu
action = coll->addAction("feed_fetch");
action->setIcon(KIcon("go-down"));
action->setText(i18n("&Fetch Feed"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchCurrentFeed()));
action->setShortcuts(KStandardShortcut::shortcut(KStandardShortcut::Reload));
action = coll->addAction("feed_fetch_all");
action->setIcon(KIcon("go-bottom"));
action->setText(i18n("Fe&tch All Feeds"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotFetchAllFeeds()));
action->setShortcuts(KShortcut( "Ctrl+L" ));
KAction *stopAction = coll->addAction("feed_stop");
stopAction->setIcon(KIcon("process-stop"));
stopAction->setText(i18n("C&ancel Feed Fetches"));
connect(stopAction, SIGNAL(triggered(bool)), Kernel::self()->fetchQueue(), SLOT(slotAbort()));
stopAction->setShortcut(QKeySequence(Qt::Key_Escape));
stopAction->setEnabled(false);
action = coll->addAction("feed_mark_all_as_read");
action->setIcon(KIcon("mail-mark-read"));
action->setText(i18n("&Mark Feed as Read"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllRead()));
action->setShortcuts(KShortcut( "Ctrl+R" ));
action = coll->addAction("feed_mark_all_feeds_as_read");
action->setIcon(KIcon("mail-mark-read"));
action->setText(i18n("Ma&rk All Feeds as Read"));
connect(action, SIGNAL(triggered(bool)), d->mainWidget, SLOT(slotMarkAllFeedsRead()));
action->setShortcuts(KShortcut( "Ctrl+Shift+R" ));
// Settings menu
KToggleAction *sqf = coll->add<KToggleAction>("show_quick_filter");
sqf->setText(i18n("Show Quick Filter"));
//.........这里部分代码省略.........