Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, April 2007
Autoresize and stricted size for columns in QTableWidget


Message 1 in thread

I have QTableWidget with 3 columns.
I need the last two columns always be of the exact size and the first one is
to be resizable. So I did something like this:

mainWidget::mainWidget() {
... construct everything
table->resizeColumnToContents(1);
table->resizeColumnToContents(2);
}
void mainWidget::resizeEvent(QResizeEvent * event) {
 table->setColumnWidth(0,
        this->width() - table->columnWidth(1) - table->columnWidth(2));
}

It almost works... With blinking, and widget border is messing up the
calculations. And user can resize two right columns...
Is there a better way to achieve what I am looking for?
With QT 4.2.2?


--
 [ signature omitted ]