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
@ -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…
x
Reference in New Issue
Block a user