grantbj74
5th August 2009, 06:57
Hi,
I am trying to get a column to expand when the dialog resizes. Currently the table and column resizes. But I was wondering if there is a better way to do it. I don't want to have to use the horizontal scrollbar.
At the moment I don't know a way to collect the scrollbar thickness. I just use 19. I believe I need to use something like: QStyle::PM_ScrollBarExtent
#define PHONEBOOK_DATA_COL 3
#define PHONEBOOK_INDEX_WIDTH 55
#define PHONEBOOK_NORMAL_HOURS_WIDTH 85
#define PHONEBOOK_AFTER_HOURS_WIDTH 85
void PhoneBook::resizeEvent(QResizeEvent *)
{
int colwidth = m_ui->tableWidget->width() - (PHONEBOOK_INDEX_WIDTH
+ PHONEBOOK_NORMAL_HOURS_WIDTH
+ PHONEBOOK_AFTER_HOURS_WIDTH
+ 19);
m_ui->tableWidget->setColumnWidth(PHONEBOOK_DATA_COL, colwidth);
}
Thanks
Brendan
I am trying to get a column to expand when the dialog resizes. Currently the table and column resizes. But I was wondering if there is a better way to do it. I don't want to have to use the horizontal scrollbar.
At the moment I don't know a way to collect the scrollbar thickness. I just use 19. I believe I need to use something like: QStyle::PM_ScrollBarExtent
#define PHONEBOOK_DATA_COL 3
#define PHONEBOOK_INDEX_WIDTH 55
#define PHONEBOOK_NORMAL_HOURS_WIDTH 85
#define PHONEBOOK_AFTER_HOURS_WIDTH 85
void PhoneBook::resizeEvent(QResizeEvent *)
{
int colwidth = m_ui->tableWidget->width() - (PHONEBOOK_INDEX_WIDTH
+ PHONEBOOK_NORMAL_HOURS_WIDTH
+ PHONEBOOK_AFTER_HOURS_WIDTH
+ 19);
m_ui->tableWidget->setColumnWidth(PHONEBOOK_DATA_COL, colwidth);
}
Thanks
Brendan