From 9d611ba279f0d279f5e0818e5043417bfa52c02c Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 17 Jun 2013 12:42:52 -0700 Subject: [PATCH] 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 --- qt-ui/divecomputermanagementdialog.cpp | 12 +++++++----- qt-ui/divecomputermanagementdialog.ui | 8 ++++++-- 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 @@ 0 0 - 400 + 560 300 @@ -15,7 +15,11 @@ - + + + true + +