That's still one bug that I'm hunging... do not release with that pesky bug
on.
From b33909135032837dcea6155cb9aa58d674306995 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 18:29:35 -0300
Subject: [PATCH 7/7] Better handle of Keyboard on the Inline Edition on
 Equipment

The handling of keyboard is broken on Qt inside QComboBoxes.
I'm trying ( and losing ) to make it less broke. This patch
makes the code works reasonably well if you press Key_down
or Key_up after having displayed the filter popup, wich is
different from the combobox popup for some reason.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/modeldelegates.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp
index 85542f0..7ddfb9a 100644
--- a/qt-ui/modeldelegates.cpp
+++ b/qt-ui/modeldelegates.cpp
@@ -162,7 +162,10 @@ bool ComboBoxDelegate::eventFilter(QObject *object, QEvent *event)
 			QKeyEvent *ev = static_cast<QKeyEvent *>(event);
 			if (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) {
 				currCombo.ignoreSelection = true;
-				currCombo.comboEditor->showPopup();
+				if (!currCombo.comboEditor->completer()->popup()->isVisible()){
+					currCombo.comboEditor->showPopup();
+					return true;
+				}
 			}
 			if (ev->key() == Qt::Key_Tab || ev->key() == Qt::Key_Enter || ev->key() == Qt::Key_Return) {
 				currCombo.activeText = currCombo.comboEditor->currentText();
-- 
1.9.0

From 6e5d867036b7bea384ccdde6e48c617f98774a3f Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 17:06:18 -0300
Subject: [PATCH 6/7] Remove a bit of space from the Axis and its labels.

Removed a bit of space from the axis and it's labels,
making the layout work on smaller screens.

Fixes: 458

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/profile/profilewidget2.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index cfb696d..456f6f6 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -141,10 +141,11 @@ void ProfileWidget2::setupItemOnScene()
 	profileYAxis->setOrientation(DiveCartesianAxis::TopToBottom);
 	profileYAxis->setMinimum(0);
 	profileYAxis->setTickInterval(M_OR_FT(10, 30));
-	profileYAxis->setTickSize(1);
+	profileYAxis->setTickSize(0.5);
 	profileYAxis->setLineSize(96);
 
 	timeAxis->setLineSize(92);
+	timeAxis->setTickSize(-0.5);
 
 	gasYAxis->setOrientation(DiveCartesianAxis::BottomToTop);
 	gasYAxis->setTickInterval(1);
-- 
1.9.0

From 38c748aa0666a380c08cd3d8f14c3a19cc6744f5 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 16:40:30 -0300
Subject: [PATCH 5/7] Try to fix 455, ruler don't respect dive depth.

The only place on the code that the y() position didn't
accompanied the dive-depth was this one, so let's see
if this patch fixes it.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/profile/ruleritem.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp
index 627958e..9f712e6 100644
--- a/qt-ui/profile/ruleritem.cpp
+++ b/qt-ui/profile/ruleritem.cpp
@@ -42,7 +42,7 @@ void RulerNodeItem2::recalculate()
 	if (x() < 0) {
 		setPos(0, y());
 	} else if (x() > timeAxis->posAtValue(data->sec)) {
-		setPos(timeAxis->posAtValue(data->sec), y());
+		setPos(timeAxis->posAtValue(data->sec), depthAxis->posAtValue(data->depth));
 	} else {
 		data = pInfo.entry;
 		count = 0;
-- 
1.9.0

From f4a416f6a96ac8f5e3a8ccdcba90e9c3f51fde28 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 16:30:13 -0300
Subject: [PATCH 4/7] Dont create than set, do both at the same time.

When we create , then set the value of a variable, we
are wasting cycles and making the code more verbose.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/tagwidget.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 821089c..891b664 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -145,8 +145,7 @@ void TagWidget::completionSelected(const QString& completion)
 
 void TagWidget::completionHighlighted(const QString& completion)
 {
-	QPair<int, int> pos;
-	pos = getCursorTagPosition();
+	QPair<int, int> pos = getCursorTagPosition();
 	if (pos.first >= 0 && pos.second > 0) {
 		setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
 		setCursorPosition(pos.first + completion.length());
-- 
1.9.0

From 1e59aef8d041b64a86d51c7ef8b91af2f0513004 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 15:36:09 -0300
Subject: [PATCH 3/7] QString starts empty, do not set "" as empty string.

Let's not be evil by creating "" as empty strings inside
of the code, really.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/tagwidget.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 5364364..821089c 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -120,8 +120,7 @@ void TagWidget::reparse()
 	QString currentText;
 	if (pos.first >= 0 && pos.second > 0)
 		currentText = text().mid(pos.first, pos.second - pos.first).trimmed();
-	else
-		currentText = "";
+
 	if (m_completer) {
 		m_completer->setCompletionPrefix(currentText);
 		if (m_completer->completionCount() == 1) {
-- 
1.9.0

From a6ea1f739b15f098078b494a639a14cece865263 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 15:29:13 -0300
Subject: [PATCH 2/7] Do not copy strings when you don't need it.

This patch removed the use of copy-constructors on the
QString to use the const-references. Even knowing that
the QString is a refcounted class, let's not get that
bad habit.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/tagwidget.cpp | 8 ++++----
 qt-ui/tagwidget.h   | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 4c71c5f..5364364 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -138,13 +138,13 @@ void TagWidget::reparse()
 	}
 }
 
-void TagWidget::completionSelected(QString completion)
+void TagWidget::completionSelected(const QString& completion)
 {
 	completionHighlighted(completion);
 	emit textChanged();
 }
 
-void TagWidget::completionHighlighted(QString completion)
+void TagWidget::completionHighlighted(const QString& completion)
 {
 	QPair<int, int> pos;
 	pos = getCursorTagPosition();
@@ -152,7 +152,7 @@ void TagWidget::completionHighlighted(QString completion)
 		setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
 		setCursorPosition(pos.first + completion.length());
 	} else {
-		setText(completion.append(", "));
+		setText(completion + QString(", "));
 		setCursorPosition(text().length());
 	}
 }
@@ -164,7 +164,7 @@ void TagWidget::setCursorPosition(int position)
 	blockSignals(false);
 }
 
-void TagWidget::setText(QString text)
+void TagWidget::setText(const QString& text)
 {
 	blockSignals(true);
 	GroupedLineEdit::setText(text);
diff --git a/qt-ui/tagwidget.h b/qt-ui/tagwidget.h
index 42c94b4..62fa36f 100644
--- a/qt-ui/tagwidget.h
+++ b/qt-ui/tagwidget.h
@@ -12,15 +12,15 @@ public:
 	void setCompleter(QCompleter *completer);
 	QPair<int, int> getCursorTagPosition();
 	void highlight();
-	void setText(QString text);
+	void setText(const QString& text);
 	void clear();
 	void setCursorPosition(int position);
 	void wheelEvent(QWheelEvent *event);
 public
 slots:
 	void reparse();
-	void completionSelected(QString);
-	void completionHighlighted(QString);
+	void completionSelected(const QString& text);
+	void completionHighlighted(const QString& text);
 
 protected:
 	void keyPressEvent(QKeyEvent *e);
-- 
1.9.0

From b98b4b071debcaee64620cfa67e023d11eb39240 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <tomaz.canabr...@intel.com>
Date: Wed, 19 Mar 2014 15:23:58 -0300
Subject: [PATCH 1/7] Code Cleanup

The offending code is line-by-line equal to the completion
Highlited method, so why make it duplicated? Call that
method instead.

Signed-off-by: Tomaz Canabrava <tomaz.canabr...@intel.com>
---
 qt-ui/tagwidget.cpp | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp
index 2733a14..4c71c5f 100644
--- a/qt-ui/tagwidget.cpp
+++ b/qt-ui/tagwidget.cpp
@@ -140,16 +140,8 @@ void TagWidget::reparse()
 
 void TagWidget::completionSelected(QString completion)
 {
-	QPair<int, int> pos;
-	pos = getCursorTagPosition();
-	if (pos.first >= 0 && pos.second > 0) {
-		setText(text().remove(pos.first, pos.second - pos.first).insert(pos.first, completion));
-		setCursorPosition(pos.first + completion.length());
-	} else {
-		setText(completion.append(", "));
-		setCursorPosition(text().length());
-	}
-	emit(textChanged());
+	completionHighlighted(completion);
+	emit textChanged();
 }
 
 void TagWidget::completionHighlighted(QString completion)
@@ -163,7 +155,6 @@ void TagWidget::completionHighlighted(QString completion)
 		setText(completion.append(", "));
 		setCursorPosition(text().length());
 	}
-
 }
 
 void TagWidget::setCursorPosition(int position)
-- 
1.9.0

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to