QAction* RS_ActionDrawLineParallel::createGUIAction(RS2::ActionType type, QObject* /*parent*/) { QAction* action = NULL; if (type==RS2::ActionDrawLineParallel) { // tr("Para&llel"), action = new QAction(tr("Parallel"), NULL); action->setIcon(QIcon(":/extui/linespara.png")); } else if (type==RS2::ActionDrawArcParallel) { action = new QAction(tr("Concentric"), NULL); action->setIcon(QIcon(":/extui/arcspara.png")); } else if (type==RS2::ActionDrawCircleParallel) { action = new QAction(tr("Concentric"), NULL); action->setIcon(QIcon(":/extui/circlespara.png")); } //action->zetStatusTip(tr("Draw parallels to existing lines, arcs, "circles")); return action; }
void MusicSongsListWidget::contextMenuEvent(QContextMenuEvent *event) { QTableWidget::contextMenuEvent(event); QMenu rightClickMenu(this); QMenu musicPlaybackMode(tr("playbackMode"), &rightClickMenu); rightClickMenu.setStyleSheet(MusicUIObject::MMenuStyle02); rightClickMenu.addAction(tr("changSongName"), this, SLOT(setChangSongName())); rightClickMenu.addAction(QIcon(":/contextMenu/play"), tr("musicPlay"), this, SLOT(musicPlayClicked())); rightClickMenu.addMenu(&musicPlaybackMode); QAction *order = musicPlaybackMode.addAction(tr("OrderPlay"), this, SIGNAL(musicPlayOrder())); QAction *random = musicPlaybackMode.addAction(tr("RandomPlay"), this, SIGNAL(musicPlayRandom())); QAction *lCycle = musicPlaybackMode.addAction(tr("ListCycle"), this, SIGNAL(musicPlayListLoop())); QAction *sCycle = musicPlaybackMode.addAction(tr("SingleCycle"), this, SIGNAL(musicPlayOneLoop())); QAction *once = musicPlaybackMode.addAction(tr("PlayOnce"), this, SIGNAL(musicPlayItemOnce())); (m_songplaymode == MusicObject::MC_PlayOrder) ? order->setIcon(QIcon(":/share/selected")) : order->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayRandom) ? random->setIcon(QIcon(":/share/selected")) : random->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayListLoop) ? lCycle->setIcon(QIcon(":/share/selected")) : lCycle->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayOneLoop) ? sCycle->setIcon(QIcon(":/share/selected")) : sCycle->setIcon(QIcon()); (m_songplaymode == MusicObject::MC_PlayOnce) ? once->setIcon(QIcon(":/share/selected")) : once->setIcon(QIcon()); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/love"), tr("addToLove"), this, SLOT(addMusicSongToLovestListAt())); QMenu musicAddNewFiles(tr("addNewFiles"), &rightClickMenu); rightClickMenu.addMenu(&musicAddNewFiles)->setIcon(QIcon(":/contextMenu/add")); musicAddNewFiles.addAction(tr("openOnlyFiles"), this, SIGNAL(musicAddNewFiles())); musicAddNewFiles.addAction(tr("openOnlyDir"), this, SIGNAL(musicAddNewDir())); QMenu musicToolMenu(tr("musicTool"), &rightClickMenu); musicToolMenu.addAction(tr("bell"), this, SLOT(musicMakeRingWidget())); musicToolMenu.addAction(tr("transform"), this, SLOT(musicTransformWidget())); rightClickMenu.addMenu(&musicToolMenu); rightClickMenu.addAction(tr("musicInfoD"), this, SLOT(musicFileInformation())); rightClickMenu.addAction(tr("openFileDir"), this, SLOT(musicOpenFileDir())); rightClickMenu.addSeparator(); rightClickMenu.addAction(QIcon(":/contextMenu/delete"), tr("delete"), this, SLOT(setDeleteItemAt())); rightClickMenu.addAction(tr("deleteWithFile"), this, SLOT(setDeleteItemWithFile())); rightClickMenu.addAction(tr("deleteAll"), this, SLOT(setDeleteItemAll())); rightClickMenu.exec(QCursor::pos()); //Menu location for the current mouse position event->accept(); }
void Albums::init() { DEBUG_BLOCK // Call the base implementation. Context::Applet::init(); enableHeader( true ); setHeaderText( i18n( "Recently Added Albums" ) ); setCollapseOffHeight( -1 ); setCollapseHeight( m_header->height() ); setMinimumHeight( collapseHeight() ); QAction *settingsAction = new QAction( this ); settingsAction->setIcon( KIcon( "preferences-system" ) ); settingsAction->setEnabled( true ); settingsAction->setToolTip( i18n( "Settings" ) ); addRightHeaderAction( settingsAction ); connect( settingsAction, SIGNAL(triggered()), this, SLOT(showConfigurationInterface()) ); QAction *filterAction = new QAction( this ); filterAction->setIcon( KIcon( "view-filter" ) ); filterAction->setEnabled( true ); filterAction->setToolTip( i18n( "Filter Albums" ) ); m_filterIcon = addLeftHeaderAction( filterAction ); connect( filterAction, SIGNAL(triggered()), this, SLOT(showFilterBar()) ); m_albumsView = new AlbumsView( this ); m_albumsView->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); if( m_rightAlignLength ) m_albumsView->setLengthAlignment( Qt::AlignRight ); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical ); layout->addItem( m_header ); layout->addItem( m_albumsView ); setLayout( layout ); dataEngine( "amarok-current" )->connectSource( "albums", this ); connect( CollectionManager::instance(), SIGNAL(collectionDataChanged(Collections::Collection*)), this, SLOT(collectionDataChanged(Collections::Collection*)) ); updateConstraints(); }
LogWidget::LogWidget(QWidget *parent) : QMainWindow(parent) { m_contents = new QTextEdit(this); QFont font("Monospace"); font.setStyleHint(QFont::TypeWriter); m_contents->setFont(font); m_contents->setReadOnly(true); QPalette palette; palette.setColor(QPalette::Base, Qt::black); m_contents->setPalette(palette); setPalette(palette); QToolBar *toolBar = new QToolBar(this); toolBar->setMovable(false); toolBar->setAllowedAreas(Qt::TopToolBarArea); toolBar->setIconSize(QSize(32, 32)); toolBar->setToolButtonStyle(Qt::ToolButtonIconOnly); toolBar->setFloatable(false); QAction *actionShowStats = new QAction(this); QIcon showStatsIcon; showStatsIcon.addFile(QString::fromUtf8(":/resources/showStats.png"), QSize(), QIcon::Normal, QIcon::Off); actionShowStats->setIcon(showStatsIcon); actionShowStats->setToolTip(tr("Show statistics")); actionShowStats->setText(tr("Show Statistics")); connect(actionShowStats, SIGNAL(triggered()), this, SLOT(onShowStats())); toolBar->addAction(actionShowStats); QAction *actionClear = new QAction(this); QIcon clearIcon; clearIcon.addFile(QString::fromUtf8(":/resources/clear.png"), QSize(), QIcon::Normal, QIcon::Off); actionClear->setIcon(clearIcon); actionClear->setToolTip(tr("Clear")); actionClear->setText(tr("Clear")); connect(actionClear, SIGNAL(triggered()), m_contents, SLOT(clear())); toolBar->addAction(actionClear); #if defined(__OSX__) toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); #endif addToolBar(Qt::TopToolBarArea, toolBar); setCentralWidget(m_contents); setUnifiedTitleAndToolBarOnMac(true); setWindowTitle(tr("Log")); resize(QSize(1000, 500)); }
/** * Create an action for an entry in the context menu. * @param text the text of the action * @param method the method to call when triggered * @param icon the shown icon * @return the created action */ QAction* RefactoringAssistant::createAction(const QString& text, const char * method, const Icon_Utils::IconType icon) { Q_UNUSED(method); QAction* action = new QAction(this); action->setText(text); if (icon != Icon_Utils::N_ICONTYPES) { action->setIcon(Icon_Utils::SmallIcon(icon)); } return action; }
QAction* RS_ActionEditPaste::createGUIAction(RS2::ActionType /*type*/, QObject* parent) { // tr("Paste") QAction* action = new QAction(tr("&Paste"), parent); action->setIcon(QIcon(":/actions/editpaste2.png")); action->setShortcut(QKeySequence::Paste); //action->zetStatusTip(tr("Pastes the clipboard contents")); return action; }
QAction* RS_ActionBlocksFreezeAll::createGUIAction(RS2::ActionType type, QObject* /*parent*/) { QAction* action = NULL; if (type==RS2::ActionBlocksFreezeAll) { // tr("Freeze all") action= new QAction(tr("&Hide all"), NULL); //action->zetStatusTip(tr("Freeze all blocks")); action->setIcon(QIcon(":/ui/blockfreeze.png")); } else if (type==RS2::ActionBlocksDefreezeAll) { // tr("&Defreeze all") action = new QAction(tr("&Show all"), NULL); //action->zetStatusTip(tr("Defreeze all blocks")); action->setIcon(QIcon(":/ui/blockdefreeze.png")); } return action; }
void SelectionView::onItemContextMenu(QPoint point) { QListWidgetItem *item = selectionView->itemAt(point); if (!item) return; QMenu *menu = new QMenu; QAction *selectAction = menu->addAction(tr("Select only"),this,SLOT(select())); selectAction->setIcon(QIcon(QString::fromAscii(":/icons/view-select.svg"))); selectAction->setToolTip(tr("Selects only this object")); QAction *deselectAction = menu->addAction(tr("Deselect"),this,SLOT(deselect())); deselectAction->setIcon(QIcon(QString::fromAscii(":/icons/view-unselectable.svg"))); deselectAction->setToolTip(tr("Deselects this object")); QAction *zoomAction = menu->addAction(tr("Zoom fit"),this,SLOT(zoom())); zoomAction->setIcon(QIcon(QString::fromAscii(":/icons/view-zoom-fit.svg"))); zoomAction->setToolTip(tr("Selects and fits this object in the 3D window")); QAction *gotoAction = menu->addAction(tr("Go to selection"),this,SLOT(treeSelect())); gotoAction->setToolTip(tr("Selects and locates this object in the tree view")); menu->exec(selectionView->mapToGlobal(point)); }
void AWebView::contextMenuEvent (QContextMenuEvent* event) { QString selected = page()->selectedText(); if (selected.length() == 0 || LinkHovered == true) QWebView::contextMenuEvent(event); else { // Странно, но если делать m_menu переменной класса и задать все нужные свойства в конструкторе, // то возникает AV :\ разбираться с причинами лениво, ибо не так уж и накладно создавать каждый раз QMenu* m_menu = new QMenu(this); m_menu->addAction(pageAction(QWebPage::Copy)); m_menu->addSeparator(); QAction* yandex = m_menu->addAction(QString::fromUtf8("Яндекс")); yandex->setIcon(QIcon(":/icons/yandex.ico")); QAction* wikipedia = m_menu->addAction(QString::fromUtf8("Википедия")); wikipedia->setIcon(QIcon(":/icons/wikipedia.ico")); QAction* google = m_menu->addAction(QString::fromUtf8("Google")); google->setIcon(QIcon(":/icons/google.ico")); QAction* google_translate = m_menu->addAction(QString::fromUtf8("Google Переводчик")); google_translate->setIcon(QIcon(":/icons/google.translate.ico")); QAction* rsdn = m_menu->addAction(QString::fromUtf8("RSDN")); rsdn->setIcon(QIcon(":/icons/rsdn16.png")); connect(yandex, SIGNAL(triggered()), this, SLOT(menu_yandex_triggered())); connect(wikipedia, SIGNAL(triggered()), this, SLOT(menu_wikipedia_triggered())); connect(google, SIGNAL(triggered()), this, SLOT(menu_google_triggered())); connect(google_translate, SIGNAL(triggered()), this, SLOT(menu_google_translate_triggered())); connect(rsdn, SIGNAL(triggered()), this, SLOT(menu_rsdn_triggered())); m_menu->exec(event->globalPos()); delete m_menu; } }
void LayerGeoref::add_menu_items(QMenu & menu) { QAction * action = NULL; action = new QAction(QObject::tr("&Zoom to Fit Map"), this); action->setIcon(QIcon::fromTheme("GTK_STOCK_ZOOM_FIT")); QObject::connect(action, SIGNAL (triggered(bool)), this, SLOT (zoom_to_fit_cb(void))); menu.addAction(action); action = new QAction(QObject::tr("&Goto Map Center"), this); action->setIcon(QIcon::fromTheme("GTK_STOCK_JUMP_TO")); QObject::connect(action, SIGNAL (triggered(bool)), this, SLOT (goto_center_cb(void))); menu.addAction(action); action = new QAction(QObject::tr("&Export to World File"), this); action->setIcon(QIcon::fromTheme("GTK_STOCK_HARDDISK")); QObject::connect(action, SIGNAL (triggered(bool)), this, SLOT (export_params_cb(void))); menu.addAction(action); }
QAction* RS_ActionInfoAngle::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { /* RVT_PORT QAction* action = new QAction(tr("Angle between two lines"), tr("&Angle between two lines"), QKeySequence(), NULL); */ QAction* action = new QAction(tr("An&gle between two lines"), NULL); //action->zetStatusTip(tr("Measures the angle between two lines")); action->setIcon(QIcon(":/extui/infoangle.png")); return action; }
void Pane::slotTabContextMenuRequest( QWidget * tab, const QPoint &pos ) { if ( !tab ) return; // sanity KMenu menu( this ); if ( !tab->inherits( "KMail::MessageListView::Widget" ) ) return; Widget * w = dynamic_cast< Widget * >( tab ); if ( !w ) return; // sanity QVariant data; data.setValue< void * >( static_cast< void * >( w ) ); QAction * act; act = menu.addAction( i18nc( "@action:inmenu", "Close Tab" ) ); act->setData( data ); act->setEnabled( count() > 1 ); act->setIcon( SmallIcon( "tab-close" ) ); QObject::connect( act, SIGNAL( triggered( bool ) ), SLOT( slotActionTabCloseRequest() ) ); act = menu.addAction( i18nc("@action:inmenu", "Close All Other Tabs" ) ); act->setData( data ); act->setEnabled( count() > 1 ); act->setIcon( SmallIcon( "tab-close-other" ) ); QObject::connect( act, SIGNAL( triggered( bool ) ), SLOT( slotActionTabCloseAllButThis() ) ); if ( menu.isEmpty() ) return; // nuthin to show menu.exec( pos ); }
QAction* RS_ActionDrawCircle::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { /*RVT_PORT QAction* action = new QAction(tr("Circle: Center, Point"), tr("Center, &Point"), QKeySequence(), NULL); */ // "Circle: Center, Point" QAction* action = new QAction(tr("Center, &Point"), NULL); action->setIcon(QIcon(":/extui/circles.png")); //action->zetStatusTip(tr("Draw circles with center and point")); return action; }
void WindowService::display(GenericInterface* gi) { _mdi = gi->initCentralWidget(); _mdi->setActivationOrder(QMdiArea::CreationOrder); _nav = new NavigationDock(tr("Images"), gi); gi->addDockWidget(_navPos, _nav); QAction* tile = gi->menu(tr("&Window"))->addAction(tr("&Tile windows")); tile->setIcon(QIcon(":/images/application-view-tile.png")); //tile->setShortcut(QKeySequence::Open); gi->toolBar(tr("Tools"))->addAction(tile); QObject::connect(tile, SIGNAL(triggered()), _mdi, SLOT(tileSubWindows())); QAction* cascade = gi->menu(tr("&Window"))->addAction(tr("&Cascade windows")); cascade->setIcon(QIcon(":/images/application-cascade.png")); //tile->setShortcut(QKeySequence::Open); gi->toolBar(tr("Tools"))->addAction(cascade); QObject::connect(cascade, SIGNAL(triggered()), _mdi, SLOT(cascadeSubWindows())); }
void StatusMenu::addStatus(XMPP::Status::Type type) { QAction* action = new QAction(status2txt(type), this); action->setCheckable(true); action->setChecked(currentStatus_ == type); action->setIcon(PsiIconset::instance()->status(type).icon()); action->setProperty("type", QVariant(type)); connect(action, SIGNAL(triggered()), SLOT(actionActivated())); addAction(action); }
void ConsoleChannel::initCapabilityMenu(const QLCChannel* ch) { QLCCapability* cap; QMenu* valueMenu; QAction* action; QString s; QString t; QListIterator <QLCCapability*> it(ch->capabilities()); while (it.hasNext() == true) { cap = it.next(); // Set the value range and name as the menu item's name s = QString("%1: %2 - %3").arg(cap->name()) .arg(cap->min()).arg(cap->max()); if (cap->max() - cap->min() > 0) { // Create submenu for ranges of more than one value valueMenu = new QMenu(m_menu); valueMenu->setTitle(s); /* Add a color icon */ if (ch->group() == QLCChannel::Colour) valueMenu->setIcon(colorIcon(cap->name())); for (int i = cap->min(); i <= cap->max(); i++) { action = valueMenu->addAction( t.sprintf("%.3d", i)); action->setData(i); } m_menu->addMenu(valueMenu); } else { // Just one value in this range, put that into the menu action = m_menu->addAction(s); action->setData(cap->min()); /* Add a color icon */ if (ch->group() == QLCChannel::Colour) action->setIcon(colorIcon(cap->name())); } } // Connect menu item activation signal to this connect(m_menu, SIGNAL(triggered(QAction*)), this, SLOT(slotContextMenuTriggered(QAction*))); // Set the menu also as the preset button's popup menu m_presetButton->setMenu(m_menu); }
// Most initialization is moved from constructor to allow signals triggered correctly void ClipartCategoriesList::loadCategories() { TimeMeasure t("ClipartCategoriesList::loadCategories()"); // Fetch list of clipart subfolders QString baseClipartFolder = AppTools::getClipartResourcesFolder(); QDir clipartFolder(baseClipartFolder); if (!clipartFolder.exists()) // If clipart folder not exists (e.g. on development computers) we try to find clipart directly in "Clipart" { baseClipartFolder = CLIPART_DIR; #ifdef Q_WS_MAC baseClipartFolder = "../../" + baseClipartFolder; #endif clipartFolder = QDir(baseClipartFolder); } QStringList folders = clipartFolder.entryList(QDir::Dirs | QDir::NoDotAndDotDot); // Add a button with action for each subfolder QHBoxLayout *layout = new QHBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); for (int i = 0; i < folders.size(); i++) { QAction *action = new QAction(this); action->setToolTip(folders[i]); QString categoryFolder = AppTools::addPathSeparator(baseClipartFolder) + folders[i]; QString iconFile = categoryFolder + CLIPART_ICON_EXTENSION; QIcon icon(iconFile); action->setIcon(icon); QToolButton *button = new QToolButton(this); button->setDefaultAction(action); button->setCheckable(true); connect(button, SIGNAL(triggered(QAction *)), this, SLOT(on_toolbutton_triggered(QAction *))); layout->addWidget(button); buttons << button; clipartCategories[action] = getClipartFolder(categoryFolder, action); if (!startAction) startAction = action; } layout->addStretch(); this->setLayout(layout); if (startAction) sendClipartLoadRequest(startAction); }
void PhotosApplet::init() { DEBUG_BLOCK // Call the base implementation. Context::Applet::init(); // Create label enableHeader( true ); setHeaderText( i18n( "Photos" ) ); // Set the collapse size setCollapseHeight( m_header->height() ); setCollapseOffHeight( 220 ); setMaximumHeight( 220 ); setMinimumHeight( collapseHeight() ); setPreferredHeight( collapseHeight() ); // Icon QAction* settingsAction = new QAction( this ); settingsAction->setIcon( KIcon( "preferences-system" ) ); settingsAction->setVisible( true ); settingsAction->setEnabled( true ); settingsAction->setText( i18n( "Settings" ) ); m_settingsIcon = addRightHeaderAction( settingsAction ); connect( m_settingsIcon, SIGNAL( clicked() ), this, SLOT( showConfigurationInterface() ) ); m_widget = new PhotosScrollWidget( this ); m_widget->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); m_widget->setContentsMargins( 0, 0, 0, 0 ); connect( m_widget, SIGNAL(photoAdded()), SLOT(photoAdded()) ); QGraphicsLinearLayout *layout = new QGraphicsLinearLayout( Qt::Vertical, this ); layout->addItem( m_header ); layout->addItem( m_widget ); // Read config and inform the engine. KConfigGroup config = Amarok::config("Photos Applet"); m_nbPhotos = config.readEntry( "NbPhotos", "10" ).toInt(); m_Animation = config.readEntry( "Animation", "Fading" ); m_KeyWords = config.readEntry( "KeyWords", QStringList() ); if( m_Animation == i18nc( "animation type", "Automatic" ) ) m_widget->setMode( 0 ); else if( m_Animation == i18n( "Interactive" ) ) m_widget->setMode( 1 ); else // fading m_widget->setMode( 2 ); Plasma::DataEngine *engine = dataEngine( "amarok-photos" ); engine->setProperty( "fetchSize", m_nbPhotos ); engine->setProperty( "keywords", m_KeyWords ); engine->connectSource( "photos", this ); }
void QVLCMenu::PopupMenuControlEntries( QMenu *menu, intf_thread_t *p_intf ) { QAction *action; /* Faster/Slower */ action = menu->addAction( qtr( "&Faster" ), THEMIM->getIM(), SLOT( faster() ) ); action->setIcon( QIcon( ":/toolbar/faster") ); action->setData( STATIC_ENTRY ); action = menu->addAction( qtr( "Faster (fine)" ), THEMIM->getIM(), SLOT( littlefaster() ) ); action->setData( STATIC_ENTRY ); action = menu->addAction( qtr( "N&ormal Speed" ), THEMIM->getIM(), SLOT( normalRate() ) ); action->setData( STATIC_ENTRY ); action = menu->addAction( qtr( "Slower (fine)" ), THEMIM->getIM(), SLOT( littleslower() ) ); action->setData( STATIC_ENTRY ); action = menu->addAction( qtr( "Slo&wer" ), THEMIM->getIM(), SLOT( slower() ) ); action->setIcon( QIcon( ":/toolbar/slower") ); action->setData( STATIC_ENTRY ); menu->addSeparator(); action = menu->addAction( qtr( "&Jump Forward" ), THEMIM->getIM(), SLOT( jumpFwd() ) ); action->setIcon( QIcon( ":/toolbar/skip_fw") ); action->setData( STATIC_ENTRY ); action = menu->addAction( qtr( "Jump Bac&kward" ), THEMIM->getIM(), SLOT( jumpBwd() ) ); action->setIcon( QIcon( ":/toolbar/skip_back") ); action->setData( STATIC_ENTRY ); addDPStaticEntry( menu, qtr( I_MENU_GOTOTIME ),"", SLOT( gotoTimeDialog() ), "Ctrl+T" ); menu->addSeparator(); }
KHTMLPluginKTTSD::KHTMLPluginKTTSD( QObject* parent, const QVariantList& ) : Plugin( parent ) { KParts::TextExtension* textExt = KParts::TextExtension::childObject(parent); if (textExt && qobject_cast<KParts::ReadOnlyPart *>(parent)) { QAction *action = actionCollection()->addAction( "tools_kttsd" ); action->setIcon( KIcon("text-speak") ); action->setText( i18n("&Speak Text") ); connect(action, SIGNAL(triggered(bool)), SLOT(slotReadOut())); } }
virtual QList<QAction*> addNewActions(QObject* parent, const QList<KConfigGroup>& existingModules, const QVariant& unused) { Q_UNUSED(unused); Q_UNUSED(existingModules); QAction* action = new QAction(parent); action->setText(i18nc("@action:inmenu Add", "Web Sidebar Module")); action->setIcon(KIcon("internet-web-browser")); return QList<QAction *>() << action; }
void ChatMsgProcessor::onNewStrangerIcon(QString id, QPixmap pix) { QIcon icon; icon.addPixmap(pix); QAction *action = actionById(id); if ( action ) { action->setIcon(icon); } }
void ClangSupport::createActionsForMainWindow (Sublime::MainWindow* /*window*/, QString& _xmlFile, KActionCollection& actions) { _xmlFile = xmlFile(); QAction* renameDeclarationAction = actions.addAction(QStringLiteral("code_rename_declaration")); renameDeclarationAction->setText( i18n("Rename Declaration") ); renameDeclarationAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); actions.setDefaultShortcut(renameDeclarationAction, Qt::CTRL | Qt::SHIFT | Qt::Key_R); connect(renameDeclarationAction, &QAction::triggered, m_refactoring, &BasicRefactoring::executeRenameAction); }
QAction* RS_ActionBlocksToggleView::createGUIAction(RS2::ActionType /*type*/, QObject* /*parent*/) { // RVT_PORT QAction* action = new QAction(tr("Toggle Block Visibility"), // tr("&Toggle Block"), // QKeySequence(), NULL); QAction* action = new QAction(tr("Toggle Block &Visibility"), NULL); action->setIcon(QIcon(":/ui/layertoggle.png")); //action->zetStatusTip(tr("Toggle Block")); return action; }
/****************************************************************************** * Creates and registers a new viewport mode action with the ActionManager. ******************************************************************************/ QAction* ActionManager::createViewportModeAction(const QString& id, ViewportInputMode* inputHandler, const QString& title, const char* iconPath, const QString& statusTip, const QKeySequence& shortcut) { QAction* action = new ViewportModeAction(mainWindow(), title, this, inputHandler); action->setObjectName(id); if(!shortcut.isEmpty()) action->setShortcut(shortcut); action->setStatusTip(statusTip); if(iconPath && Application::instance().guiMode()) action->setIcon(QIcon(QString(iconPath))); addAction(action); return action; }
/****************************************************************************** * Creates and registers a new command action with the ActionManager. ******************************************************************************/ QAction* ActionManager::createCommandAction(const QString& id, const QString& title, const char* iconPath, const QString& statusTip, const QKeySequence& shortcut) { QAction* action = new QAction(title, this); action->setObjectName(id); if(!shortcut.isEmpty()) action->setShortcut(shortcut); action->setStatusTip(statusTip); if(iconPath && Application::instance().guiMode()) action->setIcon(QIcon(QString(iconPath))); addAction(action); return action; }
FunctionToolbar::FunctionToolbar(QWidget *parent) : DVGui::ToolBar(parent), m_frameHandle(0), m_curve(0), m_selection(0) { setFixedHeight(28); m_valueToolbar = new DVGui::ToolBar(); m_keyframeToolbar = new DVGui::ToolBar(); // value field m_valueToolbar->addWidget(new QLabel(tr("Value"))); m_valueFld = new DVGui::MeasuredDoubleLineEdit(); // frame navigator m_frameNavigator = new FrameNavigator(this); // keyframe navigator m_keyframeNavigator = new FunctionKeyframeNavigator(this); QWidget *space = new QWidget(this); DVGui::ToolBar *spaceToolBar = new DVGui::ToolBar(); spaceToolBar->addWidget(space); m_valueFld->setStyleSheet("height:14px;margin-right:5px;margin-top:2px;"); space->setMinimumHeight(22); space->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); QIcon toggleIcon = createQIconOnOffPNG("swap", false); QAction *toggleAction = new QAction(tr("&Function Editor Toggle"), this); assert(toggleAction); toggleAction->setIcon(toggleIcon); //-----layout m_valueFldAction = addWidget(m_valueToolbar); m_keyframeNavigatorAction = addWidget(m_keyframeToolbar); m_valueToolbar->addWidget(m_valueFld); m_valueToolbar->addSeparator(); m_keyframeToolbar->addWidget(m_keyframeNavigator); m_keyframeToolbar->addSeparator(); addWidget(m_frameNavigator); addSeparator(); addWidget(spaceToolBar); addSeparator(); addAction(toggleAction); bool ret = connect(m_valueFld, SIGNAL(valueChanged()), this, SLOT(onValueFieldChanged())); ret = ret && connect(m_frameNavigator, SIGNAL(frameSwitched()), this, SLOT(onNavFrameSwitched())); ret = ret && connect(toggleAction, SIGNAL(triggered()), this, SIGNAL(numericalColumnToggled())); m_valueFldAction->setVisible(false); m_keyframeNavigatorAction->setVisible(false); assert(ret); }
Context::AppletItemOverlay::AppletItemOverlay( Context::AppletToolbarAppletItem *applet, QGraphicsLinearLayout* layout, QWidget *parent ) : QWidget( parent ), m_applet( applet ), m_spacer(0), m_layout( layout ), m_deleteIcon( 0 ), m_index( 0 ), m_clickDrag( false ) { DEBUG_BLOCK if( layout ) { m_layout = layout; int i = 0; for(; i < m_layout->count(); ++i) { QGraphicsWidget *w = dynamic_cast< QGraphicsWidget* >( m_layout->itemAt( i ) ); if( w == m_applet ) { m_index = i; break; } } } else debug() << "GOT APPLET WITH NO LAYOUT! BAD!"; m_deleteIcon = new QToolButton( this ); QAction* delApplet = new QAction( i18n( "Remove Applet" ), this ); delApplet->setIcon( KIcon( "edit-delete" ) ); delApplet->setVisible( true ); delApplet->setEnabled( true ); m_deleteIcon->addAction( delApplet ); m_deleteIcon->setIcon( KIcon( "edit-delete" ) ); m_deleteIcon->setMaximumSize( 24, 24 ); QColor trans; trans.setAlpha( 0 ); QBrush brush( Qt::transparent ); QPalette pal = m_deleteIcon->palette(); pal.setBrush( QPalette::Window, brush ); // m_deleteIcon->setBackgroundRole( QPalette::Base ); m_deleteIcon->setPalette( pal ); m_deleteIcon->setAutoFillBackground( false ); m_deleteIcon->setAttribute( Qt::WA_NoSystemBackground ); //m_deleteIcon->setAttribute( Qt::WA_TranslucentBackground ); //NB: Introduced in Qt 4.5 connect( delApplet, SIGNAL( triggered() ), this, SLOT( deleteApplet() ) ); connect( m_deleteIcon, SIGNAL( released() ), this, SLOT( deleteApplet() ) ); syncGeometry(); connect( m_applet, SIGNAL( destroyed(QObject*) ), this, SLOT( deleteLater() ) ); connect( m_applet, SIGNAL( geometryChanged() ), this, SLOT( delaySyncGeometry() ) ); }
void LatchManager::unlatchRequest( const source_ptr& source ) { Q_UNUSED( source ); AudioEngine::instance()->stop(); AudioEngine::instance()->setPlaylist( Tomahawk::playlistinterface_ptr() ); QAction *latchOnAction = ActionCollection::instance()->getAction( "latchOn" ); latchOnAction->setText( tr( "&Listen Along" ) ); latchOnAction->setIcon( QIcon( RESPATH "images/headphones-sidebar.png" ) ); }
AutoRotateTool::AutoRotateTool(QObject *parent) : Tool(parent), m_glwidget(0), m_leftButtonPressed(false), m_midButtonPressed(false), m_timerId(0), m_xRotation(0), m_yRotation(0), m_zRotation(0), m_maxRotation(40), m_settingsWidget(0), m_buttonStartStop(0), m_sliderX(0), m_sliderY(0), m_sliderZ(0) { QAction *action = activateAction(); action->setIcon(QIcon(QString::fromUtf8(":/autorotate/autorotate.png"))); action->setToolTip(tr("Auto Rotation Tool")); }