Improve the initial size of the device name editing dialog

This is not "automagic" as I had hoped but appears to give a good
starting point.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-06-17 12:42:52 -07:00
parent cb50d6bf6c
commit 9d611ba279
2 changed files with 13 additions and 7 deletions

View file

@ -11,7 +11,6 @@ DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget* parent, Qt::
model = new DiveComputerModel(); model = new DiveComputerModel();
ui->tableView->setModel(model); ui->tableView->setModel(model);
connect(ui->tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex))); connect(ui->tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex)));
ui->tableView->setColumnWidth(DiveComputerModel::REMOVE, 22);
} }
DiveComputerManagementDialog* DiveComputerManagementDialog::instance() DiveComputerManagementDialog* DiveComputerManagementDialog::instance()
@ -23,6 +22,9 @@ DiveComputerManagementDialog* DiveComputerManagementDialog::instance()
void DiveComputerManagementDialog::update() void DiveComputerManagementDialog::update()
{ {
model->update(); model->update();
ui->tableView->resizeColumnsToContents();
ui->tableView->setColumnWidth(DiveComputerModel::REMOVE, 22);
layout()->activate();
} }
void DiveComputerManagementDialog::tryRemove(const QModelIndex& index) void DiveComputerManagementDialog::tryRemove(const QModelIndex& index)

View file

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>560</width>
<height>300</height> <height>300</height>
</rect> </rect>
</property> </property>
@ -15,7 +15,11 @@
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTableView" name="tableView"/> <widget class="QTableView" name="tableView">
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>