[QT] solve the problem that the trigger of QPushButton cannot trigger setvisible

Finding problems

I want to make a tomato clock software and learn QT by the way. But when I did it, I found that toggled could not trigger setvisible (). After comparing the source code of C + + GUI QT4 programming, I found that it was a detail problem about QPushButton, which was not clear.

The effect you want to complete is as follows:

Solution

QPushButton must be checkable and must be selected when designing with designer.

The specific operation is as follows:

Problem exploration

By default, checkable is not selected, and button is the trigger button by default. When you press it, it will pop up immediately

After checkable is selected, the button becomes a toggle button, which can have two states: Press/pop. This is why the state of the task list button is different in the two images
————————————————

Link to the original text: https://blog.csdn.net/humanking7/article/details/44095283

Read More: