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 not working

Checkbox not working

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 761 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    When the checkbox is only checked, it does not selects the item. If it is checked as well as selected by mouse click, then it is selected. I want to remove the mouse selection. I just want to keep the selection through check box. Kindly help.

    void Dialog::on_pushButton_clicked()
    
    {
         //Send Email
    
        QList<QTreeWidgetItem *> itemList;
    
        itemList = ui->treeWidget->selectedItems();
        QString strTo = "mailto:";
    
        foreach(QTreeWidgetItem *item, itemList)
        {
        // if(item->text(0)=="Organization")
        //     continue;
    
          if(item->checkState(0)== Qt::Checked)
    
            strTo.append(item->text(0)+";");
    
    }
            openUrl->openUrl(QUrl(strTo));
    }
    
    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi! I'm not sure if I understood correctly what you want to do, so here are two suggestions: You can make all the items unselectable by setting the view's selection mode to QAbstractItemView::NoSelection. If you just want to deselect all items you can call QAbstractItemView::clearSelection().

      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