Home > Net >  How can I save Checkbox selection in qt c ?
How can I save Checkbox selection in qt c ?

Time:09-06

I am trying to develop an application with QT C . I added a checkBox. How can I make my checkBox be in the last selection when I close my app and open it again. For example, if the checkbox was selected before the application was closed, I want it to be selected when the application runs again. If it wasn't selected before closing, it should come back unselected when it runs again. How can I do that?

CodePudding user response:

Read the value of the checkbox when your app shuts down. Save the value somewhere, like; QSettings, a custom file, windows registry, etc. When your application starts, read the stored value and set the checkbox state to match.

  •  Tags:  
  • c qt
  • Related