aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-17 12:13:04 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-07-17 12:13:04 -0300
commit29b92e2fc544e3ebab863e48cd6fc66aa7c09b63 (patch)
tree03cd4eaaec0dc2ee1d98be68abaaa12233357aca
parentbad91ef11c49ad3e92e17e18ad66001bc0037f99 (diff)
downloadsubsurface-29b92e2fc544e3ebab863e48cd6fc66aa7c09b63.tar.gz
Adds Single-Click editions on the TableView
This is a linus request, adds a Single-click edition on the tableview to make it more consistent with the rest of the interface where edition is permitted. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
-rw-r--r--qt-ui/maintab.cpp13
-rw-r--r--qt-ui/maintab.h2
2 files changed, 15 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 82550a3f4..f9d36342f 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -78,7 +78,9 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
addWeight->setEnabled(false);
connect(ui->cylinders, SIGNAL(clicked(QModelIndex)), ui->cylinders->model(), SLOT(remove(QModelIndex)));
+ connect(ui->cylinders, SIGNAL(clicked(QModelIndex)), this, SLOT(editCylinderWidget(QModelIndex)));
connect(ui->weights, SIGNAL(clicked(QModelIndex)), ui->weights->model(), SLOT(remove(QModelIndex)));
+ connect(ui->weights, SIGNAL(clicked(QModelIndex)), this, SLOT(editWeigthWidget(QModelIndex)));
QFontMetrics metrics(defaultModelFont());
QFontMetrics metrics2(font());
@@ -532,5 +534,16 @@ void MainTab::initialUiSetup()
ui->weights->resizeColumnToContents(i);
}
s.endGroup();
+}
+void MainTab::editCylinderWidget(const QModelIndex& index)
+{
+ if (index.column() != CylindersModel::REMOVE)
+ ui->cylinders->edit(index);
+}
+
+void MainTab::editWeigthWidget(const QModelIndex& index)
+{
+ if (index.column() != WeightModel::REMOVE)
+ ui->weights->edit(index);
}
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 764ed2306..af76fbb67 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -60,6 +60,8 @@ public slots:
void on_rating_valueChanged(int value);
void on_visibility_valueChanged(int value);
void tabChanged(int idx);
+ void editCylinderWidget(const QModelIndex& index);
+ void editWeigthWidget(const QModelIndex& index);
private:
Ui::MainTab *ui;