mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
fix table size calculations
This commit is contained in:
parent
5b5518077d
commit
08affbfd0d
1 changed files with 15 additions and 20 deletions
|
@ -69,30 +69,25 @@ DomainConnectionDialog::DomainConnectionDialog(QWidget* parent) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
timeTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
|
||||||
timeTable->resizeColumnsToContents();
|
|
||||||
|
|
||||||
const int TABLE_HEADER_GAP = 4;
|
|
||||||
|
|
||||||
// figure out the size of the table so we can size the dialog
|
|
||||||
int tableWidth = timeTable->verticalHeader()->width() + TABLE_HEADER_GAP;
|
|
||||||
for (int i = 0; i < timeTable->columnCount(); i++) {
|
|
||||||
tableWidth += timeTable->columnWidth(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
int tableHeight = timeTable->horizontalHeader()->height() + TABLE_HEADER_GAP;
|
|
||||||
for (int i = 0; i < timeTable->rowCount(); i++) {
|
|
||||||
tableHeight += timeTable->rowHeight(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
timeTable->setMaximumSize(QSize(tableWidth, tableHeight));
|
|
||||||
timeTable->setMinimumSize(timeTable->maximumSize());
|
|
||||||
|
|
||||||
QHBoxLayout* hBoxLayout = new QHBoxLayout;
|
QHBoxLayout* hBoxLayout = new QHBoxLayout;
|
||||||
hBoxLayout->addWidget(timeTable);
|
hBoxLayout->addWidget(timeTable);
|
||||||
hBoxLayout->setSizeConstraint(QLayout::SetMinimumSize);
|
hBoxLayout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||||
|
|
||||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
timeTable->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
|
timeTable->resizeColumnsToContents();
|
||||||
|
|
||||||
|
// figure out the size of the table so we can size the dialog
|
||||||
|
int tableWidth = timeTable->verticalHeader()->sizeHint().width();
|
||||||
|
for (int i = 0; i < timeTable->columnCount(); i++) {
|
||||||
|
tableWidth += timeTable->columnWidth(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
int tableHeight = timeTable->horizontalHeader()->sizeHint().height();
|
||||||
|
for (int i = 0; i < timeTable->rowCount(); i++) {
|
||||||
|
tableHeight += timeTable->rowHeight(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
timeTable->setMinimumSize(tableWidth, tableHeight);
|
||||||
|
|
||||||
setLayout(hBoxLayout);
|
setLayout(hBoxLayout);
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
Loading…
Reference in a new issue