简体   繁体   中英

How can I check if QPushButton is clicked

I want to use an if-else statement to check if QPushButton is clicked or not.
How can I do this?.

The question does not make sense. Being clicked is not a state that you can check; clicking a button is an event . It is important to distinguish between states and events.

You handle a button click event by connecting a slot to the signal QAbstractButton::clicked() .

Maybe you mean "How do I check if a button is down?". Being down is a state; you check that state using the method QAbstractButton::isDown() .

如果要尝试确定是否在将checkable属性设置为true的情况下按下按钮,则QPushButton的父类QAbstractButton具有检查属性(setChecked / isChecked)。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM