Results 1 to 4 of 4

Thread: Checkbox QTableWidgetItem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    65
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Checkbox QTableWidgetItem

    I've been banging my head against a wall of QTableWidget problems, but I'm thankfully very hardheaded and the wall is starting to give. I've figured out most of my issues, but now I have a small issue:

    How can I make a QTableWidgetItem have no text? All I want is a checkbox. The first thing I tried was to not use Items, but a QCheckBox inserted with QTableWidget::setCellWidget(). That worked quite well, but I came upon a few issues with it. The main being that I couldn't find a way of retrieving the box's state through the QTableWidget, since the QTableWidget::cellWidget() function returns a QWidget*and I can't figure out how to get a QCheckBox's state having only access to QWidget functions.

    The other issue was the same as I now have with QTableWidgetItem. I can't make it stay centralized in its parent cell, because it has an obligatory empty text-box next to it (in QTableWidgetItem's case. With QCheckbox, there simply isn't a relevant function to do so). As well, QTableWidgetItem::setTextAlignment() is, as the name implies, only in regards to the text, not the checkbox itself.

    So, is there a way of setting a ItemHasNoText flag or something? And is it possible to centralize the checkbox? This isn't a huge issue, really more aesthetic than anything, but still, a solution would be more than appreciated.
    Last edited by Wasabi; 23rd November 2010 at 14:05.

Similar Threads

  1. integer as a QTableWidgetItem ?
    By tommy in forum Qt Programming
    Replies: 7
    Last Post: 29th May 2009, 17:44
  2. help on QList<QTableWidgetItem*>
    By roncriss in forum Newbie
    Replies: 2
    Last Post: 24th November 2008, 09:19
  3. QTableWidgetItem Text
    By pytro in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2007, 21:44
  4. Im became fool with QTableWidgetItem
    By zorro68 in forum Qt Programming
    Replies: 3
    Last Post: 28th February 2007, 12:17
  5. Reference QTableWidgetItem
    By regenbiegen in forum Qt Programming
    Replies: 2
    Last Post: 1st February 2007, 11:34

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.