本文整理汇总了C++中createAction函数的典型用法代码示例。如果您正苦于以下问题:C++ createAction函数的具体用法?C++ createAction怎么用?C++ createAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了createAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: callfunc_selector
void Mouse::dizzy() {
Sequence* seq;
if (!fallIn) {
seq = Sequence::create(
CallFunc::create(this, callfunc_selector(Mouse::setDizzyDif)),
Spawn::create(createAction("dizzy", 0, 0.15f, 1), MoveTo::create(0.1, Vec2(mousePositionX, mousePositionY)), NULL),
CallFunc::create(this, callfunc_selector(Mouse::resetDif)),
createRunningSequence(), NULL);
}
else {
float fallPosition = 0;
if (fallingSnare == nullptr) {
fallPosition = this->getPosition().x;
}
else {
fallPosition = fallingSnare->getPosition().x +fallingSnare->getContentSize().width / 6;
}
seq = Sequence::create(
CallFunc::create(this, callfunc_selector(Mouse::setDizzyDif)),
Spawn::create(createAction("dizzy", 0, 0.15f, 1),
MoveTo::create(0.1, Vec2(fallPosition, mousePositionY - 70)), NULL),
Spawn::create(createAction("fallend", 0.2, 0.15f, 1),
MoveTo::create(0.75, Vec2(this->getPosition().x, mousePositionY)), NULL),
CallFunc::create(this, callfunc_selector(Mouse::moveMouseBehineSnare)),
createRunningSequence(), NULL);
}
this->runAction(seq);
}
示例2: createAction
QList<QAction *> KoRdfLocationTreeWidgetItem::actions(QWidget *parent, KoCanvasBase *host)
{
QList<QAction *> m_actions;
QAction *action = 0;
#ifdef CAN_USE_MARBLE
// These were coded to need marble
action = createAction(parent, host, "Edit...");
connect(action, SIGNAL(triggered(bool)), this, SLOT(edit()));
m_actions.append(action);
action = createAction(parent, host, "Show location on a map");
connect(action, SIGNAL(triggered(bool)), this, SLOT(showInViewer()));
m_actions.append(action);
#endif
action = createAction(parent, host, "Export location to KML file...");
connect(action, SIGNAL(triggered(bool)), this, SLOT(exportToFile()));
m_actions.append(action);
addApplyStylesheetActions(parent, m_actions, host);
if (host) {
action = new RdfSemanticTreeWidgetSelectAction(parent, host, semanticItem());
m_actions.append(action);
}
return m_actions;
}
示例3: NotationTool
ClefInserter::ClefInserter(NotationWidget *widget) :
NotationTool("clefinserter.rc", "ClefInserter", widget),
m_clef(Clef::Treble)
{
createAction("select", SLOT(slotSelectSelected()));
createAction("erase", SLOT(slotEraseSelected()));
createAction("notes", SLOT(slotNotesSelected()));
}
示例4: QMenu
void Pixelepsy::createFileActions() {
this->File = new QMenu(tr("&File"));
this->menuBar()->addMenu(this->File);
createAction(this->File, this->actionNew, "New", "Ctrl+N", std::bind(&Pixelepsy::on_actionNew_triggered, this));
createAction(this->File, this->actionOpen, "Open", "Ctrl+O",std::bind(&Pixelepsy::on_actionOpen_triggered, this));
createAction(this->File, this->actionSave, "Save", "Ctrl+S",std::bind(&Pixelepsy::on_actionSave_triggered, this));
createAction(this->File, this->actionSaveAs, "Save As", "Ctrl+Shift+S", std::bind(&Pixelepsy::on_actionSave_As_triggered, this));
}
示例5: createAction
QList<QAction*> LiveViewManager::bandwidthActions(int cv, QObject *target,
const char *slot) const
{
QList<QAction*> re;
re << createAction(tr("Full Bandwidth"), FullBandwidth, cv, target, slot)
<< createAction(tr("Low Bandwidth"), LowBandwidth, cv, target, slot);
return re;
}
示例6: NotationTool
SymbolInserter::SymbolInserter(NotationWidget *widget) :
NotationTool("symbolinserter.rc", "SymbolInserter", widget),
m_symbol(Symbol::Segno)
{
createAction("select", SLOT(slotSelectSelected()));
createAction("erase", SLOT(slotEraseSelected()));
createAction("notes", SLOT(slotNotesSelected()));
}
示例7: MatrixTool
MatrixEraser::MatrixEraser(MatrixWidget *parent) :
MatrixTool("matrixeraser.rc", "MatrixEraser", parent)
{
createAction("resize", SLOT(slotResizeSelected()));
createAction("draw", SLOT(slotDrawSelected()));
createAction("select", SLOT(slotSelectSelected()));
createAction("move", SLOT(slotMoveSelected()));
createMenu();
}
示例8: QMainWindow
QtGnuplotWindow::QtGnuplotWindow(int id, QtGnuplotEventHandler* eventHandler, QWidget* parent)
: QMainWindow(parent)
{
m_eventHandler = eventHandler;
m_id = id;
setAttribute(Qt::WA_DeleteOnClose);
setWindowIcon(QIcon(":/images/gnuplot"));
// Register as the main event receiver if not already created
if (m_eventHandler == 0)
m_eventHandler = new QtGnuplotEventHandler(this,
"qtgnuplot" + QString::number(QCoreApplication::applicationPid()));
// Central widget
m_widget = new QtGnuplotWidget(m_id, m_eventHandler, this);
connect(m_widget, SIGNAL(statusTextChanged(const QString&)), this, SLOT(on_setStatusText(const QString&)));
setCentralWidget(m_widget);
// Bars
m_toolBar = new QToolBar(this);
addToolBar(m_toolBar);
statusBar()->showMessage(tr("Qt frontend for gnuplot"));
// Actions
QAction* copyToClipboardAction = new QAction(QIcon(":/images/clipboard" ), tr("Copy to clipboard"), this);
QAction* printAction = new QAction(QIcon(":/images/print" ), tr("Print" ), this);
QAction* exportAction = new QAction(QIcon(":/images/export" ), tr("Export" ), this);
QAction* exportPdfAction = new QAction(QIcon(":/images/exportPDF" ), tr("Export to PDF" ), this);
QAction* exportEpsAction = new QAction(QIcon(":/images/exportVector"), tr("Export to EPS" ), this);
QAction* exportSvgAction = new QAction(QIcon(":/images/exportVector"), tr("Export to SVG" ), this);
QAction* exportPngAction = new QAction(QIcon(":/images/exportRaster"), tr("Export to image" ), this);
QAction* settingsAction = new QAction(QIcon(":/images/settings" ), tr("Settings" ), this);
connect(copyToClipboardAction, SIGNAL(triggered()), m_widget, SLOT(copyToClipboard()));
connect(printAction, SIGNAL(triggered()), m_widget, SLOT(print()));
connect(exportPdfAction, SIGNAL(triggered()), m_widget, SLOT(exportToPdf()));
connect(exportEpsAction, SIGNAL(triggered()), m_widget, SLOT(exportToEps()));
connect(exportSvgAction, SIGNAL(triggered()), m_widget, SLOT(exportToSvg()));
connect(exportPngAction, SIGNAL(triggered()), m_widget, SLOT(exportToImage()));
connect(settingsAction, SIGNAL(triggered()), m_widget, SLOT(showSettingsDialog()));
QMenu* exportMenu = new QMenu(this);
exportMenu->addAction(copyToClipboardAction);
exportMenu->addAction(printAction);
exportMenu->addAction(exportPdfAction);
// exportMenu->addAction(exportEpsAction);
exportMenu->addAction(exportSvgAction);
exportMenu->addAction(exportPngAction);
exportAction->setMenu(exportMenu);
m_toolBar->addAction(exportAction);
createAction(tr("Replot") , 'e', ":/images/replot");
createAction(tr("Show grid") , 'g', ":/images/grid");
createAction(tr("Previous zoom"), 'p', ":/images/zoomPrevious");
createAction(tr("Next zoom") , 'n', ":/images/zoomNext");
createAction(tr("Autoscale") , 'a', ":/images/autoscale");
m_toolBar->addAction(settingsAction);
}
示例9: createAction
void
ControlEditorDialog::setupActions()
{
createAction("file_close", SLOT(slotClose()));
m_closeButton->setText(tr("Close"));
connect(m_closeButton, SIGNAL(released()), this, SLOT(slotClose()));
createAction("control_help", SLOT(slotHelpRequested()));
createAction("help_about_app", SLOT(slotHelpAbout()));
createGUI("controleditor.rc");
}
示例10: QActionGroup
void DiagramToolBox::createActions()
{
mDiagramModeActionGroup = new QActionGroup(this);
connect(mDiagramModeActionGroup, SIGNAL(triggered(QAction*)),
this, SLOT(setDiagramModeFromAction(QAction*)));
addAction(createAction("Select Mode", ":/icons/oxygen/edit-select.png", "Escape"));
addAction(createAction("Scroll Mode", ":/icons/oxygen/transform-move.png"));
addAction(createAction("Zoom Mode", ":/icons/oxygen/page-zoom.png"));
actions()[SelectModeAction]->setChecked(true);
}
示例11: MatrixTool
MatrixResizer::MatrixResizer(MatrixWidget *parent) :
MatrixTool("matrixresizer.rc", "MatrixResizer", parent),
m_currentElement(0),
m_currentViewSegment(0)
{
createAction("select", SLOT(slotSelectSelected()));
createAction("draw", SLOT(slotDrawSelected()));
createAction("erase", SLOT(slotEraseSelected()));
createAction("move", SLOT(slotMoveSelected()));
createMenu();
}
示例12: Vec2
void Mouse::fall(Snare* snare) {
fallingSnare = snare;
fallIn = true;
Vec2 mousePosition = Vec2(mousePositionX, mousePositionY);
auto seq = Sequence::create(
CallFunc::create(this, callfunc_selector(Mouse::setFallDif)),
Spawn::create(createAction("fall", 0.1, 0.08f, 1),
MoveTo::create(0.56, Vec2(mousePositionX, mousePositionY - 70)), NULL),
Spawn::create(createAction("fallend", 0.1, 0.08f, 1), MoveTo::create(0.56, mousePosition), NULL),
CallFunc::create(this, callfunc_selector(Mouse::moveMouseBehineSnare)),
createRunningSequence(), NULL);
this->runAction(seq);
}
示例13: createAction
void HtmlPreviewController::createActions()
{
zoomInAction = createAction(tr("Zoom &In"), QKeySequence(Qt::CTRL | Qt::Key_Plus));
connect(zoomInAction, SIGNAL(triggered()),
this, SLOT(zoomInView()));
zoomOutAction = createAction(tr("Zoom &Out"), QKeySequence(Qt::CTRL | Qt::Key_Minus));
connect(zoomOutAction, SIGNAL(triggered()),
this, SLOT(zoomOutView()));
zoomResetAction = createAction(tr("Reset &Zoom"), QKeySequence(Qt::CTRL | Qt::Key_0));
connect(zoomResetAction, SIGNAL(triggered()),
this, SLOT(resetZoomOfView()));
}
示例14: resize
MainWindow::MainWindow()
{
resize(640, 640);
scroll = new QScrollArea();
scroll->setWidgetResizable(true);
setCentralWidget(scroll);
editor = new EditorWidget();
scroll->setWidget(editor);
statusBar()->showMessage(tr("%1 - by Overkill.").arg(AppName), 2000);
statusBar()->setStyleSheet(
"QStatusBar {"
" border-top: 1px solid #CCCCCC;"
" background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DADBDE, stop: 1 #F6F7FA);"
" padding: 4px;"
" color: #777777;"
"}"
);
#ifdef Q_WS_WIN
QKeySequence quitSequence(Qt::ALT + Qt::Key_F4);
#else
QKeySequence quitSequence(QKeySequence::Quit);
#endif
fileMenu = menuBar()->addMenu(tr("&File"));
newAction = createAction(fileMenu, tr("&New"), tr("Create a new CHR."), QKeySequence::New);
openAction = createAction(fileMenu, tr("&Open..."), tr("Open an existing CHR."), QKeySequence::Open);
createSeparator(fileMenu);
saveAction = createAction(fileMenu, tr("&Save..."), tr("Save the current CHR."), QKeySequence::Save);
saveAsAction = createAction(fileMenu, tr("Save &As..."), tr("Save a copy of the current CHR."), QKeySequence::SaveAs);
createSeparator(fileMenu);
for(int i = 0; i < MaxRecentCount; ++i)
{
auto action = createAction(fileMenu, QKeySequence(Qt::ALT + Qt::Key_1 + i));
action->setDisabled(true);
recentFileActions[i] = action;
connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
}
clearRecentAction = createAction(fileMenu, tr("Clear &Recent Files"), tr("Clear all recently opened files."), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Delete));
updateRecentFiles();
createSeparator(fileMenu);
exitAction = createAction(fileMenu, tr("E&xit"), tr("Exit the program."), quitSequence);
helpMenu = menuBar()->addMenu(tr("&Help"));
aboutAction = createAction(helpMenu, tr("&About..."), tr("About %1.").arg(AppName), QKeySequence::HelpContents);
connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));
connect(clearRecentAction, SIGNAL(triggered()), this, SLOT(clearRecentFiles()));
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
QTimer::singleShot(0, this, SLOT(newFile()));
}
示例15: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
Settings settings;
settings.s_plot.Xfrom = 0;
settings.s_plot.Xto = 500;
settings.s_plot.Yfrom = 0;
settings.s_plot.Yto = 500;
settings.s_plot.x_name = "X";
settings.s_plot.y_name = "Y";
d_panel = new Panel();
d_panel->setSettings(settings);
QWidget *w = new QWidget( this );
graf = new Graf();
QHBoxLayout *hLayout = new QHBoxLayout( w );
hLayout->addWidget( d_panel );
hLayout->addWidget( graf, 10 );
setCentralWidget( w );
updatePlot();
connect( d_panel, SIGNAL( edited() ), SLOT( updatePlot() ) );
createAction();
createToolBar();
}