Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Save in QSettings the current checked button of a groubbox..

Save in QSettings the current checked button of a groubbox..

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    How is it possible?

        @settings.setValue("current_page" , ui->buttonGroup->checkedButton());
    
        ui->buttonGroup->button(settings.value("current_page",true).toInt())->setChecked();@
    

    won't work cause ui->buttonGroup->checkedButton() is a QAbstactButton and not an int.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      Firstly, a QButtonGroup is not a QGroupBox, so your title is misleading.

      QButtonGroup::checkedId() gives you the id number you associated with the button that is currently checked: store this. You can use that to find the button to check, using QButtonGroup::id(), when you retrieve the value from QSettings.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved