Ejemplo n.º 1
0
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() ) );
}
Ejemplo n.º 2
0
/*!
  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();
    }
}
Ejemplo n.º 3
0
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();
}
Ejemplo n.º 4
0
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);
}
Ejemplo n.º 6
0
void ButtonWidget::leaveEvent(QEvent *e) {
	if (isEnabled()) {
		emit hovered(false);
		setState(ButtonState::Over);
	}
	QAbstractButton::leaveEvent(e);
}
Ejemplo n.º 7
0
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);
    }
}
Ejemplo n.º 8
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);
    }
}
Ejemplo n.º 10
0
void ButtonWidget::enterEvent(QEvent *e) {
	if (isEnabled()) {
		emit hovered(true);
		setState(ButtonState::Hover);
		setCursor(Qt::PointingHandCursor);
	}
	QAbstractButton::enterEvent(e);
}
Ejemplo n.º 11
0
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;
}
Ejemplo n.º 12
0
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;
}
Ejemplo n.º 13
0
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);
    }
}
Ejemplo n.º 15
0
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()));
}
Ejemplo n.º 16
0
    //________________________________________________________________________________
    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 );

    }
Ejemplo n.º 17
0
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);
}
Ejemplo n.º 19
0
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()));
    }
}
Ejemplo n.º 20
0
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"));
}
Ejemplo n.º 21
0
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();
}
Ejemplo n.º 22
0
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;
    }
}
Ejemplo n.º 23
0
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;
}
Ejemplo n.º 24
0
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;
}
Ejemplo n.º 25
0
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);
    }
}
Ejemplo n.º 26
0
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()));
        }
    }
}
Ejemplo n.º 28
0
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();
}
Ejemplo n.º 29
0
    //________________________________________________________________________________
    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;

    }
Ejemplo n.º 30
0
/*!
  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();
    }
}