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. checkbox indicator size not change
Forum Updated to NodeBB v4.3 + New Features

checkbox indicator size not change

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.1k 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.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1

    be4ce546-ca74-42a5-b45c-1eb011709204-image.png

    	this->ui.checkBox->setStyleSheet("\
    		QCheckBox::indicator\
    		{\
    			width: 50px;\
    			height: 50px;\
    		}");
    

    Why doesn't the size change?

    Pl45m4P 1 Reply Last reply
    0
    • I IknowQT

      be4ce546-ca74-42a5-b45c-1eb011709204-image.png

      	this->ui.checkBox->setStyleSheet("\
      		QCheckBox::indicator\
      		{\
      			width: 50px;\
      			height: 50px;\
      		}");
      

      Why doesn't the size change?

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @IknowQT

      Have you tried other values? The indicator cant be wider or higher than the widget itself. Does a w/h of 15px work?

      Edit:

      There are also some reports, that the indicator size resets when setting custom colors. Does the indicator size work, if you remove the custom colors or set the color again in your local style?

      https://stackoverflow.com/questions/46134100/how-to-set-the-size-of-a-qcheckboxs-indicator/46163040


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      I 1 Reply Last reply
      0
      • Pl45m4P Pl45m4

        @IknowQT

        Have you tried other values? The indicator cant be wider or higher than the widget itself. Does a w/h of 15px work?

        Edit:

        There are also some reports, that the indicator size resets when setting custom colors. Does the indicator size work, if you remove the custom colors or set the color again in your local style?

        https://stackoverflow.com/questions/46134100/how-to-set-the-size-of-a-qcheckboxs-indicator/46163040

        I Offline
        I Offline
        IknowQT
        wrote on last edited by IknowQT
        #3

        @Pl45m4
        The same is true of removing the color-applied value.

        void WToggleMenu::InitListitem()
        {
        	for (int n = 0; n < 20; n++)
        	{
        		usrCntrListItem* pListItem		= new usrCntrListItem(QString("%1").arg(n));
        
        		QListWidgetItem* pWidgetItem	= new QListWidgetItem(this->ui.listWidget);
        		pWidgetItem->setSizeHint(pListItem->sizeHint());
        
        		this->ui.listWidget->addItem(pWidgetItem);
        		this->ui.listWidget->setItemWidget(pWidgetItem, pListItem);
        	}
        }
        
        usrCntrListItem::usrCntrListItem(QString strTitle)
        {
        	ui.setupUi(this);
        	this->ui.label->setText(strTitle);
        	this->ui.label->setFixedHeight(60);
        	//this->ui.checkBox->setStyleSheet("margin-left:1%; margin-right:1%;");	
        
        	this->ui.checkBox->setStyleSheet("\
        		QCheckBox::indicator\
        		{\
        			width: 50px;\
        			height: 50px;\
        		}");
        }
        

        1.gif

        The indicator area does not look large on the screen, but the area is large when clicked.
        It's also checked when you click outside the check box.
        Is it a bug?

        I think it's a problem with the set sizehint.
        Can you check the entire code?

        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