NBCategoryMenu::NBCategoryMenu( QString catName, QPixmap icon, QString wNode, QModelIndexList nodeList, QWidget *parent ) : QMenu( parent ) { mCategory = catName; mWorkNode = wNode; sNodes << nodeList; QWidgetAction *title = new QWidgetAction( this ); QWidget *actBase = new QWidget( this ); QLabel *pix = new QLabel(); pix->setFixedSize( 20, 20 ); pix->setPixmap( icon.scaled( 16, 16, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); pix->setAlignment( Qt::AlignCenter ); QLabel *name = new QLabel( "<b>" + catName + "</b>" ); name->setFixedHeight( 20 ); name->setAlignment( Qt::AlignVCenter ); QHBoxLayout *lyt = new QHBoxLayout(); lyt->setContentsMargins( QMargins( 4, 4, 4, 0 ) ); lyt->addWidget( pix ); lyt->addWidget( name ); actBase->setLayout( lyt ); title->setDefaultWidget( actBase ); addAction( title ); addSeparator(); populateMenu(); };
KisMouseInputEditor::KisMouseInputEditor(QWidget *parent) : KPushButton(parent), d(new Private) { QWidget *popup = new QWidget(); d->ui = new Ui::KisMouseInputEditor; d->ui->setupUi(popup); d->ui->mouseButton->setType(KisInputButton::MouseType); d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear")); d->ui->clearMouseButton->setIcon(KisIconUtils::loadIcon("edit-clear")); QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(popup); QMenu *menu = new QMenu(this); menu->addAction(action); setMenu(menu); QTimer::singleShot(0, this, SLOT(showMenu())); connect(d->ui->mouseButton, SIGNAL(dataChanged()), SLOT(updateLabel())); connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel())); connect(d->ui->clearMouseButton, SIGNAL(clicked(bool)), d->ui->mouseButton, SLOT(clear())); connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear())); }
void CMainWindow::initBrushMenu() { // allocate menu members brushMenuAction = new QAction(drawDefActions); brushMenu = new QMenu(this); QWidgetAction *brushSelectorWidgetAction = new QWidgetAction(this); CBrushSelector *brushSelector = new CBrushSelector(brushMenu); // misc brushSelectorWidgetAction->setDefaultWidget(brushSelector); brushMenu->addAction(brushSelectorWidgetAction); brushMenuAction->setToolTip(tr("Brush")); brushMenuAction->setIcon(QIcon(":/images/brush.png")); brushMenuAction->setMenu(brushMenu); drawDefBar->addAction(brushMenuAction); // make connections to main window connect(brushMenuAction, SIGNAL(triggered(bool)), this, SLOT(brushActionTriggeredSlot(bool))); connect(brushSelector, SIGNAL(closeSignal()), this, SLOT(closeBrushMenu())); //connect(brushSelector, SIGNAL(sendBrushSettings(const CBrushSettings *)), // this, SLOT(receiveBrushSettings(const CBrushSettings *))); }
void CMainWindow::initPenMenu() { // allocate menu members penMenuAction = new QAction(drawDefActions); penMenu = new QMenu(this); QWidgetAction *penSelectorWidgetAction = new QWidgetAction(this); CPenSelector *penSelector = new CPenSelector(penMenu); // misc penMenuAction->setToolTip(tr("Pen")); penMenuAction->setShortcut(tr("Ctrl+E")); penMenuAction->setIcon(QIcon(":/images/pen2.png")); penMenuAction->setMenu(penMenu); drawDefBar->addAction(penMenuAction); penSelectorWidgetAction->setDefaultWidget(penSelector); penMenu->addAction(penSelectorWidgetAction); // make connections to main window //connect(penSelector , SIGNAL(penUpdateSig(QPen &)), // this , SLOT(receivePen(QPen &))); connect(penSelector, SIGNAL(sendPenSettings(const CPenSettings *)), this, SLOT(receivePenSettings(const CPenSettings *))); connect(penSelector, SIGNAL(closeSignal()), this, SLOT(closePenMenu())); connect(penMenuAction, SIGNAL(triggered(bool)), this, SLOT(penActionTriggeredSlot(bool))); // request default settings //emit updatePenSig(penSelector->getPen()); }
void CMainWindow::initShapeMenu() { shapeMenuAction = new QAction(drawDefActions); shapeMenuAction->setToolTip(tr("Shapes")); connect(shapeMenuAction, SIGNAL(triggered(bool)), this, SLOT(shapeActionTriggeredSlot(bool))); shapeMenu = new QMenu(this); shapeMenuAction->setIcon(QIcon(":/images/shapes.png")); QWidgetAction *shapeSelectorWidgetAction = new QWidgetAction(this); CShapeSelector *shapeSelector = new CShapeSelector(shapeMenu); shapeSelectorWidgetAction->setDefaultWidget(shapeSelector); shapeMenu->addAction(shapeSelectorWidgetAction); connect(shapeSelector, SIGNAL(shapeChangeSig(shapeType)), this, SLOT(receiveShape(shapeType))); connect(shapeSelector, SIGNAL(xRadChangeSig(int)), this, SLOT(receiveRadiusForRoundedRec_X(int))); connect(shapeSelector, SIGNAL(yRadChangeSig(int)), this, SLOT(receiveRadiusForRoundedRec_Y(int))); connect(shapeSelector, SIGNAL(doCloseShapeMenuSig()), this, SLOT(closeShapeMenu())); shapeMenuAction->setMenu(shapeMenu); drawDefBar->addAction(shapeMenuAction); }
QMenu* Scene_polylines_item::contextMenu() { const char* prop_name = "Menu modified by Scene_polylines_item."; QMenu* menu = Scene_item::contextMenu(); // Use dynamic properties: // http://doc.qt.io/qt-5/qobject.html#property bool menuChanged = menu->property(prop_name).toBool(); if(!menuChanged) { menu->addSeparator(); // TODO: add actions to display corners QAction* action = menu->addAction(tr("Display corners with radius...")); connect(action, SIGNAL(triggered()), this, SLOT(change_corner_radii())); QAction* actionSmoothPolylines = menu->addAction(tr("Smooth polylines")); actionSmoothPolylines->setObjectName("actionSmoothPolylines"); connect(actionSmoothPolylines, SIGNAL(triggered()),this, SLOT(smooth())); QMenu *container = new QMenu(tr("Line Width")); QWidgetAction *sliderAction = new QWidgetAction(0); connect(d->line_Slider, &QSlider::valueChanged, this, &Scene_polylines_item::itemChanged); sliderAction->setDefaultWidget(d->line_Slider); container->addAction(sliderAction); menu->addMenu(container); menu->setProperty(prop_name, true); } return menu; }
bool MenuItemMgr::updateRibbonMenu( Qtitan::RibbonBar* ribonBar) { QObjectList::iterator it , git ; Q_ASSERT( myMainWindow!= NULL ) ; Q_ASSERT( myMenuItems!= NULL ) ; QObjectList pages = myMenuItems->children() ; for( it = pages.begin() ; it != pages.end() ; it++ ) { QWidgetAction *wa = (QWidgetAction*)*it ; if( wa != NULL ) { Qtitan::RibbonPage* page = ribonBar->addPage( wa->text() ); if( page != NULL ) { insertMenu( page , wa ) ; } }// if }// for connect( myMainWindow->getActionGroup() , SIGNAL( triggered( QAction* ) ), myMainWindow, SLOT( onMenuAction( QAction*) ) ); return true ; }
void ComponentWidget::addOption(QWidget *widget) { QWidgetAction *action = new QWidgetAction(widget); action->setDefaultWidget(widget); m_componentUi.optionsButton->menu()->addAction(action); }
CDTMapToolSelectTrainingSamples::CDTMapToolSelectTrainingSamples(QgsMapCanvas *canvas) : QgsMapTool(canvas), mapCanvas(canvas), toolBar(new CDTCategoryToolBar(tr("Select training samples"),MainWindow::getMainWindow())), model(new QSqlQueryModel(this)) { toolBar->setFloatable(true); toolBar->setMovable(true); toolBar->show(); toolBar->raise(); QSettings setting("WHU","CDTStudio"); setting.beginGroup("CDTCategoryToolBar"); QByteArray geometry = setting.value("Geometry").toByteArray(); setting.endGroup(); if (geometry.isEmpty()) { QPoint ptGlobal = MainWindow::getCurrentMapCanvas()->mapToGlobal(MainWindow::getCurrentMapCanvas()->rect().center()); toolBar->move(MainWindow::getMainWindow()->mapFromGlobal(ptGlobal)); } else toolBar->restoreGeometry(geometry); comboBoxCategory = new QComboBox(toolBar); comboBoxCategory->setModel(model); QWidgetAction *actionLabel = new QWidgetAction(this); QWidgetAction *actionCombo = new QWidgetAction(this); actionLabel->setDefaultWidget(new QLabel(tr("Category"),toolBar)); actionCombo->setDefaultWidget(comboBoxCategory); toolBar->addAction(actionLabel); toolBar->addAction(actionCombo); MainWindow::getMainWindow()->addToolBar(toolBar); }
void ComicMainWindow::setupContextMenu() { QMenu *cmenu = view->contextMenu(); pageinfo = new QLabel(cmenu); pageinfo->setMargin(3); pageinfo->setAlignment(Qt::AlignHCenter); pageinfo->setFrameStyle(QFrame::Box | QFrame::Raised); QWidgetAction *actionPageInfo = new QWidgetAction(this); actionPageInfo->setDefaultWidget(pageinfo); cmenu->addAction(actionNextPage); cmenu->addAction(actionPreviousPage); cmenu->addSeparator(); cmenu->addAction(actionFitWidth); cmenu->addAction(actionFitHeight); cmenu->addAction(actionWholePage); cmenu->addAction(actionOriginalSize); cmenu->addAction(actionBestFit); cmenu->addSeparator(); cmenu->addAction(actionRotateRight); cmenu->addAction(actionRotateLeft); cmenu->addAction(actionNoRotation); cmenu->addSeparator(); cmenu->addAction(actionTwoPages); cmenu->addAction(actionMangaMode); cmenu->addSeparator(); cmenu->addAction(actionFullscreen); cmenu->addAction(actionPageInfo); }
EmoticonMenu::EmoticonMenu(QWidget *parent) : QMenu(parent) { layout = new QGridLayout(this); layout->setContentsMargins(1,1,1,1); layout->setSpacing(0); QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(new QWidget(this)); action->defaultWidget()->setLayout(layout); this->addAction(action); // some Skype smileys addEmoticon(":/icons/emoticons/emotion_smile.png", {":)", ":-)", ":o)"}); addEmoticon(":/icons/emoticons/emotion_sad.png", {":(", ":-("}); addEmoticon(":/icons/emoticons/emotion_grin.png", {":D", ":-D"}); addEmoticon(":/icons/emoticons/emotion_cool.png", {"8)", "8-)"}); addEmoticon(":/icons/emoticons/emotion_suprised.png", {":O", ":-O"}); addEmoticon(":/icons/emoticons/emotion_wink.png", {";)", ";-)"}); addEmoticon(":/icons/emoticons/emotion_cry.png", {";(", ";-("}); addEmoticon(":/icons/emoticons/emotion_sweat.png", {"(:|"}); // ... addEmoticon(":/icons/emoticons/emotion_kiss.png", {":*", ":-*"}); addEmoticon(":/icons/emoticons/emotion_tongue.png", {":P", ":-P"}); // ... addEmoticon(":/icons/emoticons/emotion_doubt.png", {":^)", ":^-)"}); // ... addEmoticon(":/icons/emoticons/emotion_love.png", {"(inlove)"}); addEmoticon(":/icons/emoticons/emotion_evilgrin.png", {"]:)", "]:-)"}); // ... addEmoticon(":/icons/emoticons/emotion_angel.png", {"O:)", "O:-)", "o:)", "o:-)", "(angel)"}); // ... }
void KviStatusBar::contextPopupAboutToShow() { if(!m_pContextPopup) return; m_pContextPopup->clear(); if(appletExists(m_pClickedApplet)) { QString szApp = m_pClickedApplet->descriptor()->visibleName(); QString szTmp = QString("<center><b>%1</b></center>").arg(szApp); QLabel * pLabel = new QLabel(szTmp,m_pContextPopup); QPalette p; pLabel->setStyleSheet("background-color: " + p.color(QPalette::Normal, QPalette::Mid).name()); QWidgetAction * pWaction = new QWidgetAction(m_pContextPopup); pWaction->setDefaultWidget(pLabel); m_pContextPopup->addAction(pWaction); m_pClickedApplet->fillContextPopup(m_pContextPopup); szTmp = QString(__tr2qs("Remove %1")).arg(szApp); m_pContextPopup->addSeparator(); m_pContextPopup->addAction(szTmp,this,SLOT(removeClickedApplet())); } if(!m_pAppletsPopup) { m_pAppletsPopup = new QMenu(this); connect(m_pAppletsPopup,SIGNAL(aboutToShow()),this,SLOT(appletsPopupAboutToShow())); connect(m_pAppletsPopup,SIGNAL(triggered(QAction *)),this,SLOT(appletsPopupActivated(QAction *))); }
VolumeButton::VolumeButton(QWidget *parent) : QToolButton(parent), menu(0), label(0), slider(0) { setIcon(style()->standardIcon(QStyle::SP_MediaVolume)); setPopupMode(QToolButton::InstantPopup); QWidget *popup = new QWidget(this); slider = new QSlider(Qt::Horizontal, popup); slider->setRange(0, 100); connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(volumeChanged(int))); label = new QLabel(popup); label->setAlignment(Qt::AlignCenter); label->setNum(100); label->setMinimumWidth(label->sizeHint().width()); connect(slider, SIGNAL(valueChanged(int)), label, SLOT(setNum(int))); QBoxLayout *popupLayout = new QHBoxLayout(popup); popupLayout->setMargin(2); popupLayout->addWidget(slider); popupLayout->addWidget(label); QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(popup); menu = new QMenu(this); menu->addAction(action); setMenu(menu); stylize(); }
void MenuItemMgr::insertMenu( QMenu* menu , QWidgetAction* item ) { Q_ASSERT( menu!= NULL ) ; QAction* action = NULL ; QObjectList::iterator it ; QActionGroup* pActionGroup = myMainWindow->getActionGroup() ; Q_ASSERT( pActionGroup!= NULL ) ; QObjectList menuitems = item->children() ; for( it = menuitems.begin() ; it != menuitems.end() ; it++ ) { QWidgetAction *wa = (QWidgetAction*)*it ; if( wa->children().isEmpty() ) { //action = menu->addAction( wa->icon() , wa->text() ) ; menu->addAction(wa); registerAction( wa ) ; pActionGroup->addAction( wa ) ; } else insertMenu( menu , wa ) ; } }
void MenuItemMgr::insertMenu( Qtitan::RibbonGroup* rGroup , QWidgetAction* item ) { QObjectList::iterator it ; QActionGroup* pActionGroup = myMainWindow->getActionGroup() ; Q_ASSERT( pActionGroup!= NULL ) ; QObjectList menuitems = item->children() ; if( menuitems.isEmpty() ) return ; for( it = menuitems.begin() ; it != menuitems.end() ; it++ ) { QWidgetAction *wa = (QWidgetAction*)*it ; if( wa->children().isEmpty() ) { // 不含有子菜单 //QAction* action = rGroup->addAction( wa->icon(), // wa->text(), Qt::ToolButtonTextUnderIcon); rGroup->addAction(wa, Qt::ToolButtonTextUnderIcon); registerAction( wa ) ; pActionGroup->addAction( wa ) ; } else { // 含有子菜单 QMenu* menuPopup = rGroup->addMenu( wa->icon(), wa->text() , Qt::ToolButtonTextUnderIcon); insertMenu( menuPopup , wa ) ; } } }
VideoControl::VideoControl(QWidget *parent) : QWidget(parent) { setStyleSheet("background:black;"); m_timeSlider = new QSlider(Qt::Horizontal, this); m_menuButton = new QToolButton(this); m_playButton = new QPushButton(this); m_volumnButton = new QToolButton(this); m_volumnSlider = new QSlider(Qt::Vertical, this); m_volumnSlider->setRange(0, 100); m_volumnSlider->setValue(100); m_playButton->setIcon(QIcon(":/video/play")); m_volumnButton->setIcon(QIcon(":/video/volumn")); m_menuButton->setIcon(QIcon(":/video/menu")); m_playButton->setCursor(QCursor(Qt::PointingHandCursor)); m_volumnButton->setCursor(QCursor(Qt::PointingHandCursor)); m_menuButton->setCursor(QCursor(Qt::PointingHandCursor)); m_timeSlider->setCursor(QCursor(Qt::PointingHandCursor)); m_volumnSlider->setCursor(QCursor(Qt::PointingHandCursor)); m_popupVolumn.setStyleSheet(BarrageCore::MMenuStyle01); m_timeSlider->setStyleSheet(BarrageCore::MSliderStyle02); m_volumnSlider->setStyleSheet(BarrageCore::MSliderStyle01); m_playButton->setStyleSheet(BarrageCore::MPushButtonStyle02); m_volumnButton->setStyleSheet(BarrageCore::MToolButtonStyle02); m_menuButton->setStyleSheet(BarrageCore::MToolButtonStyle02); QVBoxLayout *controlVLayout = new QVBoxLayout(this); controlVLayout->setSpacing(0); controlVLayout->setContentsMargins(0, 0, 0, 0); QWidget *controlBWidget = new QWidget(this); QHBoxLayout *controlBLayout = new QHBoxLayout(controlBWidget); controlBLayout->setContentsMargins(9, 0, 9, 0); controlBLayout->addWidget(m_menuButton); controlBLayout->addWidget(m_playButton); controlBLayout->addWidget(m_volumnButton); controlBLayout->addStretch(1); controlBLayout->addWidget(createBarrageWidget(), 15); controlBLayout->addStretch(1); controlBWidget->setLayout(controlBLayout); controlVLayout->addWidget(m_timeSlider); controlVLayout->addWidget(controlBWidget); setLayout(controlVLayout); QWidgetAction *widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(m_volumnSlider); m_popupVolumn.addAction(widgetAction); m_volumnButton->setMenu(&m_popupVolumn); m_volumnButton->setPopupMode(QToolButton::InstantPopup); connect(m_menuButton, SIGNAL(clicked()), SLOT(openFileDialog())); connect(m_timeSlider, SIGNAL(sliderReleased()), SLOT(sliderReleased())); connect(m_volumnSlider, SIGNAL(valueChanged(int)), parent, SLOT(volumnChanged(int))); connect(m_playButton, SIGNAL(clicked()), parent, SLOT(play())); }
void CMainWindow::initSelectionMenu() { selectionMenuAction = new QAction(drawDefActions); selectionMenuAction->setToolTip(tr("Segmentation")); connect(selectionMenuAction, SIGNAL(triggered(bool)), this, SLOT(selectionMenuActionTriggeredSlot(bool))); selectionMenu = new QMenu(this); selectionMenuAction->setIcon(QIcon(":/images/shapes.png")); QWidgetAction *selectionWidgetAction = new QWidgetAction(this); selectionSpecifier = new CSelectionSelector(this); selectionWidgetAction->setDefaultWidget(selectionSpecifier); selectionMenu->addAction(selectionWidgetAction); selectionMenuAction->setMenu(selectionMenu); drawDefBar->addAction(selectionMenuAction); // create toolbar and its widgets //selectionActions = new QActionGroup(this); //selectionToolBar = new QToolBar("Define Selection", this); //selectionToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); //selectionToolBar->setIconSize(QSize(40,40)); //selectionToolBar->setAllowedAreas(Qt::NoToolBarArea); //selectionSpecifier = new CSelectionSelector(this); //selectionToolBar->addWidget(selectionSpecifier); //addToolBar(selectionToolBar); // connections connect(this, SIGNAL(requestSelectionMode()), selectionSpecifier, SLOT(resondToRequestAll())); // NOT IMPLEMENTED : //connect(selectionSpecifier, SIGNAL(updateSelectionActionFromWidgetSig(TSelectionAction )), // this, SIGNAL(selectionActionFromToolbarSig(TSelectionAction))); connect(selectionSpecifier, SIGNAL(updateSelectionModeFromWidgetSig(TSelectionMode)), this, SIGNAL(selectionModeFromToolbarSig(TSelectionMode))); connect(selectionSpecifier, SIGNAL(updateSelectionOptionFromWidgetSig(TSelectionOption)), this, SIGNAL(selectionOptionFromToolbarSig(TSelectionOption))); connect(selectionSpecifier, SIGNAL(updateCompositionMode(QPainter::CompositionMode)), this, SIGNAL(selectionCompModeFromToolbarSig(QPainter::CompositionMode))); connect(selectionSpecifier, SIGNAL(updateCompositionAlpha(int)), this, SIGNAL(selectionCompAlphaFromToolbarSig(int))); connect(selectionSpecifier, SIGNAL(updateTransformationMode(TTransformationMode)), this, SIGNAL(selectionTransformationFromToolbarSig(TTransformationMode))); connect(selectionSpecifier, SIGNAL(updateRotationAxis(Qt::Axis, bool)), this, SIGNAL(selectionRotationAxisFromToolbarSig(Qt::Axis, bool))); connect(selectionSpecifier, SIGNAL(updateTransformationSquare(bool)), this, SIGNAL(selectionTransformationSquareFromToolbarSig(bool))); }
/*! Adds the given \a widget to the toolbar as the toolbar's last item. The toolbar takes ownership of \a widget. If you add a QToolButton with this method, the tools bar's Qt::ToolButtonStyle will not be respected. \note You should use QAction::setVisible() to change the visibility of the widget. Using QWidget::setVisible(), QWidget::show() and QWidget::hide() does not work. \sa insertWidget() */ QAction *QToolBar::addWidget(QWidget *widget) { QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(widget); action->d_func()->autoCreated = true; addAction(action); return action; }
/*! Inserts the given \a widget in front of the toolbar item associated with the \a before action. Note: You should use QAction::setVisible() to change the visibility of the widget. Using QWidget::setVisible(), QWidget::show() and QWidget::hide() does not work. \sa addWidget() */ QAction *QToolBar::insertWidget(QAction *before, QWidget *widget) { QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(widget); action->d_func()->autoCreated = true; insertAction(before, action); return action; }
void SAQwtPlotCurveItemSetWidget::createSymbolSetWidget() { m_symbolSetMenu = new QMenu(this); QWidgetAction* act = new QWidgetAction(m_symbolSetMenu); m_symbolSetWidget = new SAQwtSymbolSetWidget(); act->setDefaultWidget(m_symbolSetWidget); m_symbolSetMenu->addAction(act); connect(m_symbolSetMenu,&QMenu::aboutToHide ,this,&SAQwtPlotCurveItemSetWidget::onSymbolSetMenuHide); }
VolumePopupButton::VolumePopupButton( QWidget * parent, PlayerManager *mgr ) : QToolButton( parent ), m_prevVolume(0.0), m_curVolume(0.0), player(mgr) { //create the volume popup m_volumeMenu = new QMenu( this ); KVBox *mainBox = new KVBox( this ); m_volumeLabel= new QLabel( mainBox ); m_volumeLabel->setAlignment( Qt::AlignHCenter ); KHBox *sliderBox = new KHBox( mainBox ); m_volumeSlider = new VolumeSlider( 100, sliderBox, false ); m_volumeSlider->setFixedHeight( 170 ); mainBox->setMargin( 0 ); mainBox->setSpacing( 0 ); sliderBox->setSpacing( 0 ); sliderBox->setMargin( 0 ); mainBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); sliderBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); QWidgetAction *sliderActionWidget = new QWidgetAction( this ); sliderActionWidget->setDefaultWidget( mainBox ); // volumeChanged is a customSignal, is not emited by setValue() connect( m_volumeSlider, SIGNAL(volumeChanged(float)), player, SLOT(setVolume(float)) ); QToolBar *muteBar = new QToolBar( QString(), mainBox ); muteBar->setContentsMargins( 0, 0, 0, 0 ); muteBar->setIconSize( QSize( 16, 16 ) ); // our popup's mute-toggle button m_muteAction = new QAction( KIcon( "audio-volume-muted" ), QString(), muteBar ); m_muteAction->setToolTip( i18n( "Mute/Unmute" ) ); connect( m_muteAction, SIGNAL(triggered(bool)), this, SLOT(slotToggleMute(bool)) ); connect( player, SIGNAL(mutedChanged(bool)), this, SLOT(slotMuteStateChanged(bool)) ); m_volumeMenu->addAction( sliderActionWidget ); muteBar->addAction( m_muteAction ); /* set icon and label to match create state of AudioOutput, as the * desired volume value is not available yet (because the player * object is not set up yet.) Someone must call PlayerManager::setVolume() * later. */ slotVolumeChanged( 1.0 ); // let player notify us when volume changes connect( player, SIGNAL(volumeChanged(float)), this, SLOT(slotVolumeChanged(float)) ); }
void MenuItemMgr::insertMenu( Qtitan::RibbonPage* rPage , QWidgetAction* item ) { QObjectList::iterator git ; QObjectList groups = item->children() ; for( git = groups.begin() ; git != groups.end() ; git++ ) { QWidgetAction *wa = (QWidgetAction*)*git ; Qtitan::RibbonGroup* group = rPage->addGroup( wa->text() ) ; insertMenu( group , wa ) ; } }
QAction* Nepomuk::Menu::createBusyAction( QObject* parent ) const { QWidget* w = new QWidget(); w->setMinimumSize( 22, 22 ); w->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum ); KPixmapSequenceOverlayPainter* busyPainter = new KPixmapSequenceOverlayPainter( w ); busyPainter->setWidget( w ); busyPainter->start(); QWidgetAction* busyAction = new QWidgetAction( parent ); busyAction->setDefaultWidget( w ); return busyAction; }
void XYFitCurveDock::showFunctions() { QMenu menu; FunctionsWidget functions(&menu); connect(&functions, SIGNAL(functionSelected(QString)), this, SLOT(insertFunction(QString))); connect(&functions, SIGNAL(functionSelected(QString)), &menu, SLOT(close())); QWidgetAction* widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(&functions); menu.addAction(widgetAction); QPoint pos(-menu.sizeHint().width()+uiGeneralTab.tbFunctions->width(),-menu.sizeHint().height()); menu.exec(uiGeneralTab.tbFunctions->mapToGlobal(pos)); }
void XYFitCurveDock::showOptions() { QMenu menu; FitOptionsWidget w(&menu, &m_fitData); connect(&w, SIGNAL(finished()), &menu, SLOT(close())); connect(&w, SIGNAL(optionsChanged()), this, SLOT(enableRecalculate())); QWidgetAction* widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(&w); menu.addAction(widgetAction); QPoint pos(-menu.sizeHint().width()+uiGeneralTab.pbParameters->width(),-menu.sizeHint().height()); menu.exec(uiGeneralTab.pbOptions->mapToGlobal(pos)); }
KoResourcePopupAction::KoResourcePopupAction(QSharedPointer<KoAbstractResourceServerAdapter>resourceAdapter, QObject *parent) : KAction(parent) , d(new Private()) { Q_ASSERT(resourceAdapter); d->menu = new QMenu(); QWidget *widget = new QWidget(d->menu); QWidgetAction *wdgAction = new QWidgetAction(widget); d->resourceList = new KoResourceItemView(widget); d->resourceList->setModel(new KoResourceModel(resourceAdapter, widget)); d->resourceList->setItemDelegate(new KoResourceItemDelegate(widget)); KoResourceModel * resourceModel = qobject_cast<KoResourceModel*>(d->resourceList->model()); if (resourceModel) { resourceModel->setColumnCount(1); } KoResource *resource = 0; if (resourceAdapter->resources().count() > 0) { resource = resourceAdapter->resources().at(0); } KoAbstractGradient *gradient = dynamic_cast<KoAbstractGradient*>(resource); KoPattern *pattern = dynamic_cast<KoPattern*>(resource); if (gradient) { QGradient *qg = gradient->toQGradient(); qg->setCoordinateMode(QGradient::ObjectBoundingMode); d->background = QSharedPointer<KoShapeBackground>(new KoGradientBackground(qg)); } else if (pattern) { KoImageCollection *collection = new KoImageCollection(); d->background = QSharedPointer<KoShapeBackground>(new KoPatternBackground(collection)); static_cast<KoPatternBackground*>(d->background.data())->setPattern(pattern->pattern()); } QHBoxLayout *layout = new QHBoxLayout(widget); layout->addWidget(d->resourceList); widget->setLayout(layout); wdgAction->setDefaultWidget(widget); d->menu->addAction(wdgAction); setMenu(d->menu); new QHBoxLayout(d->menu); d->menu->layout()->addWidget(widget); d->menu->layout()->setMargin(0); connect(d->resourceList, SIGNAL(clicked(QModelIndex)), this, SLOT(indexChanged(QModelIndex))); updateIcon(); }
void MatrixFunctionDialog::showConstants() { QMenu menu; ConstantsWidget constants(&menu); connect(&constants, SIGNAL(constantSelected(QString)), this, SLOT(insertConstant(QString))); connect(&constants, SIGNAL(constantSelected(QString)), &menu, SLOT(close())); connect(&constants, SIGNAL(canceled()), &menu, SLOT(close())); QWidgetAction* widgetAction = new QWidgetAction(this); widgetAction->setDefaultWidget(&constants); menu.addAction(widgetAction); QPoint pos(-menu.sizeHint().width()+ui.tbConstants->width(),-menu.sizeHint().height()); menu.exec(ui.tbConstants->mapToGlobal(pos)); }
RatingMenuAction::RatingMenuAction(QMenu* parent) : KActionMenu(parent) { setText(i18n("Rating")); QWidgetAction* wa = new QWidgetAction(this); RatingBox* rb = new RatingBox(parent); wa->setDefaultWidget(rb); addAction(wa); connect(rb, SIGNAL(signalRatingChanged(int)), this, SIGNAL(signalRatingChanged(int))); connect(rb, SIGNAL(signalRatingChanged(int)), parent, SLOT(close())); }
void TextLayer::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { bool canedit = mount->txtControl()->editable(); if (!IsSelectActive) { return; } Rotater *slider; QWidgetAction *widgetslider; /////GraphicsScene *sc = qobject_cast<GraphicsScene *>(scene()); /* zvalue up and down zmax() zmin() */ bool activeedit = canedit ? true : false; QAction *a; RootMenu = mount->txtControl()->StandardMenu(event->widget()); if (format == DIV_ABSOLUTE && modus != Lock) { a = RootMenu->addAction(tr("Send Front"), this, SLOT(seTFront())); a->setIcon(QIcon(":/img/sendtoback.png")); a = RootMenu->addAction(tr("Send Back"), this, SLOT(seTBack())); a->setIcon(QIcon(":/img/bringtofront.png")); } actionSwapEdit = new QAction(tr("Edit modus"),this); actionSwapEdit->setIcon(QIcon(":/img/icon.png")); actionSwapEdit->setCheckable(true); actionSwapEdit->setChecked(canedit); connect(actionSwapEdit, SIGNAL(triggered()),this,SLOT(SwapEdit())); RootMenu->addAction(actionSwapEdit); bool locked = false; if (modus == Lock && !canedit) { locked = true; } if (canedit && format == DIV_ABSOLUTE ) { slider = new Rotater(Rotate,event->widget()); widgetslider = new QWidgetAction(event->widget()); widgetslider->setDefaultWidget(slider); RootMenu->addAction(widgetslider); connect(slider, SIGNAL(rotater(int)),this, SLOT(RotateLayer(int))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { QString strNumber = "k"; int nNumber = strNumber.toInt( ); strNumber = ""; nNumber = strNumber.toInt( ); QString strDateTime = "2011-01-06 01:02:03"; QString strFormat = "yyyy-M-d H:m:s"; QDateTime dt = QDateTime::fromString( strDateTime, strFormat ); strDateTime = ""; strDateTime = dt.toString( "yyyy-MM-dd HH:mm:ss" ); ui->setupUi(this); //QPalette pal; //QPixmap map( "D:/WinParkUI/debug/Image/NewIcon/CommonBG-normal.jpg"); //QBrush br( map ); //pal.setBrush( backgroundRole( ), br ); //setPalette( pal ); //setAutoFillBackground( true ); //mysql.DbConnect( "192.168.1.51", "test", "test", "parkadmin", 3306 ); //QSplitter *splitter = new QSplitter(this); //splitter->setGeometry( this->geometry( ) ); //splitter->addWidget( ui->pushButton ); //splitter->addWidget( ui->tableWidget ); //splitter->addWidget( ui->pushButton_3 ); QWidgetAction* act = new QWidgetAction( ui->menuTest ); QComboBox* cbx = new QComboBox( ui->menuTest ); QStringList lst; lst << "1" << "2" << "3"; cbx->addItems( lst ); act->setDefaultWidget( cbx ); //ui->toolBar->addAction( act ); act->setText( "Hello" ); ui->menuTest->addAction( act ); act = new QWidgetAction( ui->menuTest ); QDateTimeEdit* edit = new QDateTimeEdit( ui->menuTest ); edit->setCalendarPopup( true ); act->setDefaultWidget( edit ); ui->menuTest->addAction( act ); }