From ece1439de790a2bca5ebb3f1180295e00de75ab9 Mon Sep 17 00:00:00 2001 From: SeeLook <945374+SeeLook@users.noreply.github.com> Date: Wed, 9 Dec 2015 10:18:39 +0100 Subject: [PATCH] Mobile tips of Tcanvas are better colored, adjusted to screen size, result text position is better --- TODO | 2 ++ changes | 2 +- src/exam/tcanvas.cpp | 26 +++++++++++++++++++++++--- src/exam/tcanvas.h | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 4281b433c..fe5061fac 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,8 @@ ================ TODO LIST ====================== ============================================================================ Translations: + - All uses of QApplication::translate("QtClass", "text") change int QtClass::tr("text") - + this way no Qt translations go into Nootka ts - remove <br> from some status strings (rangesettings.cpp, accidsettings.cpp) ANDROID: diff --git a/changes b/changes index 0d931557b..248cdf605 100644 --- a/changes +++ b/changes @@ -1,7 +1,7 @@ 1.3.0 alpha - added touch interface, adjusted GUI layout to it ANDROID - - file and color dialogues adjusted for touch screens + - new file and color dialogues adjusted for touch screens - corner menu button and menu similar to Android native - new layout of dialog windows for better touch integration - audio stack ported to Qt Audio for mobile devices diff --git a/src/exam/tcanvas.cpp b/src/exam/tcanvas.cpp index fd6bcf69e..bb29f232b 100644 --- a/src/exam/tcanvas.cpp +++ b/src/exam/tcanvas.cpp @@ -65,6 +65,14 @@ QFont smalTipFont(QWidget* w) { #endif +ThackedTouchTip::ThackedTouchTip(const QString& text, QColor bgColor) : + TgraphicsTextTip(text, bgColor) +{ + setBaseColor(qApp->palette().text().color()); + setDefaultTextColor(qApp->palette().base().color()); +} + + Tcanvas::Tcanvas(QGraphicsView* view, Texam* exam, MainWindow* parent) : QObject(parent->centralWidget()), m_window(parent), @@ -696,7 +704,7 @@ void Tcanvas::setPosOfTip(TgraphicsTextTip* tip) { void Tcanvas::setResultPos() { - m_resultTip->setPos(m_scene->width() * 0.52 + (m_scene->width() * 0.48 - m_resultTip->realW()) / 2, m_scene->height() * 0.01); + m_resultTip->setPos(m_scene->width() * 0.52 + (m_scene->width() * 0.48 - m_resultTip->realW()) / 2, m_scene->height() * 0.05); } @@ -710,12 +718,21 @@ void Tcanvas::setTryAgainPos() { void Tcanvas::setWhatNextPos() { #if defined (Q_OS_ANDROID) + qreal sc = (m_view->height() / 8.0) / m_nextTip->realH(); + if (sc > 1.0) + m_nextTip->setScale(sc); qreal hh = m_view->height() * 0.75; // place tips above guitar, even it is hidden or doesn't exist m_nextTip->setPos(m_window->width() - m_nextTip->realW() - 4, hh - m_nextTip->realH()); - if (m_prevTip) + if (m_prevTip) { + if (sc > 1.0) + m_prevTip->setScale(sc); m_prevTip->setPos(4, hh - m_prevTip->realH()); - if (m_correctTip) + } + if (m_correctTip) { + if (sc > 1.0) + m_correctTip->setScale(sc); m_correctTip->setPos(m_window->width() - m_correctTip->realW() - 4, m_nextTip->y() - m_correctTip->realH() - 8); + } #else int maxTipHeight = getMaxTipHeight(); if (!m_nameFree && m_whatTip->realH() != maxTipHeight) @@ -743,6 +760,9 @@ void Tcanvas::setStartTipPos() { void Tcanvas::setConfirmPos() { // right top corner #if defined (Q_OS_ANDROID) + qreal sc = (m_view->height() / 8.0) / m_confirmTip->realH(); + if (sc > 1.0) + m_confirmTip->setScale(sc); m_confirmTip->setPos(m_window->width() - m_confirmTip->realW() - 4, 4); // 4 is more-less tip shadow size #else m_confirmTip->setPos(m_window->width() - m_confirmTip->realW() - 20, 20); diff --git a/src/exam/tcanvas.h b/src/exam/tcanvas.h index 3aeff1f08..85ba58892 100644 --- a/src/exam/tcanvas.h +++ b/src/exam/tcanvas.h @@ -51,7 +51,7 @@ class ThackedTouchTip : public TgraphicsTextTip { Q_OBJECT public: - ThackedTouchTip(const QString& text, QColor bgColor = -1) : TgraphicsTextTip(text, bgColor) {} + ThackedTouchTip(const QString& text, QColor bgColor = -1); protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent*) { -- GitLab