I'm using Qt with C++, and I want to make a button that keeps looking pushed down after it is pushed and released. I'm currently making buttons on a
QToolBar and doing something like
toolBar->addAction (icon, tr("Text"));. This makes buttons on the toolbar that display the
icon and display "Text" on hover-over. They also look pushed down as the user is pushing them, but stop looking pushed down when they are released (as is reasonable for most uses of buttons). I need something different, however: I would simply like the buttons to remain looking pushed down after they are released, perhaps until they are clicked again. It would be best if I could just call some function on a button or on the toolbar that could give me the capacity to control whether a button will look pushed down or not pushed down when it is displayed. That way I could just control this aspect of button appearance programmatically.
What's the easiest way to do this in Qt? I've seen fancy ways of doing it involving borders and very complicated setups, but I was wondering whether there might be an easy way to do it.
Add QPushButton to the toolbar using addWidget and then make the button checkable.