void ToolBarButton::someButtonPressed(ToolBarButton::ButtonType btnType)
{
    // Check togglebuttons
    if (isToggleButton(btnType)) {
        if (isToggleButton()) {
            if (btnType != type && pressed) {
                pressed = false;
                update();
            }
        }
    }
}
void ToolBarButton::mouseReleaseEvent(QMouseEvent *event)
{
    event->ignore(); // Move event goes to ToolBarWidget

    if (isToggleButton()) {
        // Leave tool buttons pressed
    }
    else {
        // Lift other buttons back to up
        pressed = false;
        repaint();

        if (toolbarwidget->dockingDone) {
            // User was only moving toolbar, do not open dialogs
        }
        else {
            // Open dialogs
            // Send button pressed signal for dialog and undo/new buttons
            if (isDialogButton() || type == ToolBarButton::ENew || type != ToolBarButton::EMMS) {
                emit buttonPressed(type);
            }
        }
    }

    QWidget::mouseReleaseEvent(event);
}
Exemple #3
0
	void Button::modifyButtonState()
	{
		if(isDoingKeyAction)
		{
			return;
		}
		if(isToggleButton() && toggled)
		{
			
			if(getButtonState() != CLICKED)
			{
				changeButtonState(CLICKED);
			}
			return;
		}
		if(mouseIsDown && mouseIsInside)
		{
			changeButtonState(CLICKED);
		}
		else if(mouseIsDown && !mouseIsInside)
		{
			changeButtonState(getMouseLeaveState());
		}
		else if(!mouseIsDown && mouseIsInside)
		{
			changeButtonState(HOVERED);
		}
		else
		{
			changeButtonState(DEFAULT);
		}
	}
Exemple #4
0
	void Button::setToggleState(bool toggled)
	{
		if(isToggleButton())
		{
			modifyIsToggled(toggled);
			modifyButtonState();
		}
	}
Exemple #5
0
	void Button::mouseClick( MouseEvent &mouseEvent )
	{
		if(isToggleButton() && mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		{
			handleToggleClick();
			mouseEvent.consume();
		}

		if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT)
		dispatchActionEvent(ActionEvent(this));
	}
Exemple #6
0
void QButton::nextState()
{
    bool t = isToggleButton() && !( isOn() && isExclusiveToggle() );
    bool was = stat != Off;
    if ( t ) {
	if ( toggleTyp == Tristate )
	    stat = ( stat + 1 ) % 3;
	else
	    stat = stat ? Off : On;
    }
    if ( autoMask() )
        updateMask();
    repaint( FALSE );
    if ( t ) {
	if ( was != (stat != Off) )
	    emit toggled( stat != Off );
	emit stateChanged( stat );
    }
}
Exemple #7
0
void QButton::toggle()
{
    if ( isToggleButton() )
	 setOn( !isOn() );
}
Exemple #8
0
	bool Button::isToggled() const
	{
		return isToggleButton() && toggled; 
	}