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() ) ); }
/*! Sends the relevant signals for ActionEvent \a event. Action based widgets use this API to cause the QAction to emit signals as well as emitting their own. */ void QAction::activate(ActionEvent event) { Q_D(QAction); if(event == Trigger) { QObject *guard = this; QMetaObject::addGuard(&guard); if(d->checkable) { // the checked action of an exclusive group cannot be unchecked if (d->checked && (d->group && d->group->isExclusive() && d->group->checkedAction() == this)) { if (guard) emit triggered(true); QMetaObject::removeGuard(&guard); return; } setChecked(!d->checked); } if (guard) emit triggered(d->checked); #ifdef QT3_SUPPORT if (guard) emit activated(d->param); #endif QMetaObject::removeGuard(&guard); } else if(event == Hover) { emit hovered(); } }
void AimHelperHudget::update(float deltaSec) { Ship* ship = m_hud->player()->ship(); if (!ship) { setVisible(false); return; } WorldObject* targetObject = ship->targetObject(); if(!targetObject) { setVisible(false); return; } calculateTargetPoint(targetObject); if (m_lastTargetWorldObject == targetObject && m_lastVisible) { m_smoothTargetPoint = glm::mix(m_smoothTargetPoint, m_targetPoint, 5.0f * deltaSec); } else { m_smoothTargetPoint = m_targetPoint; } pointToWorldPoint(m_smoothTargetPoint); setRelativeDistance(1.0f); if (hovered()) { setDirectionAngle(directionAngle() + 12.0f * deltaSec); } else { setDirectionAngle(0.0f); } m_lastTargetWorldObject = targetObject; m_lastVisible = visible(); }
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 ); }
void SearchFieldCancelButtonElement::defaultEventHandler(Event* evt) { // If the element is visible, on mouseup, clear the value, and set selection HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); if (evt->type() == eventNames().mousedownEvent && evt->isMouseEvent() && static_cast<MouseEvent*>(evt)->button() == LeftButton) { input->focus(); input->select(); evt->setDefaultHandled(); if (renderer() && renderer()->visibleToHitTesting()) if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(this); m_capturing = true; } } else if (evt->type() == eventNames().mouseupEvent && evt->isMouseEvent() && static_cast<MouseEvent*>(evt)->button() == LeftButton) { if (m_capturing && renderer() && renderer()->visibleToHitTesting()) { if (hovered()) { input->setValue(""); input->onSearch(); evt->setDefaultHandled(); } if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(0); m_capturing = false; } } } if (!evt->defaultHandled()) HTMLDivElement::defaultEventHandler(evt); }
void ButtonWidget::leaveEvent(QEvent *e) { if (isEnabled()) { emit hovered(false); setState(ButtonState::Over); } QAbstractButton::leaveEvent(e); }
void Chip::update(double t){ chargeCount += t*generateRate; if (Control::getInstance().getPointer(0)->active && hovered(vec2(Control::getInstance().getPointer(0)->x, Control::getInstance().getPointer(0)->y))){ dt+= t; Chip* c = game->getSelectedChip(); if (c) { if (c->wires.find(this)!=c->wires.end()) { c->wires[this]->dt += t*50; highlighted = c->wires[this]; }; } } else{ dt = 0; if (highlighted) { highlighted->dt = 0; highlighted = 0; } } if (currentUpgrade) { pg->setProgress(currentUpgrade->getProgress()); if(currentUpgrade->update(t)){ currentUpgrade->applyUpgrade(currentUpgrade->getLevel()+1); currentUpgrade = 0; } } else{ pg->setProgress(0); } }
void HoverButton::enterEvent( QEvent* e ) { Q_EMIT hovered(); // don't forget to forward the event QWidget::enterEvent( e ); }
void HoverListView::setHoverIndex(const QModelIndex& index) { if (m_hoverIndex != index) { m_hoverIndex = index; emit hovered(m_hoverIndex); } }
void ButtonWidget::enterEvent(QEvent *e) { if (isEnabled()) { emit hovered(true); setState(ButtonState::Hover); setCursor(Qt::PointingHandCursor); } QAbstractButton::enterEvent(e); }
bool Clickable::updateAndGetClicked(sf::Vector2f mousePosition, bool isLeftDown) { if(rect.contains(mousePosition.x, mousePosition.y)) // Mouse is over the clicking area { if(wasClicked) { if(!isLeftDown) // Clicked and released inside the clicking area { wasHovered = true; wasClicked = false; hovered(); return true; } } else { if(isLeftDown) // Clicked in the clicking area { wasClicked = true; clicked(); } else if(!wasHovered) { wasHovered = true; hovered(); } } } else // Mouse is not over the clicking area { if(wasHovered || wasClicked) { wasClicked = false; wasHovered = false; unhovered(); } if(isLeftDown) { clickedOutside(); } } return false; }
int ModelMenu::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMenu::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: activated((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; case 1: hovered((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 2: aboutToShow(); break; case 3: triggered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 4: hovered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; default: ; } _id -= 5; } return _id; }
camera_viewer::camera_viewer(QWidget *parent) : QMainWindow(parent) { setupUi(this); cap_ = new cv::VideoCapture(0); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(image_update())); timer->start(33); connect(action_Load, SIGNAL(hovered()), this, SLOT(image_update())); }
void ModelMenu::hovered(QAction *action) { QVariant v = action->data(); if (v.canConvert<QModelIndex>()) { QModelIndex idx = qvariant_cast<QModelIndex>(v); QString hoveredString = idx.data(m_hoverRole).toString(); if (!hoveredString.isEmpty()) emit hovered(hoveredString); } }
Action::Action(ActionDescription *description, ActionContext *context, QObject *parent) : QAction(parent), Description(description), Context(context) { setText(Description->Text); setCheckable(Description->Checkable); connect(this, SIGNAL(changed()), this, SLOT(changedSlot())); connect(this, SIGNAL(hovered()), this, SLOT(hoveredSlot())); connect(this, SIGNAL(triggered(bool)), this, SLOT(triggeredSlot(bool))); connect(context, SIGNAL(changed()), this, SLOT(checkState())); }
//________________________________________________________________________________ void ComboBoxData::setHovered( GtkWidget* widget, bool value ) { bool oldHover( hovered() ); HoverDataMap::iterator iter( _hoverData.find( widget ) ); if( iter != _hoverData.end() ) iter->second._hovered = value; else return; // need to schedule repaint of the whole widget if( oldHover != hovered() && _target ) gtk_widget_queue_draw( _target ); }
void HTMLLabelElement::setHovered(bool over) { if (over == hovered()) return; // Update our status first. HTMLElement::setHovered(over); // Also update our corresponding control. if (HTMLElement* element = control()) element->setHovered(over); }
bool CustomActionWidget::eventFilter(QObject* obj, QEvent* ev) { if (buttonOne == obj || buttonTwo == obj) { if (ev->type() == QEvent::Enter) { emit hovered(); } } return QWidget::eventFilter(obj, ev); }
void ColorMenu::populateList() { QStringList list = QColor::colorNames(); for (int i=0; i<list.size(); i++) { QPixmap pix(QSize(22,22)); pix.fill(QColor(list[i])); QAction *newAction = new QAction(QIcon(pix), "", parent); newAction->setToolTip(list[i]); newAction->setText(list[i]); menu.addAction(newAction); connect(newAction, SIGNAL(hovered()), this, SLOT(itemHovered())); } }
void LiveWidget::setupMenus() { this->contextMenuLiveDropdown = new QMenu(this); this->contextMenuLiveDropdown->setTitle("Dropdown"); this->audioTrackMenu = new QMenu(this); this->audioTrackMenu->setTitle("Audio Track"); this->audioMenu = new QMenu(this); this->audioMenu->setTitle("Audio"); this->audioTrackMenuAction = this->audioMenu->addMenu(this->audioTrackMenu); this->audioMenu->addSeparator(); this->muteAction = this->audioMenu->addAction(/*QIcon(":/Graphics/Images/MuteSound.png"),*/ "Mute"); this->muteAction->setCheckable(true); this->streamMenu = new QMenu(this); this->streamMenu->setTitle("Connect to"); this->streamMenuAction = this->contextMenuLiveDropdown->addMenu(this->streamMenu); this->contextMenuLiveDropdown->addSeparator(); this->contextMenuLiveDropdown->addMenu(this->audioMenu); this->contextMenuLiveDropdown->addSeparator(); this->windowModeAction = this->contextMenuLiveDropdown->addAction(/*QIcon(":/Graphics/Images/WindowMode.png"),*/ "Window Mode", this, SLOT(toggleWindowMode())); this->windowModeAction->setCheckable(true); this->contextMenuLiveDropdown->addSeparator(); this->expandCollapseAction = this->contextMenuLiveDropdown->addAction(/*QIcon(":/Graphics/Images/Collapse.png"),*/ "Collapse", this, SLOT(toggleExpandCollapse())); QObject::connect(this->streamMenuAction, SIGNAL(hovered()), this, SLOT(streamMenuHovered())); QObject::connect(this->audioTrackMenuAction, SIGNAL(hovered()), this, SLOT(audioTrackMenuHovered())); QObject::connect(this->streamMenu, SIGNAL(triggered(QAction*)), this, SLOT(streamMenuActionTriggered(QAction*))); QObject::connect(this->audioTrackMenu, SIGNAL(triggered(QAction*)), this, SLOT(audioMenuActionTriggered(QAction*))); QObject::connect(this->muteAction, SIGNAL(toggled(bool)), this, SLOT(muteAudio(bool))); QToolButton* toolButtonLiveDropdown = new QToolButton(this); toolButtonLiveDropdown->setObjectName("toolButtonLiveDropdown"); toolButtonLiveDropdown->setMenu(this->contextMenuLiveDropdown); toolButtonLiveDropdown->setPopupMode(QToolButton::InstantPopup); this->tabWidgetLive->setCornerWidget(toolButtonLiveDropdown); //this->tabWidgetPreview->setTabIcon(0, QIcon(":/Graphics/Images/TabSplitter.png")); }
void AMWorkflowManagerView::onAddActionButtonClicked(){ if(addActionMenu_) delete addActionMenu_; addActionMenu_ = new QMenu(this); samplePlateAddActionMenu_ = new QMenu(); samplePlateAddActionMenu_->setTitle("Sample Plate"); QAction *tmpAction; if(samplePlateModel_ && samplePlateModel_->rowCount(QModelIndex()) == 0) samplePlateAddActionMenu_->addAction("<No Samples On Plate>"); else if(samplePlateModel_){ for(int x = 0; x < samplePlateModel_->rowCount(QModelIndex()); x++){ tmpAction = samplePlateAddActionMenu_->addAction(samplePlateModel_->data(samplePlateModel_->index(x), Qt::EditRole).toString()); tmpAction->setData(x); connect(tmpAction, SIGNAL(hovered()), this, SLOT(setSampleHoverIndex())); connect(tmpAction, SIGNAL(triggered()), this, SLOT(onSamplePlateAddActionClicked())); } } else samplePlateAddActionMenu_->addAction("<No Sample Plate Selected>"); addActionMenu_->addMenu(samplePlateAddActionMenu_); QList<AMControlInfoList> fiducializations; if(AMBeamline::bl()) fiducializations = AMBeamline::bl()->currentFiducializations(); if(fiducializations.count() > 0){ fiducializationMarkAddActionMenu_ = new QMenu(); fiducializationMarkAddActionMenu_->setTitle("Fiducialization Marks"); for(int x = 0; x < fiducializations.count(); x++){ tmpAction = fiducializationMarkAddActionMenu_->addAction(QString("Location %1").arg(x+1)); tmpAction->setData(x); connect(tmpAction, SIGNAL(hovered()), this, SLOT(setFiducializationHoverIndex())); connect(tmpAction, SIGNAL(triggered()), this, SLOT(onFiducializationMarkAddActionClicked())); } addActionMenu_->addMenu(fiducializationMarkAddActionMenu_); } addActionMenu_->popup(QCursor::pos()); addActionMenu_->show(); }
QAction * BookmarkMenu::actionForBookmark(const KBookmark &bookmark) { if (bookmark.isGroup()) { KBookmarkActionMenu *actionMenu = new KBookmarkActionMenu(bookmark, this); BookmarkMenu *menu = new BookmarkMenu(manager(), owner(), actionMenu->menu(), bookmark.address()); // An hack to get rid of bug 219274 connect(actionMenu, SIGNAL(hovered()), menu, SLOT(slotAboutToShow())); return actionMenu; } else if (bookmark.isSeparator()) { return KBookmarkMenu::actionForBookmark(bookmark); } else { KBookmarkAction *action = new KBookmarkAction(bookmark, owner(), this); action->setIcon(rApp->iconManager()->iconForUrl(KUrl(bookmark.url()))); connect(action, SIGNAL(hovered()), this, SLOT(actionHovered())); return action; } }
int QDeclarativeMouseArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDeclarativeItem::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 16) qt_static_metacall(this, _c, _id, _a); _id -= 16; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< qreal*>(_v) = mouseX(); break; case 1: *reinterpret_cast< qreal*>(_v) = mouseY(); break; case 2: *reinterpret_cast< bool*>(_v) = hovered(); break; case 3: *reinterpret_cast< bool*>(_v) = pressed(); break; case 4: *reinterpret_cast< bool*>(_v) = isEnabled(); break; case 5: *reinterpret_cast< Qt::MouseButtons*>(_v) = pressedButtons(); break; case 6: *reinterpret_cast< Qt::MouseButtons*>(_v) = acceptedButtons(); break; case 7: *reinterpret_cast< bool*>(_v) = hoverEnabled(); break; case 8: *reinterpret_cast< QDeclarativeDrag**>(_v) = drag(); break; case 9: *reinterpret_cast< bool*>(_v) = preventStealing(); break; } _id -= 10; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 4: setEnabled(*reinterpret_cast< bool*>(_v)); break; case 6: setAcceptedButtons(*reinterpret_cast< Qt::MouseButtons*>(_v)); break; case 7: setHoverEnabled(*reinterpret_cast< bool*>(_v)); break; case 9: setPreventStealing(*reinterpret_cast< bool*>(_v)); break; } _id -= 10; } else if (_c == QMetaObject::ResetProperty) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 10; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 10; } #endif // QT_NO_PROPERTIES return _id; }
int QMenuBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: triggered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 1: hovered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; case 2: setVisible((*reinterpret_cast< bool(*)>(_a[1]))); break; case 3: d_func()->_q_actionTriggered(); break; case 4: d_func()->_q_actionHovered(); break; case 5: d_func()->_q_internalShortcutActivated((*reinterpret_cast< int(*)>(_a[1]))); break; case 6: d_func()->_q_updateLayout(); break; default: ; } _id -= 7; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isDefaultUp(); break; case 1: *reinterpret_cast< bool*>(_v) = isNativeMenuBar(); break; } _id -= 2; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setDefaultUp(*reinterpret_cast< bool*>(_v)); break; case 1: setNativeMenuBar(*reinterpret_cast< bool*>(_v)); break; } _id -= 2; } else if (_c == QMetaObject::ResetProperty) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }
void ContainerNode::setHovered(bool over) { if (over == hovered()) return; Node::setHovered(over); // note that we need to recalc the style // FIXME: Move to Element if (renderer()) { if (renderStyle()->affectedByHover() || (isElementNode() && toElement(this)->childrenAffectedByHover())) setNeedsStyleRecalc(); if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), HoverState); } }
cmain_menu_styled_btn::cmain_menu_styled_btn(QWidget *parent_, QString text, QString statusstriptext) { this->setParent( parent_ ); this->repaintTicker = new QTimer( this ); this->setClickMode( 0 ); this->setStatusTip( statusstriptext ); this->text = text; this->setStyle( this->BUTTON_AND_TEXT ); this->setSniffMouseMoves( true ); this->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum ); this->setMinimumHeight( 200 ); this->setMouseTracking( true ); QObject::connect( this, SIGNAL(hovered()), this, SLOT(repaint()) ); QObject::connect( this->repaintTicker, SIGNAL(timeout()), this, SLOT(rePaintTick()) ); this->repaintTicker->start( 1000 ); }
void LocalTrackGroupViewStandalone::createSubChannelActions(QMenu &menu) { QAction *addSubchannelAction = menu.addAction(QIcon(":/images/more.png"), "Add subchannel"); QObject::connect(addSubchannelAction, SIGNAL(triggered()), this, SLOT(addSubChannel())); addSubchannelAction->setEnabled(trackViews.size() < MAX_SUB_CHANNELS); if (trackViews.size() > 1) { for (int i = 2; i <= trackViews.size(); ++i) { QIcon icon(":/images/less.png"); QString text = "Remove subchannel " + QString::number(i); QAction *action = menu.addAction(icon, text); action->setData(i-1); // using track view index as user data QObject::connect(action, SIGNAL(triggered(bool)), this, SLOT(removeSubchannel())); QObject::connect(action, SIGNAL(hovered()), this, SLOT(highlightHoveredSubchannel())); } } }
void QgsColorSwatchGrid::mouseMoveEvent( QMouseEvent *event ) { //calculate box mouse cursor is over int newBox = swatchForPosition( event->pos() ); mDrawBoxDepressed = event->buttons() & Qt::LeftButton; if ( newBox != mCurrentHoverBox ) { //only repaint if changes are required mCurrentHoverBox = newBox; repaint(); updateTooltip( newBox ); } emit hovered(); }
//________________________________________________________________________________ bool ComboBoxEntryData::setHovered( GtkWidget* widget, bool value ) { const bool oldHovered( hovered() ); if( widget == _entry._widget ) _entry._hovered = value; else if( widget == _button._widget ) _button._hovered = value; else HoverData::setHovered( widget, value ); if( oldHovered != hovered() ) { // trigger repaint if( _button._widget ) gtk_widget_queue_draw( gtk_widget_get_parent( _button._widget ) ); else if( _entry._widget ) gtk_widget_queue_draw( gtk_widget_get_parent( _entry._widget ) ); return true; } else return false; }
/*! Sends the relevant signals for ActionEvent \a event. Action based widgets use this API to cause the QAction to emit signals as well as emitting their own. */ void QAction::activate(ActionEvent event) { Q_D(QAction); if(event == Trigger) { QPointer<QObject> guard = this; if(d->checkable) { // the checked action of an exclusive group cannot be unchecked if (d->checked && (d->group && d->group->isExclusive() && d->group->checkedAction() == this)) { if (!guard.isNull()) emit triggered(true); return; } setChecked(!d->checked); } if (!guard.isNull()) emit triggered(d->checked); } else if(event == Hover) { emit hovered(); } }