mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fixes the correct sizes of the tables when first open.
This patch fixes the correct sizes of the tables when first opened. It was defaulting to 'resizeToContents', but most of the cases when first opened we got no content, and this was bad. Now I'm defaulting to 30 when on the 'REMOVE' column and 80 on other columns. Fixes #189 Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
891892cde4
commit
0f85243cf3
1 changed files with 4 additions and 6 deletions
|
@ -54,12 +54,10 @@ void TableView::setModel(QAbstractItemModel *model){
|
|||
|
||||
QSettings s;
|
||||
s.beginGroup(objectName());
|
||||
for (int i = 0; i < ui.tableView->model()->columnCount(); i++) {
|
||||
QVariant width = s.value(QString("colwidth%1").arg(i));
|
||||
if (width.isValid())
|
||||
ui.tableView->setColumnWidth(i, width.toInt());
|
||||
else
|
||||
ui.tableView->resizeColumnToContents(i);
|
||||
const int columnCount = ui.tableView->model()->columnCount();
|
||||
for (int i = 0; i < columnCount; i++) {
|
||||
QVariant width = s.value(QString("colwidth%1").arg(i), i == CylindersModel::REMOVE ? 30 : 80 );
|
||||
ui.tableView->setColumnWidth(i, width.toInt());
|
||||
}
|
||||
s.endGroup();
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue