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. QToolButton that was checked with setChecked( Qt::Checked ) needs two clicks to uncheck
Forum Updated to NodeBB v4.3 + New Features

QToolButton that was checked with setChecked( Qt::Checked ) needs two clicks to uncheck

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.7k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Roest
    wrote on last edited by Roest
    #1
    This post is deleted!
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt ?
      On what OS ?
      Can you show the code you are using ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      R 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        What version of Qt ?
        On what OS ?
        Can you show the code you are using ?

        R Offline
        R Offline
        Roest
        wrote on last edited by Roest
        #3

        @SGaist

        Sorry for the incomplete post. Qt 5.10 x64 VS2017 Win10 64

        Code is pretty standard stuff.

        QToolButton* button = new QToolButton;

        QIcon icon = ...
        button->setIcon( icon );
        button->setIconSize( QSize( 24, 24 ) );
        button->setText( text ) );

        button->setMinimumSize( 60, 50 );
        button->setMaximumSize( 60, 50 );
        button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
        button->setCheckable( true );

        if( check )
        {
        button->setChecked( Qt::Checked );
        }

        m_bg->addButton( button, buttonId++ );
        layout->addWidget( button );

        JonBJ 1 Reply Last reply
        0
        • R Roest

          @SGaist

          Sorry for the incomplete post. Qt 5.10 x64 VS2017 Win10 64

          Code is pretty standard stuff.

          QToolButton* button = new QToolButton;

          QIcon icon = ...
          button->setIcon( icon );
          button->setIconSize( QSize( 24, 24 ) );
          button->setText( text ) );

          button->setMinimumSize( 60, 50 );
          button->setMaximumSize( 60, 50 );
          button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
          button->setCheckable( true );

          if( check )
          {
          button->setChecked( Qt::Checked );
          }

          m_bg->addButton( button, buttonId++ );
          layout->addWidget( button );

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Roest
          OOI does it make any difference to behaviour if you move the setChecked() to after the button widget has been added to the layout?

          R 1 Reply Last reply
          0
          • JonBJ JonB

            @Roest
            OOI does it make any difference to behaviour if you move the setChecked() to after the button widget has been added to the layout?

            R Offline
            R Offline
            Roest
            wrote on last edited by
            #5

            @JonB

            No, I moved it around already, before and after the add to the layout and before and after the add to the button group. No difference.

            1 Reply Last reply
            1

            • Login

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