How to disable default qpushbutton
I created qpushbuttons
with qtdesigner
and as a default I want to make them 开发者_StackOverflow社区disabled without clicking them in other words before the dialog screen comes they should already have been disabled.I ask that because I write a cinema seat reservation and when somebody buy the seat I make it disabled and the color red but after closing and re-running the program they disappear and they turn to default. I want to do is; when I re-run the program they should be seen disabled and color red. How can I do that. Thank you.
You can do that from QtDesigner, the advantage being you don't need to code anything.
Select your QPushButton
, and make sure the enabled
property is not checked.
Before you call yourDialog->show()
, execute yourDialog->yourPushButton->setDisabled()
.
精彩评论