VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/) : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf()) { setReadOnly(true); setUndoRedoEnabled(false); setOverwriteMode(false); setPlainText(""); setTextInteractionFlags(Qt::TextBrowserInteraction); setAutoFormatting(QTextEdit::AutoAll); setTabChangesFocus(true); setAcceptRichText(false); /* * Font. * Create actions for font menu items. */ m_pCourierFontAction = new QAction(tr("Courier"), this); m_pCourierFontAction->setCheckable(true); m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D); connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(setFontCourier())); m_pMonospaceFontAction = new QAction(tr("Monospace"), this); m_pMonospaceFontAction->setCheckable(true); m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M); connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(setFontMonospace())); /* Create action group for grouping of exclusive font menu items. */ QActionGroup *pActionFontGroup = new QActionGroup(this); pActionFontGroup->addAction(m_pCourierFontAction); pActionFontGroup->addAction(m_pMonospaceFontAction); pActionFontGroup->setExclusive(true); /* * Color scheme. * Create actions for color-scheme menu items. */ m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this); m_pGreenOnBlackAction->setCheckable(true); m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1); connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(setColorGreenOnBlack())); m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this); m_pBlackOnWhiteAction->setCheckable(true); m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2); connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(setColorBlackOnWhite())); /* Create action group for grouping of exclusive color-scheme menu items. */ QActionGroup *pActionColorGroup = new QActionGroup(this); pActionColorGroup->addAction(m_pGreenOnBlackAction); pActionColorGroup->addAction(m_pBlackOnWhiteAction); pActionColorGroup->setExclusive(true); /* * Set the defaults (which syncs with the menu item checked state). */ setFontCourier(); setColorGreenOnBlack(); NOREF(pszName); }
void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints) { qRegisterMetaType<QDockWidget::DockWidgetFeatures>(); mapper = new QSignalMapper(this); connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCorner(int))); QMenu *corner_menu = dockWidgetMenu->addMenu(tr("Top left corner")); QActionGroup *group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Top dock area"), group, mapper, 0); ::addAction(corner_menu, tr("Left dock area"), group, mapper, 1); corner_menu = dockWidgetMenu->addMenu(tr("Top right corner")); group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Top dock area"), group, mapper, 2); ::addAction(corner_menu, tr("Right dock area"), group, mapper, 3); corner_menu = dockWidgetMenu->addMenu(tr("Bottom left corner")); group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 4); ::addAction(corner_menu, tr("Left dock area"), group, mapper, 5); corner_menu = dockWidgetMenu->addMenu(tr("Bottom right corner")); group = new QActionGroup(this); group->setExclusive(true); ::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 6); ::addAction(corner_menu, tr("Right dock area"), group, mapper, 7); dockWidgetMenu->addSeparator(); }
void NMainMenuBar::createSortMenu(QMenu *parentMenu) { sortMenu = parentMenu->addMenu(tr("Sort notes by")); QFont f = global.getGuiFont(QFont()); QActionGroup *menuActionGroup = new QActionGroup(this); menuActionGroup->setExclusive(true); addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date updated [desc]"), INI_VALUE_SORTORDER_DEFAULT); addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date updated [asc]"), "relevance desc, dateUpdated asc"); addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date created [desc]"), "relevance desc, dateCreated desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date created [asc]"), "relevance desc, dateCreated asc"); addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Title [desc]"), "relevance desc, title desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Title [asc]"), "relevance desc, title asc"); sortMenu->addSeparator(); addSortAction(sortMenu, menuActionGroup, f, tr("Date updated [desc]"), "dateUpdated desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Date updated [asc]"), "dateUpdated asc"); addSortAction(sortMenu, menuActionGroup, f, tr("Date created [desc]"), "dateCreated desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Date created [asc]"), "dateCreated asc"); addSortAction(sortMenu, menuActionGroup, f, tr("Title [desc]"), "title desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Title [asc]"), "title asc"); addSortAction(sortMenu, menuActionGroup, f, tr("Size [desc]"), "size desc, dateUpdated desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Has todo [desc]"), "hasTodo desc, dateUpdated desc"); addSortAction(sortMenu, menuActionGroup, f, tr("Unsynced first"), "isDirty desc, dateUpdated desc"); sortMenu->setFont(f); }
/* * Inits the menu options and Repository menuItem in menuBar */ void MainWindow::initMenuBar() { ui->menuTools->insertAction(ui->actionCacheCleaner, m_actionMenuMirrorCheck); ui->menuTools->addSeparator(); ui->menuTools->addAction(m_actionMenuOptions); QActionGroup *actionGroupPackages = new QActionGroup(this); QActionGroup *actionGroupRepositories = new QActionGroup(this); ui->actionViewAllPackages->setText(StrConstants::getAll()); actionGroupPackages->addAction(ui->actionViewAllPackages); actionGroupPackages->addAction(ui->actionViewInstalledPackages); actionGroupPackages->addAction(ui->actionViewNonInstalledPackages); actionGroupPackages->setExclusive(true); m_actionMenuRepository = ui->menuView->addAction(StrConstants::getRepository()); QMenu *subMenu = new QMenu(ui->menuView); connect(subMenu, SIGNAL(triggered(QAction*)), this, SLOT(selectedRepositoryMenu(QAction*))); m_actionRepositoryAll = subMenu->addAction(StrConstants::getAll()); m_actionRepositoryAll->setCheckable(true); m_actionRepositoryAll->setChecked(true); subMenu->addSeparator(); RepoConf *repoConf = new RepoConf(); QStringList repos = repoConf->getRepos(); foreach(QString repo, repos) { QAction * createdAction = subMenu->addAction(repo); createdAction->setCheckable(true); actionGroupRepositories->addAction(createdAction); }
VoiceSelector::VoiceSelector(QWidget* parent) : QFrame(parent) { setLineWidth(0); setFrameStyle(QFrame::Box | QFrame::Plain); QHBoxLayout* vwl = new QHBoxLayout; vwl->setSpacing(0); vwl->setContentsMargins(0, 0, 0, 0); static const char* sl2[4] = { "voice-1", "voice-2", "voice-3", "voice-4" }; static const int v[4] = { 0, 1, 2, 3 }; QActionGroup* vag = new QActionGroup(this); vag->setExclusive(true); for (int i = 0; i < 4; ++i) { QAction* a = getAction(sl2[i]); a->setCheckable(true); vag->addAction(a); VoiceButton* tb = new VoiceButton(v[i]); tb->setDefaultAction(a); vwl->addWidget(tb); } setLayout(vwl); connect(vag, SIGNAL(triggered(QAction*)), this, SIGNAL(triggered(QAction*))); }
void ObjectWorkspace::CreateDisplayToolbarActions() { // The actiongroup is used to make the action behave like radio buttons QActionGroup *actionGroup = new QActionGroup(this); actionGroup->setExclusive(true); QIcon wireframeIcon(":/images/wireframe.png"); QIcon shadedIcon(":/images/shaded.png"); QIcon shadedWireIcon(":/images/shadedwire.png"); QIcon gridIcon(":/images/xygrid.png"); mWireframeAction = actionGroup->addAction(wireframeIcon, "Wireframe"); mShadedAction = actionGroup->addAction(shadedIcon, "Shaded"); mShadedWireAction = actionGroup->addAction(shadedWireIcon, "Shaded Wireframe"); mGridAction = new QAction(gridIcon, "Toggle Grid", this); connect(mGridAction, SIGNAL(toggled(bool)), this, SLOT(OnToggleGridClicked(bool))); mWireframeAction->setCheckable(true); mShadedAction->setCheckable(true); mShadedWireAction->setCheckable(true); mGridAction->setCheckable(true); mShadedAction->setChecked(true); mGridAction->setChecked(true); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QActionGroup* toolGroup = new QActionGroup(this); toolGroup->addAction(ui->actionInsertEdge); toolGroup->addAction(ui->actionInsertVertex); toolGroup->addAction(ui->actionPointer); toolGroup->setExclusive(true); graphicsScene = new GraphicsScene(&graph, this); emit ui->actionPointer->trigger(); ui->graphicsView->setScene(graphicsScene); graphicsScene->setSceneRect(0,0,500,500); bestCostText = graphicsScene->addSimpleText("0"); bestCostText->setPos(10,10); //connect(graphicsScene, SIGNAL(Inserted(QGraphicsEllipseItem*)), SLOT(addVertex(QGraphicsEllipseItem*))); connect(graphicsScene, SIGNAL(EdgeInserted(GraphicsEdge*)), SLOT(addEdge(GraphicsEdge*))); srand(time(NULL)); // Color Cost colorCost[RED] = 10; costColor[colorCost[RED]] = RED; colorCost[BLUE] = 20; costColor[colorCost[BLUE]] = BLUE; colorCost[GREEN] = 30; costColor[colorCost[GREEN]] = GREEN; colorCost[YELLOW] =40; costColor[colorCost[YELLOW]] = YELLOW; }
Camera::Camera(QWidget *parent) : QMainWindow(parent), ui(new Ui::Camera), camera(0), imageCapture(0), mediaRecorder(0), isCapturingImage(false), applicationExiting(false) { ui->setupUi(this); //Camera devices: QByteArray cameraDevice; QActionGroup *videoDevicesGroup = new QActionGroup(this); videoDevicesGroup->setExclusive(true); foreach(const QByteArray &deviceName, QCamera::availableDevices()) { QString description = camera->deviceDescription(deviceName); QAction *videoDeviceAction = new QAction(description, videoDevicesGroup); videoDeviceAction->setCheckable(true); videoDeviceAction->setData(QVariant(deviceName)); if (cameraDevice.isEmpty()) { cameraDevice = deviceName; videoDeviceAction->setChecked(true); } ui->menuDevices->addAction(videoDeviceAction); }
QActionGroup* FilterMessageType::createActions() { QActionGroup* actions = new QActionGroup(this); actions->setExclusive(true); QAction* allAction = new QAction(QIcon(":/res/msg_all.png"), tr("All messages"), actions); allAction->setCheckable(true); allAction->setData(QVariant::fromValue(ALL)); QAction* inboxAction = new QAction(QIcon(":/res/msg_inbox.png"), tr("Inbox"), actions); inboxAction->setCheckable(true); inboxAction->setChecked(true); inboxAction->setData(QVariant::fromValue(INBOX)); QAction* outboxAction = new QAction(QIcon(":/res/msg_outbox.png"), tr("Sent"), actions); outboxAction->setCheckable(true); outboxAction->setData(QVariant::fromValue(OUTBOX)); QAction* draftAction = new QAction(QIcon(":/res/drafts.png"), tr("Drafts"), actions); draftAction->setCheckable(true); draftAction->setData(QVariant::fromValue(DRAFTS)); connect(actions, SIGNAL(triggered(QAction*)), SLOT(setAllowedTypeAction(QAction*))); return actions; }
frmSearchReplace::frmSearchReplace(TopEditorContainer *topEditorContainer, QWidget *parent) : QMainWindow(parent), ui(new Ui::frmSearchReplace), m_topEditorContainer(topEditorContainer) { ui->setupUi(this); setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint); move( parentWidget()->window()->frameGeometry().topLeft() + parentWidget()->window()->rect().center() - rect().center()); ui->cmbSearch->completer()->setCaseSensitivity(Qt::CaseSensitive); ui->cmbReplace->completer()->setCaseSensitivity(Qt::CaseSensitive); QSettings s; ui->cmbSearch->addItems(s.value("Search/searchHistory", QStringList()).toStringList()); ui->cmbSearch->setCurrentText(""); ui->cmbReplace->addItems(s.value("Search/replaceHistory", QStringList()).toStringList()); ui->cmbReplace->setCurrentText(""); ui->cmbLookIn->addItems(s.value("Search/fileHistory", QStringList()).toStringList()); ui->cmbLookIn->setCurrentText(""); ui->cmbFilter->addItems(s.value("Search/filterHistory", QStringList()).toStringList()); ui->cmbFilter->setCurrentText(""); connect(ui->cmbSearch->lineEdit(), &QLineEdit::textEdited, this, &frmSearchReplace::on_searchStringEdited); connect(ui->cmbSearch->lineEdit(), &QLineEdit::returnPressed, this, [=]() { if (ui->actionFind_in_files->isChecked()) { on_btnFindAll_clicked(); } else { on_btnFindNext_clicked(); } }); connect(ui->cmbReplace->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindNext_clicked); connect(ui->cmbLookIn->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindAll_clicked); connect(ui->cmbFilter->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindAll_clicked); ui->cmbFilter->lineEdit()->setPlaceholderText("*.ext1, *.ext2, ..."); ui->actionFind->setIcon(IconProvider::fromTheme("edit-find")); ui->actionReplace->setIcon(IconProvider::fromTheme("edit-find-replace")); QActionGroup *tabGroup = new QActionGroup(this); tabGroup->addAction(ui->actionFind); tabGroup->addAction(ui->actionReplace); tabGroup->addAction(ui->actionFind_in_files); tabGroup->setExclusive(true); // Initialize all the tabs ui->actionFind->setChecked(true); ui->actionReplace->setChecked(true); ui->actionFind_in_files->setChecked(true); ui->chkShowAdvanced->toggled(ui->chkShowAdvanced->isChecked()); setCurrentTab(TabSearch); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //QString path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/PlanktonTracker/"; ui->delayLineEdit->setEnabled(false); ui->numPhotoLineEdit->setEnabled(false); ui->startButton->setEnabled(false); ui->stopButton->setEnabled(false); ui->trackButton->setEnabled(false); Pylon::PylonAutoInitTerm autoInitTerm; QActionGroup *cameraDevicesGroup = new QActionGroup(this); cameraDevicesGroup->setExclusive(true); try { CTlFactory& tlFactory = CTlFactory::GetInstance(); // Get all attached devices. DeviceInfoList_t devices; if (tlFactory.EnumerateDevices(devices) == 0) { QString status = QString("No camera present."); ui->statusBar->showMessage(status); } // Create an array of instant cameras for the found devices and avoid exceeding a maximum number of devices. CInstantCameraArray cameras(min(devices.size(), c_maxCamerasToSee)); for (size_t i = 0; i < cameras.GetSize(); ++i) { cameras[i].Attach(tlFactory.CreateDevice(devices[i])); QAction *cameraDeviceAction = new QAction((QString)cameras[i].GetDeviceInfo().GetModelName(), cameraDevicesGroup); cameraDeviceAction->setCheckable(true); cameraDeviceAction->setData(QVariant::fromValue(cameras[i].GetDeviceInfo())); if (i == 0) { cameraDeviceAction->setChecked(true); // Set as default camera and enable some UI elements if (setCamera(cameras[i].GetDeviceInfo())) { ui->delayLineEdit->setEnabled(true); ui->numPhotoLineEdit->setEnabled(true); ui->startButton->setEnabled(true); } } ui->menuCamera->addAction(cameraDeviceAction); } } catch (GenICam::GenericException &e) { QString status = QString("An exception occurred: %1").arg((QString)e.GetDescription()); ui->statusBar->showMessage(status); } connect(cameraDevicesGroup, SIGNAL(triggered(QAction*)), SLOT(updateCameraDevice(QAction*))); }
SeisDoPrivate( SeisDo* me ) : m_self( me ) { m_ui.setupUi( m_self ); QActionGroup* actionGroup = new QActionGroup( m_self ); actionGroup->addAction( m_ui.actionChinese ); actionGroup->addAction( m_ui.actionEnglish ); actionGroup->setExclusive( true ); }
QMenu* DragLabel::rightClickMenu() { if (!m_RightClickMenu) { m_RightClickMenu = new QMenu(this); QMenu* colorMenu = new QMenu("Color", this); colorMenu->setIcon(QIcon(":/icons/color.svg")); QActionGroup* colorGroup = new QActionGroup(this); pRedColorAction = new QAction(QIcon(":/icons/red.svg"), tr("&Red"), this); pRedColorAction->setCheckable(true); if(currentColor()== Qt::red) pRedColorAction->setChecked(true); pOrangeColorAction = new QAction(QIcon(":/icons/orange.svg"), tr("&Orange"), this); pOrangeColorAction->setCheckable(true); if(currentColor() == QColor(254,154,46)) pOrangeColorAction->setChecked(true); pGreenColorAction = new QAction(QIcon(":/icons/green.svg"), tr("&Green"), this); pGreenColorAction->setCheckable(true); if(currentColor()== Qt::green) pGreenColorAction->setChecked(true); pWhiteColorAction = new QAction(QIcon(":/icons/white.svg"), tr("&White"), this); pWhiteColorAction->setCheckable(true); if(currentColor()== Qt::white) pWhiteColorAction->setChecked(true); pGrayColorAction = new QAction(QIcon(":/icons/gray.svg"), tr("&Gray"), this); pGrayColorAction->setCheckable(true); if(currentColor()== Qt::lightGray) pGrayColorAction->setChecked(true); //group colorGroup->addAction(pRedColorAction); colorGroup->addAction(pOrangeColorAction); colorGroup->addAction(pGreenColorAction); colorGroup->addAction(pWhiteColorAction); colorGroup->addAction(pGrayColorAction); colorGroup->setExclusive(true); connect(colorGroup,SIGNAL(triggered(QAction *)),this,SLOT(changeColorSlot(QAction*))); //menu colorMenu->addAction(pRedColorAction); colorMenu->addAction(pOrangeColorAction); colorMenu->addAction(pGreenColorAction); colorMenu->addSeparator(); colorMenu->addAction(pWhiteColorAction); colorMenu->addAction(pGrayColorAction); QAction* pDeleteAction = new QAction(QIcon(":/icons/delete.svg"), tr("&Delete"), this); connect(pDeleteAction,SIGNAL(triggered()),this,SLOT(deleteItemSlot())); m_RightClickMenu->addMenu(colorMenu); m_RightClickMenu->addAction(pDeleteAction); }
EditToolBar::EditToolBar(QWidget* parent, int tools, const char*) : QToolBar(tr("Edit Tools"), parent) { setObjectName("Edit Tools"); QActionGroup* action = new QActionGroup(parent); // Parent needed. action->setExclusive(true); nactions = 0; for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) { if ((tools & (1 << i))==0) continue; ++nactions; } actions = new Action*[nactions]; bool first = true; int n = 0; for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) { if ((tools & (1 << i))==0) continue; ToolB* t = &toolList[i]; Action* a = new Action(action, 1<<i, tr(t->tip).toLatin1().data(), true); actions[n] = a; //a->setIconSet(QIcon(**(t->icon))); a->setIcon(QIcon(**(t->icon))); a->setToolTip(tr(t->tip)); a->setWhatsThis(tr(t->ltip)); if (first) { a->setChecked(true); first = false; } ++n; } action->setVisible(true); //action->addTo(this); // Note: Does not take ownership. addActions(action->actions()); connect(action, SIGNAL(triggered(QAction*)), SLOT(toolChanged(QAction*))); toolShortcuts[PointerTool] = SHRT_TOOL_CURSOR; toolShortcuts[PencilTool] = SHRT_TOOL_PENCIL; toolShortcuts[RubberTool] = SHRT_TOOL_RUBBER; toolShortcuts[CutTool] = SHRT_TOOL_SCISSORS; toolShortcuts[GlueTool] = SHRT_TOOL_GLUE; toolShortcuts[RangeTool] = SHRT_TOOL_RANGE; toolShortcuts[PanTool] = SHRT_TOOL_PAN; toolShortcuts[ZoomTool] = SHRT_TOOL_ZOOM; //toolShortcuts[ScoreTool] = SHRT_TOOL_ //toolShortcuts[QuantTool] = SHRT_TOOL_ toolShortcuts[DrawTool] = SHRT_TOOL_LINEDRAW; toolShortcuts[MuteTool] = SHRT_TOOL_MUTE; toolShortcuts[AutomationTool] = SHRT_TOOL_LINEDRAW; toolShortcuts[CursorTool] = SHRT_TOOL_CURSOR; }
UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent) : QIWithRetranslateUI<QWidget>(pParent) , m_machineState(KMachineState_Null) , m_pUpdateTimer(new QTimer(this)) , m_vMargin(10) , m_pbgImage(0) , m_pPreviewImg(0) , m_pGlossyImg(0) { m_session.createInstance(CLSID_Session); setContentsMargins(0, 5, 0, 5); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); /* Connect the update timer */ connect(m_pUpdateTimer, SIGNAL(timeout()), this, SLOT(sltRecreatePreview())); /* Connect the machine state event */ connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString, KMachineState))); /* Create the context menu */ setContextMenuPolicy(Qt::DefaultContextMenu); m_pUpdateTimerMenu = new QMenu(this); QActionGroup *pUpdateTimeG = new QActionGroup(this); pUpdateTimeG->setExclusive(true); for(int i = 0; i < UpdateEnd; ++i) { QAction *pUpdateTime = new QAction(pUpdateTimeG); pUpdateTime->setData(i); pUpdateTime->setCheckable(true); pUpdateTimeG->addAction(pUpdateTime); m_pUpdateTimerMenu->addAction(pUpdateTime); m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime; } m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(Update500ms)]); /* Default value */ UpdateInterval interval = Update1000ms; QString strInterval = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PreviewUpdate); if (strInterval == "disabled") interval = UpdateDisabled; else if (strInterval == "500") interval = Update500ms; else if (strInterval == "1000") interval = Update1000ms; else if (strInterval == "2000") interval = Update2000ms; else if (strInterval == "5000") interval = Update5000ms; else if (strInterval == "10000") interval = Update10000ms; /* Initialize with the new update interval */ setUpdateInterval(interval, false); /* Retranslate the UI */ retranslateUi(); }
ImportHandler::ImportHandler( QWidget *parent ) : QDialog( parent ), ui( new Ui::ImportHandlerClass ) { itemModel = NULL; spriteModel = NULL; pictureModel = NULL; ui->setupUi( this ); destItems = NULL; destOutfits = NULL; destEffects = NULL; destProjectiles = NULL; QMenu *menu = new QMenu( ui->buttonDestination ); QActionGroup* actionGroup = new QActionGroup( menu ); actionGroup->setExclusive( true ); destItems = actionGroup->addAction( tr( "Items" ) ); destOutfits = actionGroup->addAction( tr( "Outfits" ) ); destEffects = actionGroup->addAction( tr( "Effects" ) ); destProjectiles = actionGroup->addAction( tr( "Projectiles" ) ); destItems->setCheckable( true ); destOutfits->setCheckable( true ); destEffects->setCheckable( true ); destProjectiles->setCheckable( true ); menu->addAction( destItems ); menu->addAction( destOutfits ); menu->addAction( destEffects ); menu->addAction( destProjectiles ); ui->buttonDestination->setMenu( menu ); actionDelete = new QAction( this ); actionDelete->setObjectName( QString::fromUtf8( "actionDelete" ) ); actionDelete->setEnabled( true ); QIcon icon; icon.addPixmap( QPixmap( QString::fromUtf8( ":/TibiaEditor/Resources/minus.png" ) ), QIcon::Normal, QIcon::Off ); actionDelete->setIcon( icon ); actionDelete->setText( QApplication::translate("TibiaEditorClass", "Delete", 0, QApplication::UnicodeUTF8 ) ); actionDelete->setShortcut( QApplication::translate("TibiaEditorClass", "Del", 0, QApplication::UnicodeUTF8 ) ); addAction( actionDelete ); ui->buttonBox->button( QDialogButtonBox::Open )->setText( tr( "Open..." ) ); ui->buttonBox->button( QDialogButtonBox::Apply )->setText( tr( "Import" ) ); ui->buttonBox->button( QDialogButtonBox::Reset )->setText( tr( "Clear" ) ); if( g_tibiaHandler.getItemFile() ){ itemModel = new ItemModel( this ); itemModel->setDropMimeFormats( QStringList() << "text/uri-list" ); ui->itemObjectView->setModel( itemModel ); QObject::connect( itemModel, SIGNAL( decodeMimeDrop( const QMimeData *, int, const QModelIndex & ) ), this, SLOT( onDropFiles( const QMimeData *, int, const QModelIndex & ) ) ); }
QMenu* RegExpDialog::createMenu() { QActionGroup* syntaxActionGroup = new QActionGroup(this); syntaxActionGroup->setExclusive(true); { { QAction* action = syntaxActionGroup->addAction(tr("Regular expression v1")); action->setCheckable(true); action->setChecked(true); action->setData(0); } { QAction* action = syntaxActionGroup->addAction(tr("Regular expression v2")); action->setCheckable(true); action->setData(1); } { QAction* action = syntaxActionGroup->addAction(tr("Wildcard")); action->setCheckable(true); action->setData(2); } { QAction* action = syntaxActionGroup->addAction(tr("Fixed string")); action->setCheckable(true); action->setData(3); } } connect(syntaxActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(_slot_syntaxAction_triggered(QAction*))); QAction* csAction = new QAction(tr("Case Sensitive"), this); csAction->setCheckable(true); csAction->setChecked(true); connect(csAction, SIGNAL(triggered()), this, SLOT(_slot_csAction_triggered())); QAction* minimalAction = new QAction(tr("Minimal"), this); minimalAction->setCheckable(true); connect(minimalAction, SIGNAL(triggered()), this, SLOT(_slot_minimalAction_triggered())); QMenu* resMenu = new QMenu(this); resMenu->addActions(syntaxActionGroup->actions()); (void)resMenu->addSeparator(); (void)resMenu->addAction(csAction); (void)resMenu->addSeparator(); (void)resMenu->addAction(minimalAction); return resMenu; }
void KTreeWidgetSearchLine::contextMenuEvent( QContextMenuEvent *event ) { QMenu *popup = KLineEdit::createStandardContextMenu(); if ( d->canChooseColumns ) { popup->addSeparator(); QMenu *subMenu = popup->addMenu( i18n("Search Columns") ); QAction* allVisibleColumnsAction = subMenu->addAction( i18n("All Visible Columns"), this, SLOT(_k_slotAllVisibleColumns()) ); allVisibleColumnsAction->setCheckable( true ); allVisibleColumnsAction->setChecked( !d->searchColumns.count() ); subMenu->addSeparator(); bool allColumnsAreSearchColumns = true; QActionGroup* group = new QActionGroup( popup ); group->setExclusive( false ); connect( group, SIGNAL(triggered(QAction*)), SLOT(_k_slotColumnActivated(QAction*)) ); QHeaderView* const header = d->treeWidgets.first()->header(); for ( int j = 0; j < header->count(); j++ ) { int i = header->logicalIndex( j ); if ( header->isSectionHidden( i ) ) continue; QString columnText = d->treeWidgets.first()->headerItem()->text( i ); QAction* columnAction = subMenu->addAction( d->treeWidgets.first()->headerItem()->icon( i ), columnText ); columnAction->setCheckable( true ); columnAction->setChecked( d->searchColumns.isEmpty() || d->searchColumns.contains( i ) ); columnAction->setData( i ); columnAction->setActionGroup( group ); if ( d->searchColumns.isEmpty() || d->searchColumns.indexOf( i ) != -1 ) columnAction->setChecked( true ); else allColumnsAreSearchColumns = false; } allVisibleColumnsAction->setChecked( allColumnsAreSearchColumns ); // searchColumnsMenuActivated() relies on one possible "all" representation if ( allColumnsAreSearchColumns && !d->searchColumns.isEmpty() ) d->searchColumns.clear(); } popup->exec( event->globalPos() ); delete popup; }
void MainWindow::createActions() { m_loadLevelAct = new QAction(QIcon(":icons/resources/icons/open.png"), tr("&Load level"), this); m_startGameAct = new QAction(QIcon(":icons/resources/icons/restart.png"), tr("St&art"), this); m_stopGameAct = new QAction(QIcon(":icons/resources/icons/stop.png"), tr("&Stop"), this); m_pauseGameAct = new QAction(QIcon(":icons/resources/icons/pause.png"), tr("&Pause"), this); m_resumeGameAct = new QAction(QIcon(":icons/resources/icons/resume.png"), tr("&Resume"), this); QActionGroup * pauseResumeActGrp = new QActionGroup(this); pauseResumeActGrp->addAction(m_pauseGameAct); pauseResumeActGrp->addAction(m_resumeGameAct); pauseResumeActGrp->setExclusive(true); connectActions(); }
//------------------------------------------------------------------------ // create all stuff for the menubar //------------------------------------------------------------------------ void ApplicationWindow::createMenubar() { QPixmap newIcon(filenew); QPixmap openIcon(fileopen); QPixmap quitIcon(quit); QFont boldfont; boldfont.setWeight(QFont::Bold); // File menu QMenu *file = new QMenu(tr("&File"), this); file->setFont(QFont("Helvetica", 8)); file->addAction(newIcon, "&New", this, SLOT(newDoc()), Qt::CTRL + Qt::Key_N); file->addAction(openIcon, "&Open", this, SLOT(choose()), Qt::CTRL + Qt::Key_O); file->addSeparator(); file->addAction(quitIcon, "&Quit", qApp, SLOT(closeAllWindows()), Qt::CTRL + Qt::Key_Q); // Preference menu QMenu *pref = new QMenu(tr("&Preference"), this); pref->setFont(QFont("Helvetica", 8)); showMessageAreaAction = pref->addAction("Show MessageArea", this, SLOT(showMsg())); showMessageAreaAction->setChecked(false); // Style menu QMenu *styleMenu = new QMenu(tr("&Style"), this); styleMenu->setFont(QFont("Helvetica", 8)); QActionGroup *ag = new QActionGroup(this); ag->setExclusive(true); QSignalMapper *styleMapper = new QSignalMapper(this); connect(styleMapper, SIGNAL(mapped(const QString &)), this, SLOT(setStyle(const QString &))); // Help menu QMenu *help = new QMenu(tr("&Help"), this); help->setFont(QFont("Helvetica", 8)); help->addAction("&About", this, SLOT(about()), Qt::Key_F1); help->addSeparator(); help->addAction("What's &This", this, SLOT(whatsThis()), Qt::SHIFT + Qt::Key_F1); menuBar()->setFont(boldfont); menuBar()->addMenu(file); menuBar()->addMenu(pref); menuBar()->addMenu(styleMenu); menuBar()->addMenu(help); }
MainWin::MainWin(QWidget *parent) :QMainWindow(parent) { resize(800, 600); speech = new QtSpeech(this); srlirc = new SrlIrc(speech, this); twitchirc = new TwitchIrc(speech, this); streamwatch = new StreamWatch(speech, this); QTabWidget *tabber = new QTabWidget(this); tabber->addTab(srlirc, "SRL IRC"); tabber->addTab(twitchirc, "Twitch IRC"); tabber->addTab(streamwatch, "Stream Watch"); setCentralWidget(tabber); QMenuBar *mbar = menuBar(); QMenu *filemenu = mbar->addMenu("File"); filemenu->addAction("Exit", this, SLOT(close())); QMenu *voicemenu = mbar->addMenu("Voices"); QActionGroup *ag = new QActionGroup(voicemenu); ag->setExclusive(true); for(const QtSpeech::VoiceName &vname: speech->voices()) { QAction *vaction = ag->addAction(vname.name); voicemenu->addAction(vaction); vaction->setCheckable(true); if(speech->name().id == vname.id) vaction->setChecked(true); connect(vaction, &QAction::triggered, this, [this, vname, vaction]() { speech->deleteLater(); speech = new QtSpeech(vname, this); vaction->setChecked(true); }); } }
void TupSymbolEditor::loadTools() { QActionGroup *group = new QActionGroup(this); group->setExclusive(true); foreach (QObject *plugin, TupPluginManager::instance()->tools()) { TupToolPlugin *tool = qobject_cast<TupToolPlugin *>(plugin); QStringList::iterator it; QStringList keys = tool->keys(); for (it = keys.begin(); it != keys.end(); ++it) { #ifdef K_DEBUG tDebug("plugins") << "*** Tool Loaded: " << *it; #endif TAction *act = tool->actions()[*it]; if (act) { connect(act, SIGNAL(triggered()), this, SLOT(selectTool())); switch (tool->toolType()) { case TupToolInterface::Selection: { k->selectionTools->addAction(act); } break; case TupToolInterface::Fill: { k->fillTools->addAction(act); } break; case TupToolInterface::View: { k->viewTools->addAction(act); } break; case TupToolInterface::Brush: { k->brushTools->addAction(act); } break; } group->addAction(act); act->setCheckable(true); act->setParent(plugin); } } }
bool SkinsPlugIn::execute(PlugInArgList* pInArgList, PlugInArgList* pOutArgList) { MenuBar* pMenu = Service<DesktopServices>()->getMainMenuBar(); QAction* pBefore = pMenu->getMenuItem("&View/&Status Bar"); mpSkinsMenu = pMenu->addMenu("&View/S&kins", pBefore); mpSkinsMenu->setStatusTip("Change the current application skin."); VERIFY(mpSkinsMenu); VERIFY(connect(mpSkinsMenu, SIGNAL(triggered(QAction*)), this, SLOT(changeSkin(QAction*)))); QActionGroup* pActionGroup = new QActionGroup(mpSkinsMenu); pActionGroup->setExclusive(true); // Add default menu entries mpDefaultAction = mpSkinsMenu->addAction("Default"); mpDefaultAction->setCheckable(true); pActionGroup->addAction(mpDefaultAction); // Scan the skins directory const Filename* pPath = ConfigurationSettings::getSettingSupportFilesPath(); FactoryResource<FileFinder> pFinder; VERIFY(pPath && pFinder.get()); pFinder->findFile(pPath->getFullPathAndName() + "/Skins", "*.css", true); while (pFinder->findNextFile()) { std::string title; pFinder->getFileTitle(title); QAction* pAction = mpSkinsMenu->addAction(QString::fromStdString(title)); pAction->setCheckable(true); pActionGroup->addAction(pAction); } pFinder->findFile(pPath->getFullPathAndName() + "/Skins", "*.rcc", true); while (pFinder->findNextFile()) { std::string fullPath; std::string fileTitle; pFinder->getFullPath(fullPath); pFinder->getFileTitle(fileTitle); QString path = QString::fromStdString(fullPath); QString root = "/" + QString::fromStdString(fileTitle); if (QResource::registerResource(path, root)) { mRegisteredResources[root] = path; } } mDefaultStyleSheet = qApp->styleSheet(); mpDefaultAction->setChecked(true); return true; }
Frame::Frame( QWidget *parent, const char *name ) : QMainWindow( parent, name ) { QMenuBar *mainMenu = menuBar(); QPopupMenu *fileMenu = new QPopupMenu( this, "file" ); fileMenu->insertItem( tr( "&Exit" ), this, SLOT( close() ), QAccel::stringToKey( tr( "Ctrl+Q" ) ) ); QPopupMenu *styleMenu = new QPopupMenu( this, "style" ); styleMenu->setCheckable( TRUE ); QActionGroup *ag = new QActionGroup( this, 0 ); ag->setExclusive( TRUE ); QSignalMapper *styleMapper = new QSignalMapper( this ); connect( styleMapper, SIGNAL( mapped( const QString& ) ), this, SLOT( setStyle( const QString& ) ) ); QStringList list = QStyleFactory::keys(); list.sort(); QDict<int> stylesDict( 17, FALSE ); for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { QString style = *it; QString styleAccel = style; if ( stylesDict[styleAccel.left(1)] ) { for ( uint i = 0; i < styleAccel.length(); i++ ) { if ( !stylesDict[styleAccel.mid( i, 1 )] ) { stylesDict.insert(styleAccel.mid( i, 1 ), (const int *)1); styleAccel = styleAccel.insert( i, '&' ); break; } } } else { stylesDict.insert(styleAccel.left(1), (const int *)1); styleAccel = "&"+styleAccel; } QAction *a = new QAction( style, QIconSet(), styleAccel, 0, ag, 0, ag->isExclusive() ); connect( a, SIGNAL( activated() ), styleMapper, SLOT(map()) ); styleMapper->setMapping( a, a->text() ); } ag->addTo( styleMenu ); mainMenu->insertItem( tr( "&File" ), fileMenu ); mainMenu->insertItem( tr( "St&yle" ), styleMenu ); stack = new QWidgetStack( this ); setCentralWidget( stack ); }
QActionGroup* FilterFriendOnline::createActions() { QActionGroup* actions = new QActionGroup(this); actions->setExclusive(false); QAction* onlineAction = new QAction(tr("Online"), actions); #ifndef Q_WS_MAEMO_5 onlineAction->setIcon(QIcon(":/res/list_online.png")); #else onlineAction->setIcon(QIcon(":/res/list_online_w.png")); #endif onlineAction->setCheckable(true); connect(onlineAction, SIGNAL(toggled(bool)), SLOT(onlineActionToggled(bool))); return actions; }
frmSearchReplace::frmSearchReplace(TopEditorContainer *topEditorContainer, QWidget *parent) : QMainWindow(parent), ui(new Ui::frmSearchReplace), m_topEditorContainer(topEditorContainer) { ui->setupUi(this); setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint); move( parentWidget()->window()->frameGeometry().topLeft() + parentWidget()->window()->rect().center() - rect().center()); ui->cmbSearch->completer()->setCaseSensitivity(Qt::CaseSensitive); ui->cmbReplace->completer()->setCaseSensitivity(Qt::CaseSensitive); NqqSettings& s = NqqSettings::getInstance(); ui->cmbSearch->addItems(s.Search.getSearchHistory()); ui->cmbSearch->setCurrentText(""); ui->cmbReplace->addItems(s.Search.getReplaceHistory()); ui->cmbReplace->setCurrentText(""); connect(ui->cmbSearch->lineEdit(), &QLineEdit::textEdited, this, &frmSearchReplace::on_searchStringEdited); connect(ui->cmbSearch->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindNext_clicked); connect(ui->cmbReplace->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindNext_clicked); connect(ui->actionAdvancedSearch, &QAction::triggered, this, &frmSearchReplace::toggleAdvancedSearch); ui->actionFind->setIcon(IconProvider::fromTheme("edit-find")); ui->actionReplace->setIcon(IconProvider::fromTheme("edit-find-replace")); QActionGroup *tabGroup = new QActionGroup(this); tabGroup->addAction(ui->actionFind); tabGroup->addAction(ui->actionReplace); tabGroup->addAction(ui->actionAdvancedSearch); tabGroup->setExclusive(true); // Initialize all the tabs ui->actionFind->setChecked(true); ui->actionReplace->setChecked(true); ui->chkShowAdvanced->toggled(ui->chkShowAdvanced->isChecked()); setCurrentTab(TabSearch); }
/* Constructor: */ UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent) : QIWithRetranslateUI<QWidget>(pParent) , m_machineState(KMachineState_Null) , m_pUpdateTimer(new QTimer(this)) , m_vMargin(10) , m_pbgImage(0) , m_pPreviewImg(0) , m_pGlossyImg(0) { /* Setup contents: */ setContentsMargins(0, 5, 0, 5); setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); /* Create session instance: */ m_session.createInstance(CLSID_Session); /* Create the context menu: */ setContextMenuPolicy(Qt::DefaultContextMenu); m_pUpdateTimerMenu = new QMenu(this); QActionGroup *pUpdateTimeG = new QActionGroup(this); pUpdateTimeG->setExclusive(true); for(int i = 0; i < UpdateInterval_Max; ++i) { QAction *pUpdateTime = new QAction(pUpdateTimeG); pUpdateTime->setData(i); pUpdateTime->setCheckable(true); pUpdateTimeG->addAction(pUpdateTime); m_pUpdateTimerMenu->addAction(pUpdateTime); m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime; } m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(UpdateInterval_500ms)]); /* Load preview update interval: */ QString strInterval = vboxGlobal().virtualBox().GetExtraData(GUI_PreviewUpdate); /* Parse loaded value: */ UpdateInterval interval = m_intervals.key(strInterval, UpdateInterval_1000ms); /* Initialize with the new update interval: */ setUpdateInterval(interval, false); /* Setup connections: */ connect(m_pUpdateTimer, SIGNAL(timeout()), this, SLOT(sltRecreatePreview())); connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString, KMachineState))); /* Retranslate the UI */ retranslateUi(); }
ViewHelpMenu::ViewHelpMenu(QWidget * parent, QGLWidget * glwidget, const char * name) : QMenu(parent), __glwidget(glwidget) { if(name) setObjectName(name); __about = new ViewAboutDialog(this,false); QObject::connect(__about,SIGNAL(licenseView()),this,SLOT(showLicense())); addAction( tr("What's &This?"), parent->parent() , SLOT(whatsThis()), Qt::Key_F1); addAction(QPixmap(ViewSysInfo::tools_logo),tr("&Help"),this,SLOT(showHelp()),Qt::SHIFT+Qt::Key_F1); addSeparator(); addAction(QPixmap(ViewerIcon::getPixmap(ViewerIcon::flower)),tr("&About Viewer"),this,SLOT(showAbout()), Qt::CTRL+Qt::Key_F1); addAction(tr("&License"),this,SLOT(showLicense())); addAction(QPixmap(ViewSysInfo::qt_logo),tr("About &Qt"),this,SLOT(aboutQt())); // addAction(QPixmap(ViewSysInfo::qt_logo),tr("About &QGLViewer"),glwidget,SLOT(aboutQGLViewer())); addSeparator(); addAction(QPixmap(ViewSysInfo::info_logo),tr("Technical Characteristics"),this,SLOT(generalInfo())); // addAction(QPixmap(ViewSysInfo::qt_logo),tr("Qt Hierarchy"),this,SLOT(qtbrowse())); addSeparator(); __style = new QMenu(this); __style->setTitle(tr("Style")); addMenu(__style); QStringList styles = QStyleFactory::keys(); QActionGroup * actiongroup = new QActionGroup(__style); actiongroup->setExclusive(true); QAction * action = NULL; for(uint k = 0 ; k < styles.size(); k++){ action = __style->addAction(styles[k]); action->setCheckable(true); actiongroup->addAction(action); __ids.push_back( action ); } __style->addSeparator(); action = __style->addAction("Default"); action->setCheckable(true); actiongroup->addAction(action); __ids.push_back( action ); default_style_name = QApplication::style()->metaObject()->className(); checkItem(__ids.size()-1); ViewerSettings settings; settings.beginGroup("WinStyle"); QString stylename = settings.value("StyleName","Default").toString(); settings.endGroup(); setStyle(stylename); QObject::connect(__style,SIGNAL(triggered(QAction *)),this,SLOT(setStyleCorrespondingTo(QAction*))); }
void ObjectWorkspace::CreateModeToolbarActions() { QIcon lightModeIcon(":/images/lightMode.png"); QIcon objectModeIcon(":/images/objectMode.png"); QActionGroup *modeGroup = new QActionGroup(this); modeGroup->setExclusive(true); mObjectModeAction = modeGroup->addAction(objectModeIcon, "Object Mode"); mLightModeAction = modeGroup->addAction(lightModeIcon, "Light Mode"); mObjectModeAction->setCheckable(true); mObjectModeAction->setChecked(true); mLightModeAction->setCheckable(true); //mLightModeAction->setDisabled(true); }
void FindFadLineEdit::init() { menuOptions = new QMenu( this ); actionCaseSensitive = new QAction( this ); actionWholeWords = new QAction( this ); actionRegExp = new QAction( this ); menuOptions->addAction( actionCaseSensitive ); menuOptions->addAction( actionWholeWords ); menuOptions->addAction( actionRegExp ); tButtonOptions.setCursor( Qt::ArrowCursor ); tButtonOptions.setFocusPolicy( Qt::NoFocus ); tButtonOptions.setStyleSheet( "QToolButton { border: none; }" ); tButtonOptions.setToolButtonStyle( Qt::ToolButtonIconOnly ); tButtonOptions.setIconSize( QSize( 17, 17 ) ); tButtonOptions.setToolTip( tr( "Options" ) ); tButtonOptions.setStatusTip( tr( "Options" ) ); tButtonOptions.setWhatsThis( tr( "Options" ) ); connect( &tButtonOptions, SIGNAL( clicked() ), SLOT( invokeShowOptions() ) ); addButton( &tButtonOptions, Left ); actionCaseSensitive->setText( tr( "Case sensitive" ) ); actionCaseSensitive->setCheckable( true ); actionCaseSensitive->setIcon( QIcon( ":/casesensitively" ) ); actionWholeWords->setText( tr( "Whole words" ) ); actionWholeWords->setCheckable( true ); actionWholeWords->setIcon( QIcon( ":/wholewords" ) ); actionRegExp->setText( tr( "Use regular expression" ) ); actionRegExp->setCheckable( true ); actionRegExp->setIcon( QIcon( ":/regexp" ) ); QActionGroup * findActionGroup = new QActionGroup( this ); findActionGroup->setExclusive( false ); findActionGroup->addAction( actionCaseSensitive ); findActionGroup->addAction( actionWholeWords ); findActionGroup->addAction( actionRegExp ); connect( findActionGroup, SIGNAL( triggered(QAction*) ), SLOT( invokeFindFlagsChanged() ) ); updateIcons(); }