summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/divecomputermanagementdialog.cpp12
-rw-r--r--qt-ui/divecomputermanagementdialog.ui8
2 files changed, 13 insertions, 7 deletions
diff --git a/qt-ui/divecomputermanagementdialog.cpp b/qt-ui/divecomputermanagementdialog.cpp
index 7a96b4c63..4d9770a4d 100644
--- a/qt-ui/divecomputermanagementdialog.cpp
+++ b/qt-ui/divecomputermanagementdialog.cpp
@@ -11,7 +11,6 @@ DiveComputerManagementDialog::DiveComputerManagementDialog(QWidget* parent, Qt::
model = new DiveComputerModel();
ui->tableView->setModel(model);
connect(ui->tableView, SIGNAL(clicked(QModelIndex)), this, SLOT(tryRemove(QModelIndex)));
- ui->tableView->setColumnWidth(DiveComputerModel::REMOVE, 22);
}
DiveComputerManagementDialog* DiveComputerManagementDialog::instance()
@@ -23,6 +22,9 @@ DiveComputerManagementDialog* DiveComputerManagementDialog::instance()
void DiveComputerManagementDialog::update()
{
model->update();
+ ui->tableView->resizeColumnsToContents();
+ ui->tableView->setColumnWidth(DiveComputerModel::REMOVE, 22);
+ layout()->activate();
}
void DiveComputerManagementDialog::tryRemove(const QModelIndex& index)
@@ -30,14 +32,14 @@ void DiveComputerManagementDialog::tryRemove(const QModelIndex& index)
if (index.column() != DiveComputerModel::REMOVE){
return;
}
-
+
QMessageBox::StandardButton response = QMessageBox::question(
- this,
- tr("Remove the selected Dive Computer?"),
+ this,
+ tr("Remove the selected Dive Computer?"),
tr("Are you sure that you want to \n remove the selected dive computer?"),
QMessageBox::Ok | QMessageBox::Cancel
);
-
+
if (response == QMessageBox::Ok){
model->remove(index);
}
diff --git a/qt-ui/divecomputermanagementdialog.ui b/qt-ui/divecomputermanagementdialog.ui
index 6685e842e..ae011fc9c 100644
--- a/qt-ui/divecomputermanagementdialog.ui
+++ b/qt-ui/divecomputermanagementdialog.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>400</width>
+ <width>560</width>
<height>300</height>
</rect>
</property>
@@ -15,7 +15,11 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
- <widget class="QTableView" name="tableView"/>
+ <widget class="QTableView" name="tableView">
+ <attribute name="horizontalHeaderStretchLastSection">
+ <bool>true</bool>
+ </attribute>
+ </widget>
</item>
</layout>
</widget>