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); }
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; }
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())); }
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)); }
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; }
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())); }
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(); }
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); }
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"); }
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); }
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(); }
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); }
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())); }
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())); }
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(); }
void PikaCriteriaAction::addCriteriaAction(const std::string & name) { MooseSharedPointer<MooseObjectAction> action = createAction("PikaCriteria", name); action->getObjectParams().set<MooseEnum>("criteria") = name; _awh.addActionBlock(action); }
void ActionDialog::on_buttonBox_clicked(QAbstractButton* button) { Command cmd; ConfigurationManager *cm; switch ( ui->buttonBox->standardButton(button) ) { case QDialogButtonBox::Ok: createAction(); break; case QDialogButtonBox::Save: cmd.name = cmd.cmd = ui->cmdEdit->currentText(); cmd.input = ui->comboBoxInputFormat->currentText(); cmd.output = ui->comboBoxOutputFormat->currentText(); cmd.sep = ui->separatorEdit->text(); cmd.outputTab = ui->comboBoxOutputTab->currentText(); cm = ConfigurationManager::instance(); cm->addCommand(cmd); cm->saveSettings(); QMessageBox::information( this, tr("Command saved"), tr("Command was saved and can be accessed from item menu.\n" "You can set up the command in preferences.") ); break; case QDialogButtonBox::Cancel: close(); break; default: break; } }
CreateRepoDialog::CreateRepoDialog(const Account& account, const QString& worktree, ReposTab *repos_tab, QWidget *parent) : QDialog(parent), path_(worktree), request_(NULL), account_(account), repos_tab_(repos_tab) { setupUi(this); setWindowTitle(tr("Create a library")); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); #if defined(Q_OS_MAC) layout()->setContentsMargins(6, 6, 6, 6); layout()->setSpacing(5); #endif mStatusText->setText(""); mDirectory->setText(worktree); mName->setText(QDir(worktree).dirName()); connect(mChooseDirBtn, SIGNAL(clicked()), this, SLOT(chooseDirAction())); connect(mOkBtn, SIGNAL(clicked()), this, SLOT(createAction())); const QRect screen = QApplication::desktop()->screenGeometry(); move(screen.center() - this->rect().center()); }
int main(int argc, char* argv[]) { // Virtual Worldの作成 WorldPtr world = createWorld(); RobotPtr robot = createRobot(world); // Agentの作成 ActionPtr action = createAction(robot); DistSensorPtr sensor = createDistSensor(robot); EnvironmentPtr env = createEnvironment(sensor); ThreadedAgentPtr agent = createAgent(sensor, action); // 初期化 env->init(); agent->init(); robot->init(); QApplication app(argc, argv); MainWindow window; window.setWorldModel(world); window.setRobotModel(robot); window.setEnvironment(env); window.setAgent(agent); window.show(); return app.exec(); }
void DiagramToolBox::addItem(DrawingItem* item, const QString& section, const QString& text, const QString& iconPath) { if (item) { QTreeWidgetItem* newItem = nullptr; QTreeWidgetItem* sectionItem = nullptr; for(int i = 0; !sectionItem && i < mTreeWidget->topLevelItemCount(); i++) { if (mTreeWidget->topLevelItem(i)->text(0) == section) sectionItem = mTreeWidget->topLevelItem(i); } if (!sectionItem) { sectionItem = new QTreeWidgetItem(); sectionItem->setText(0, section); sectionItem->setBackground(0, palette().brush(QPalette::Button)); mTreeWidget->addTopLevelItem(sectionItem); } newItem = new QTreeWidgetItem(sectionItem); newItem->setText(0, text); if (!iconPath.isEmpty()) newItem->setIcon(0, QIcon(iconPath)); QAction* newAction = createAction(text, iconPath, "", item->uniqueKey()); mItemActions[newItem] = newAction; } }
QAction *KWin::AbstractScript::scriptValueToAction(QScriptValue &value, QMenu *parent) { QScriptValue titleValue = value.property(QStringLiteral("text")); QScriptValue checkableValue = value.property(QStringLiteral("checkable")); QScriptValue checkedValue = value.property(QStringLiteral("checked")); QScriptValue itemsValue = value.property(QStringLiteral("items")); QScriptValue triggeredValue = value.property(QStringLiteral("triggered")); if (!titleValue.isValid()) { // title not specified - does not make any sense to include return nullptr; } const QString title = titleValue.toString(); const bool checkable = checkableValue.isValid() && checkableValue.toBool(); const bool checked = checkable && checkedValue.isValid() && checkedValue.toBool(); // either a menu or a menu item if (itemsValue.isValid()) { if (!itemsValue.isArray()) { // not an array, so cannot be a menu return nullptr; } QScriptValue lengthValue = itemsValue.property(QStringLiteral("length")); if (!lengthValue.isValid() || !lengthValue.isNumber() || lengthValue.toInteger() == 0) { // length property missing return nullptr; } return createMenu(title, itemsValue, parent); } else if (triggeredValue.isValid()) { // normal item return createAction(title, checkable, checked, triggeredValue, parent); } return nullptr; }
bool SectionGuide::showFirstSectionGuide(CCPoint redStarPos,CCPoint clickBoxPos,CCPoint arrowsPos) { if (redStartPrompt!=NULL && boxClickPrompt!=NULL && redStartToTableArrows!=NULL && clickAction!= NULL) { redStartPrompt->setPosition(redStarPos); redStartToTableArrows->setPosition(arrowsPos); boxClickPrompt->setPosition(clickBoxPos); redStartPrompt->setPercentage(0.0f); redStartPrompt->setVisible(true); float delay = 0.8f; float clickTimeLast = 0.5f*5; CCAction* actionTouch = createAction(CCDelayTime::create(delay+clickTimeLast), SEL_CallFuncO(&SectionGuide::boxClickPromptFinishedShow), this); boxClickPrompt->stopAllActions(); boxClickPrompt->init(); boxClickPrompt->runAction(actionTouch); schedule(schedule_selector(SectionGuide::timeToShowFinger),delay); return true; } return false; }
Desktop::Desktop() { this->setObjectName("desktop"); createAction(); createItem(); createLayout(); }
QAction* MainWindow::createAction(QMenu* menu, const QString& text, const QString& description, const QKeySequence &shortcut) { auto action = createAction(menu, shortcut); action->setText(text); action->setStatusTip(description); return action; }
void XdgMenuWidgetPrivate::buildMenu() { Q_Q(XdgMenuWidget); QAction* first = 0; if (!q->actions().isEmpty()) first = q->actions().last(); DomElementIterator it(mXml, ""); while(it.hasNext()) { QDomElement xml = it.next(); // Build submenu ........................ if (xml.tagName() == "Menu") q->insertMenu(first, new XdgMenuWidget(xml, q)); //Build application link ................ else if (xml.tagName() == "AppLink") q->insertAction(first, createAction(xml)); //Build separator ....................... else if (xml.tagName() == "Separator") q->insertSeparator(first); } mNeedBuild = false; }
// public kpToolAction *kpTool::action () { if (!m_action) createAction (); return m_action; }
void MainWindow::loadInstrument(Instrument *i) { i->init(); i->index = instruments.size(); instruments.push_back(i); instrumentBar->addAction(createAction(i)); }
void HelloWorld::MovePlayerTo(CCPoint PlayerPos) { if (dirction < 0 ) return ; CCPoint location = TransformCoodrToDevice(PlayerPos); walkAction=createAction(0,7,"move",dirction,ccp(PlayerPos.x,PlayerPos.y)); m_pSprite->setFlipX(dirction==6?true:false); CCPoint realDeast =ccp(location.x,location.y); CCActionInterval *actionTo=CCMoveTo::create(1.2f,realDeast); CCAction *moveToAction=CCSequence::create( actionTo, CCCallFunc::create(this,callfunc_selector(HelloWorld::MoveDone)), NULL ); m_pSprite->runAction(walkAction); m_pSprite->runAction(moveToAction); //m_CurrentPos = CCPoint(PlayerPos); }
SystemTray::SystemTray(QObject *parent) : QSystemTrayIcon(parent) { createAction(); addActions(); translateLanguage(); }
//========================================================================== void Initialise(IComponentContext& contextManager) override { // register reflected type definition IDefinitionManager* defManager = contextManager.queryInterface<IDefinitionManager>(); assert(defManager != nullptr); this->initReflectedTypes(*defManager); auto pDefinition = defManager->getDefinition(getClassIdentifier<ProjectManager>()); assert(pDefinition != nullptr); projectManager_ = pDefinition->create(); projectManager_.getBase<ProjectManager>()->init(contextManager); auto uiFramework = contextManager.queryInterface<IUIFramework>(); auto uiApplication = contextManager.queryInterface<IUIApplication>(); assert(uiFramework != nullptr && uiApplication != nullptr); uiFramework->loadActionData(":/TestingProjectControl/actions.xml", IUIFramework::ResourceType::File); newProject_ = uiFramework->createAction("NewProject", std::bind(&EnvrionmentTestPlugin::newProject, this)); openProject_ = uiFramework->createAction("OpenProject", std::bind(&EnvrionmentTestPlugin::openProject, this), std::bind(&EnvrionmentTestPlugin::canOpen, this)); saveProject_ = uiFramework->createAction("SaveProject", std::bind(&EnvrionmentTestPlugin::saveProject, this), std::bind(&EnvrionmentTestPlugin::canSave, this)); closeProject_ = uiFramework->createAction("CloseProject", std::bind(&EnvrionmentTestPlugin::closeProject, this), std::bind(&EnvrionmentTestPlugin::canClose, this)); uiApplication->addAction(*newProject_); uiApplication->addAction(*openProject_); uiApplication->addAction(*saveProject_); uiApplication->addAction(*closeProject_); auto viewCreator = get<IViewCreator>(); if (viewCreator) { viewCreator->createWindow( "TestingProjectControl/NewProjectDialog.qml", projectManager_, [this](std::unique_ptr<IWindow>& window) { newProjectDialog_ = std::move(window); if (newProjectDialog_ != nullptr) { connections_ += newProjectDialog_->signalClose.connect(std::bind(&EnvrionmentTestPlugin::onNewDlgClose, this)); } }); } }