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.
Bookmarks