summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-17 12:42:52 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-17 12:42:52 -0700
commit9d611ba279f0d279f5e0818e5043417bfa52c02c (patch)
tree7bcbba0e48af833428633fb6040ddcc1ef29365e /qt-ui
parentcb50d6bf6cc52b9c42af9dd514bbe07fa9eff767 (diff)
downloadsubsurface-9d611ba279f0d279f5e0818e5043417bfa52c02c.tar.gz
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>
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>