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. Why does the QCheckBox not show the text
Forum Updated to NodeBB v4.3 + New Features

Why does the QCheckBox not show the text

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 471 Views 2 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.
  • cerrC Offline
    cerrC Offline
    cerr
    wrote on last edited by
    #1

    Hi,

    I'm having a QListWidget to which I'm adding QCheckBoxes`` which works fine but I can't see the text``` which I'm adding with the constructor. I'm wondering what I might be missing, the related code looks like:

    list = new QListWidget(this);
    	item = new QListWidgetItem();
    	item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
    	item->setCheckState(Qt::Unchecked);
    	list->setItemWidget(item,new QCheckBox("checkBox"));
    	list->addItem(item);
    
    Pl45m4P 1 Reply Last reply
    0
    • cerrC cerr

      Hi,

      I'm having a QListWidget to which I'm adding QCheckBoxes`` which works fine but I can't see the text``` which I'm adding with the constructor. I'm wondering what I might be missing, the related code looks like:

      list = new QListWidget(this);
      	item = new QListWidgetItem();
      	item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
      	item->setCheckState(Qt::Unchecked);
      	list->setItemWidget(item,new QCheckBox("checkBox"));
      	list->addItem(item);
      
      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @cerr

      You dont see the text, because what you see is the (checkable) QListItem, not your QCheckBox. If you set Qt::ItemIsUserCheckable the ListItem itself gets a little checkBox. As far as I know, you dont need the additional checkBox at all...


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

      ~E. W. Dijkstra

      1 Reply Last reply
      7

      • Login

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