本文整理汇总了C++中KAction::setDefaultWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::setDefaultWidget方法的具体用法?C++ KAction::setDefaultWidget怎么用?C++ KAction::setDefaultWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::setDefaultWidget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupToolbars
void MainWindow::setupToolbars()
{
kDebug() << "setup toolbars...";
KAction *a;
// location bar
a = new KAction(i18n("Location Bar"), this);
a->setDefaultWidget(m_view->widgetBar());
actionCollection()->addAction( QL1S("url_bar"), a);
KToolBar *mainBar = toolBar("mainToolBar");
mainBar->show(); // this just to fix reopening rekonq after fullscreen close
}
示例2: KLineEdit
MainWindow()
{
// KXMLGUIClient looks in the "data" resource for the .rc files
// This line is for test programs only!
KGlobal::dirs()->addResourceDir( "data", KDESRCDIR );
KVBox* main = new KVBox( this );
setCentralWidget( main );
KSqueezedTextLabel* accel = new KSqueezedTextLabel( "&Really long, long, long and boring text goes here", main );
mainLabel = new KSqueezedTextLabel( "Click me to change Label 1 text", main );
mainLabel->installEventFilter(this);
// first constructor
label1 = new KToolBarLabelAction( "&Label 1", this );
actionCollection()->addAction("label1", label1);
KLineEdit* lineEdit = new KLineEdit( this );
KAction* lineEditAction = new KAction( "Line Edit", this );
actionCollection()->addAction( "lineEdit", lineEditAction );
lineEditAction->setDefaultWidget(lineEdit);
// second constructor
KToolBarLabelAction *label2 = new KToolBarLabelAction( lineEditAction, "This is the &second label", this );
actionCollection()->addAction( "label2", label2 );
// set buddy for label1
label1->setBuddy( lineEditAction );
// set buddy for accel
accel->setBuddy( lineEdit );
// another widget so lineEdit can loose focus and check budyness works
new KLineEdit( main );
setupGUI( Default, "ktoolbarlabelactiontestui.rc" );
}
示例3: initActions
//.........这里部分代码省略.........
// ==== observation menu ================
ka = actionCollection()->addAction("execute", this, SLOT( slotExecute() ) )
<< i18n( "Execute the session Plan..." )
<< KShortcut( Qt::CTRL+Qt::Key_2 );
// ==== devices Menu ================
#ifdef HAVE_INDI_H
#ifndef Q_WS_WIN
actionCollection()->addAction("telescope_wizard", this, SLOT( slotTelescopeWizard() ) )
<< i18n("Telescope Wizard...")
<< KIcon("tools-wizard" );
actionCollection()->addAction("device_manager", this, SLOT( slotINDIDriver() ) )
<< i18n("Device Manager...")
<< KIcon("network-server" );
ka = actionCollection()->addAction("indi_cpl", this, SLOT( slotINDIPanel() ) )
<< i18n("INDI Control Panel...");
ka->setEnabled(false);
#endif
#endif
//Help Menu:
actionCollection()->addAction( KStandardAction::TipofDay, "help_tipofday", this, SLOT( slotTipOfDay() ) )
->setWhatsThis(i18n("Displays the Tip of the Day"));
// KStandardAction::help(this, SLOT( appHelpActivated() ), actionCollection(), "help_contents" );
//Add timestep widget for toolbar
TimeStep = new TimeStepBox( toolBar("kstarsToolBar") );
// Add a tool tip to TimeStep describing the weird nature of time steps
QString TSBToolTip = i18nc( "Tooltip describing the nature of the time step control", "Use this to set the rate at which time in the simulation flows.\nFor time step \'X\' up to 10 minutes, time passes at the rate of \'X\' per second.\nFor time steps larger than 10 minutes, frames are displayed at an interval of \'X\'." );
TimeStep->setToolTip( TSBToolTip );
TimeStep->tsbox()->setToolTip( TSBToolTip );
ka = actionCollection()->addAction("timestep_control")
<< i18n("Time step control");
ka->setDefaultWidget( TimeStep );
// ==== viewToolBar actions ================
actionCollection()->add<KToggleAction>("show_stars", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Stars in the display", "Stars" )
<< KIcon("kstars_stars" )
<< ToolTip( i18n("Toggle stars") );
actionCollection()->add<KToggleAction>("show_deepsky", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Deep Sky Objects in the display", "Deep Sky" )
<< KIcon("kstars_deepsky" )
<< ToolTip( i18n("Toggle deep sky objects") );
actionCollection()->add<KToggleAction>("show_planets", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Solar System objects in the display", "Solar System" )
<< KIcon("kstars_planets" )
<< ToolTip( i18n("Toggle Solar system objects") );
actionCollection()->add<KToggleAction>("show_clines", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Constellation Lines in the display", "Const. Lines" )
<< KIcon("kstars_clines" )
<< ToolTip( i18n("Toggle constellation lines") );
actionCollection()->add<KToggleAction>("show_cnames", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Constellation Names in the display", "Const. Names" )
<< KIcon("kstars_cnames" )
<< ToolTip( i18n("Toggle constellation names") );
actionCollection()->add<KToggleAction>("show_cbounds", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Constellation Boundaries in the display", "C. Boundaries" )
<< KIcon("kstars_cbound" )
<< ToolTip( i18n("Toggle constellation boundaries") );
actionCollection()->add<KToggleAction>("show_mw", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Milky Way in the display", "Milky Way" )
<< KIcon("kstars_mw" )
<< ToolTip( i18n("Toggle milky way") );
actionCollection()->add<KToggleAction>("show_equatorial_grid", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Equatorial Coordinate Grid in the display", "Equatorial coord. grid" )
<< KIcon("kstars_grid" )
<< ToolTip( i18n("Toggle equatorial coordinate grid") );
actionCollection()->add<KToggleAction>("show_horizontal_grid", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle Horizontal Coordinate Grid in the display", "Horizontal coord. grid" )
<< KIcon("kstars_hgrid" )
<< ToolTip( i18n("Toggle horizontal coordinate grid") );
actionCollection()->add<KToggleAction>("show_horizon", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle the opaque fill of the ground polygon in the display", "Ground" )
<< KIcon("kstars_horizon" )
<< ToolTip( i18n("Toggle opaque ground") );
actionCollection()->add<KToggleAction>("show_flags", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle flags in the display", "Flags" )
<< KIcon("kstars_flag" )
<< ToolTip( i18n("Toggle flags") );
actionCollection()->add<KToggleAction>("show_satellites", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle satellites in the display", "Satellites" )
<< KIcon("kstars_satellites" )
<< ToolTip( i18n("Toggle satellites") );
actionCollection()->add<KToggleAction>("show_supernovae", this, SLOT( slotViewToolBar() ) )
<< i18nc("Toggle supernovae in the display", "Supernovae" )
<< KIcon("kstars_supernovae" )
<< ToolTip( i18n("Toggle supernovae") );
setXMLFile("kstarsui.rc" );
if (Options::fitsDir().isEmpty())
Options::setFitsDir(QDir:: homePath());
}
示例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: QWidget
//.........这里部分代码省略.........
action->setData(2);
autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_double"), action));
int autoResizeFactor =
KGlobal::config()->group("MediaObject").readEntry("AutoResizeFactor", 0);
switch (autoResizeFactor) {
case 1:
automaticResize = OriginalSize;
autoResizeGroup->actions().at(1)->setChecked(true);
break;
case 2:
automaticResize = DoubleSize;
autoResizeGroup->actions().at(2)->setChecked(true);
break;
default:
automaticResize = ResizeOff;
autoResizeGroup->actions().at(0)->setChecked(true);
break;
}
videoMenu->addMenu(autoResizeMenu);
action = new KAction(i18n("Volume Slider"), this);
volumeSlider = new QSlider(toolBar);
volumeSlider->setFocusPolicy(Qt::NoFocus);
volumeSlider->setOrientation(Qt::Horizontal);
volumeSlider->setRange(0, 100);
volumeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
volumeSlider->setToolTip(action->text());
volumeSlider->setValue(KGlobal::config()->group("MediaObject").readEntry("Volume", 100));
connect(volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
backend->setVolume(volumeSlider->value());
action->setDefaultWidget(volumeSlider);
toolBar->addAction(collection->addAction(QLatin1String("controls_volume_slider"), action));
jumpToPositionAction = new KAction(KIcon(QLatin1String("go-jump")),
i18nc("@action:inmenu", "Jump to Position..."), this);
jumpToPositionAction->setShortcut(Qt::CTRL + Qt::Key_J);
connect(jumpToPositionAction, SIGNAL(triggered()), this, SLOT(jumpToPosition()));
menu->addAction(collection->addAction(QLatin1String("controls_jump_to_position"), jumpToPositionAction));
navigationMenu = new KMenu(i18nc("playback menu", "Skip"), this);
menu->addMenu(navigationMenu);
menu->addSeparator();
int shortSkipDuration = Configuration::instance()->getShortSkipDuration();
int longSkipDuration = Configuration::instance()->getLongSkipDuration();
connect(Configuration::instance(), SIGNAL(shortSkipDurationChanged(int)),
this, SLOT(shortSkipDurationChanged(int)));
connect(Configuration::instance(), SIGNAL(longSkipDurationChanged(int)),
this, SLOT(longSkipDurationChanged(int)));
longSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")),
i18nc("submenu of 'Skip'", "Skip %1s Backward", longSkipDuration), this);
longSkipBackwardAction->setShortcut(Qt::SHIFT + Qt::Key_Left);
connect(longSkipBackwardAction, SIGNAL(triggered()), this, SLOT(longSkipBackward()));
navigationMenu->addAction(
collection->addAction(QLatin1String("controls_long_skip_backward"), longSkipBackwardAction));
shortSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")),
i18nc("submenu of 'Skip'", "Skip %1s Backward", shortSkipDuration), this);
shortSkipBackwardAction->setShortcut(Qt::Key_Left);
connect(shortSkipBackwardAction, SIGNAL(triggered()), this, SLOT(shortSkipBackward()));
navigationMenu->addAction(
collection->addAction(QLatin1String("controls_skip_backward"), shortSkipBackwardAction));