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); }
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); } }
void Button::setToggleState(bool toggled) { if(isToggleButton()) { modifyIsToggled(toggled); modifyButtonState(); } }
void Button::mouseClick( MouseEvent &mouseEvent ) { if(isToggleButton() && mouseEvent.getButton() == MOUSE_BUTTON_LEFT) { handleToggleClick(); mouseEvent.consume(); } if(mouseEvent.getButton() == MOUSE_BUTTON_LEFT) dispatchActionEvent(ActionEvent(this)); }
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 ); } }
void QButton::toggle() { if ( isToggleButton() ) setOn( !isOn() ); }
bool Button::isToggled() const { return isToggleButton() && toggled; }