void OptionsView::initComps() { QWidget *widget = new QWidget; QVBoxLayout *vlayout = new QVBoxLayout; QToolBar *toolbar = new QToolBar; vlayout->setMargin(0); toolbar->setOrientation(Qt::Vertical); toolbar->setIconSize(QSize(24, 24)); _startAction = new QAction(QIcon(":/logIcons/start"), "Lancer la simulation", this); _restartAction = new QAction(QIcon(":/logIcons/restart"), "Réinitialiser", this); _exercicesAction = new QAction(QIcon(":/logIcons/exercices"), "Liste des exercices", this); _astucesAction = new QAction(QIcon(":/logIcons/astuces"), "Astuces", this); _homeAction = new QAction(QIcon(":/logIcons/home"), "Quitter la simulation", this); toolbar->addAction(_startAction); toolbar->addAction(_restartAction); toolbar->addAction(_astucesAction); toolbar->addSeparator(); toolbar->addAction(_exercicesAction); toolbar->addAction(_homeAction); vlayout->addWidget(toolbar); widget->setLayout(vlayout); setDefaultWidget(widget); }
void PageGraphicsItem::contextMenuEvent (QGraphicsSceneContextMenuEvent *event) { QMenu rotateMenu; auto ccwAction = rotateMenu.addAction (tr ("Rotate 90 degrees counter-clockwise"), this, SLOT (rotateCCW ())); ccwAction->setProperty ("ActionIcon", "object-rotate-left"); auto cwAction = rotateMenu.addAction (tr ("Rotate 90 degrees clockwise"), this, SLOT (rotateCW ())); cwAction->setProperty ("ActionIcon", "object-rotate-right"); auto arbAction = rotateMenu.addAction (tr ("Rotate arbitrarily...")); arbAction->setProperty ("ActionIcon", "transform-rotate"); auto arbMenu = new QMenu (); arbAction->setMenu (arbMenu); ArbWidget_ = new ArbitraryRotationWidget; ArbWidget_->setValue (LayoutManager_->GetRotation () + LayoutManager_->GetRotation (PageNum_)); connect (ArbWidget_, SIGNAL (valueChanged (double)), this, SLOT (requestRotation (double))); connect (LayoutManager_, SIGNAL (rotationUpdated (double, int)), this, SLOT (updateRotation (double, int))); auto actionWidget = new QWidgetAction (arbMenu); actionWidget->setDefaultWidget (ArbWidget_); arbMenu->addAction (actionWidget); rotateMenu.exec (event->screenPos ()); }
HelpQuery::HelpQuery(QWidget* parent) : QWidgetAction(parent) { mapper = new QSignalMapper(this); w = new QWidget(parent); QHBoxLayout* layout = new QHBoxLayout; QLabel* label = new QLabel; label->setText(tr("Search for: ")); layout->addWidget(label); entry = new QLineEdit; layout->addWidget(entry); QToolButton* button = new QToolButton; button->setText("x"); layout->addWidget(button); w->setLayout(layout); setDefaultWidget(w); emptyState = true; connect(button, SIGNAL(clicked()), entry, SLOT(clear())); connect(entry, SIGNAL(textChanged(const QString&)), SLOT(textChanged(const QString&))); connect(entry, SIGNAL(returnPressed()), SLOT(returnPressed())); connect(mapper, SIGNAL(mapped(QObject*)), SLOT(actionTriggered(QObject*))); }
void SelectAction::init(const QString &name) { if (!name.isEmpty()) setObjectName(name); m_selectCombo = new QComboBox; setDefaultWidget(m_selectCombo); connect(m_selectCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(selectCurrentItem())); }
QgsColorWidgetAction::QgsColorWidgetAction( QgsColorWidget* colorWidget, QMenu* menu, QWidget* parent ) : QWidgetAction( parent ) , mMenu( menu ) , mColorWidget( colorWidget ) , mSuppressRecurse( false ) , mDismissOnColorSelection( true ) { setDefaultWidget( mColorWidget ); connect( mColorWidget, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) ); connect( this, SIGNAL( hovered() ), this, SLOT( onHover() ) ); connect( mColorWidget, SIGNAL( hovered() ), this, SLOT( onHover() ) ); }
KoLineEditAction::KoLineEditAction(QObject* parent) : QWidgetAction(parent) , m_closeParentOnTrigger(false) { QWidget* pWidget = new QWidget (NULL); QHBoxLayout* pLayout = new QHBoxLayout(); m_label = new QLabel(NULL); m_editBox = new KLineEdit(NULL); pLayout->addWidget(m_label); pLayout->addWidget(m_editBox); pWidget->setLayout(pLayout); setDefaultWidget(pWidget); connect (m_editBox, SIGNAL(returnPressed(QString)), this, SLOT(onTriggered(QString))); }
QgsColorSwatchGridAction::QgsColorSwatchGridAction( QgsColorScheme* scheme, QMenu *menu, const QString& context, QWidget *parent ) : QWidgetAction( parent ) , mMenu( menu ) , mSuppressRecurse( false ) { mColorSwatchGrid = new QgsColorSwatchGrid( scheme, context, parent ); setDefaultWidget( mColorSwatchGrid ); connect( mColorSwatchGrid, SIGNAL( colorChanged( QColor ) ), this, SLOT( setColor( QColor ) ) ); connect( this, SIGNAL( hovered() ), this, SLOT( onHover() ) ); connect( mColorSwatchGrid, SIGNAL( hovered() ), this, SLOT( onHover() ) ); //hide the action if no colors to be shown setVisible( mColorSwatchGrid->colors()->count() > 0 ); }
QgsColorSwatchGridAction::QgsColorSwatchGridAction( QgsColorScheme *scheme, QMenu *menu, const QString &context, QWidget *parent ) : QWidgetAction( parent ) , mMenu( menu ) , mSuppressRecurse( false ) , mDismissOnColorSelection( true ) { mColorSwatchGrid = new QgsColorSwatchGrid( scheme, context, parent ); setDefaultWidget( mColorSwatchGrid ); connect( mColorSwatchGrid, &QgsColorSwatchGrid::colorChanged, this, &QgsColorSwatchGridAction::setColor ); connect( this, &QAction::hovered, this, &QgsColorSwatchGridAction::onHover ); connect( mColorSwatchGrid, &QgsColorSwatchGrid::hovered, this, &QgsColorSwatchGridAction::onHover ); //hide the action if no colors to be shown setVisible( !mColorSwatchGrid->colors()->isEmpty() ); }
GoToPageAction::GoToPageAction(QObject *parent, const QString &name) : QWidgetAction(parent) { if (!name.isEmpty()) setObjectName(name); m_pageSpinBox = new QSpinBox; QLabel *separatorLabel = new QLabel(" / "); m_numPagesLabel = new QLabel; m_mainWidget = new QWidget; QHBoxLayout *mainLayout = new QHBoxLayout(m_mainWidget); mainLayout->addWidget(m_pageSpinBox); mainLayout->addWidget(separatorLabel); mainLayout->addWidget(m_numPagesLabel); setDefaultWidget(m_mainWidget); connect(m_pageSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeValue(int))); }
SizeChooserAction::SizeChooserAction(QuickTableButton *button) : QWidgetAction(0) { m_widget = new SizeChooserGrid(button, this); setDefaultWidget(m_widget); }
QgsMenuHeaderWidgetAction::QgsMenuHeaderWidgetAction( const QString &text, QObject *parent ) : QWidgetAction( parent ) { QgsMenuHeader *w = new QgsMenuHeader( text, nullptr ); setDefaultWidget( w ); //transfers ownership }