Scalable buttons



  • hi...please some one help me i have 10 buttons in a column Is there any way to boom up when the button pressed..i.e increase the size or changing colour property like any thing it may be that button should have to be different from other buttons....



  • Hello.
    Consider using checkable buttons (void QAbstractButton::setCheckable(bool)).
    Or you can connect every button to a slot similar to this:
    @void MyClass::onButtonPressed()
    {
    QPushButton* button = qobject_cast< QPushButton* >( sender() );
    if( !button )
    return;
    button->setStyleSheet( "background-color: red;" );
    }@



  • Just setting it checkable should already give a different look, in a standard way.



  • it's very nice thank u so much...but small problem happened i have 10 buttons when i clicked on this button it shows red colur ... if i click on the other button the previous button should have to show the normal colour...



  • Make the buttons exclusive by putting them in a QButtonGroup.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.