History

fix table size calculations

Stephen Birarda committed 11 years ago

Commit 08affbf1 parent 5b551801 file · +8 −13Browse files

Showing the changes to interface/src/ui/DomainConnectionDialog.cpp (1 of 1 file). Show all

Unified · Split

interface/src/ui/DomainConnectionDialog.cpp+8−13
@@ -69,30 +69,25 @@ DomainConnectionDialog::DomainConnectionDialog(QWidget* parent) : · 68 unmodified lines
69 }69 }
70 }70 }
71 71
72 timeTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);72 QHBoxLayout* hBoxLayout = new QHBoxLayout;
73 timeTable->resizeColumnsToContents();73 hBoxLayout->addWidget(timeTable);
74 hBoxLayout->setSizeConstraint(QLayout::SetMinimumSize);
74 75
75 const int TABLE_HEADER_GAP = 4;76 timeTable->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
77 timeTable->resizeColumnsToContents();
76 78
77 // figure out the size of the table so we can size the dialog79 // figure out the size of the table so we can size the dialog
78 int tableWidth = timeTable->verticalHeader()->width() + TABLE_HEADER_GAP;80 int tableWidth = timeTable->verticalHeader()->sizeHint().width();
79 for (int i = 0; i < timeTable->columnCount(); i++) {81 for (int i = 0; i < timeTable->columnCount(); i++) {
80 tableWidth += timeTable->columnWidth(i);82 tableWidth += timeTable->columnWidth(i);
81 }83 }
82 84
83 int tableHeight = timeTable->horizontalHeader()->height() + TABLE_HEADER_GAP;85 int tableHeight = timeTable->horizontalHeader()->sizeHint().height();
84 for (int i = 0; i < timeTable->rowCount(); i++) {86 for (int i = 0; i < timeTable->rowCount(); i++) {
85 tableHeight += timeTable->rowHeight(i);87 tableHeight += timeTable->rowHeight(i);
86 }88 }
87 89
88 timeTable->setMaximumSize(QSize(tableWidth, tableHeight));90 timeTable->setMinimumSize(tableWidth, tableHeight);
89 timeTable->setMinimumSize(timeTable->maximumSize());
90
91 QHBoxLayout* hBoxLayout = new QHBoxLayout;
92 hBoxLayout->addWidget(timeTable);
93 hBoxLayout->setSizeConstraint(QLayout::SetMinimumSize);
94
95 setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
96 91
97 setLayout(hBoxLayout);92 setLayout(hBoxLayout);
98 adjustSize();93 adjustSize();