summaryrefslogtreecommitdiff
path: root/tizen/src/ui
diff options
context:
space:
mode:
authorGiWoong Kim <giwoong.kim@samsung.com>2016-01-12 16:28:59 +0900
committerSeokYeon Hwang <syeon.hwang@samsung.com>2016-01-14 20:55:35 +0900
commit6848fc58b97d0c6c5379ee5979ca89a4103c0236 (patch)
tree22af09b751e0daed66489c6d0327904553d006b4 /tizen/src/ui
parent851d7583caacb993453eb079e85ee186ca437928 (diff)
downloadqemu-6848fc58b97d0c6c5379ee5979ca89a4103c0236.tar.gz
qemu-6848fc58b97d0c6c5379ee5979ca89a4103c0236.tar.bz2
qemu-6848fc58b97d0c6c5379ee5979ca89a4103c0236.zip
controller: consider elided text for key buttons
If the string text is wider than button width, use an elided version of the string. Change-Id: I458b04d794db717e6a428b78ddbe9e38a083db30 Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
Diffstat (limited to 'tizen/src/ui')
-rw-r--r--tizen/src/ui/controller/hwkeybutton.cpp9
-rw-r--r--tizen/src/ui/controller/hwkeybutton.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/tizen/src/ui/controller/hwkeybutton.cpp b/tizen/src/ui/controller/hwkeybutton.cpp
index 0bf298b1c7..d9f2b43209 100644
--- a/tizen/src/ui/controller/hwkeybutton.cpp
+++ b/tizen/src/ui/controller/hwkeybutton.cpp
@@ -58,6 +58,14 @@ HWKeyButton::HWKeyButton(QWidget *parent, HardwareKey *hwKey, QSize size) :
);
}
+/* override */
+void HWKeyButton::showEvent(QShowEvent *event)
+{
+ // keep 10% space for margin
+ setText(fontMetrics().elidedText(text(), Qt::ElideRight, width() * 0.9));
+}
+
+/* override */
void HWKeyButton::mousePressEvent(QMouseEvent *event)
{
const int keycode = hwKey->getKeycode();
@@ -68,6 +76,7 @@ void HWKeyButton::mousePressEvent(QMouseEvent *event)
QPushButton::mousePressEvent(event);
}
+/* override */
void HWKeyButton::mouseReleaseEvent(QMouseEvent *event)
{
const int keycode = hwKey->getKeycode();
diff --git a/tizen/src/ui/controller/hwkeybutton.h b/tizen/src/ui/controller/hwkeybutton.h
index b758c2672f..790789f866 100644
--- a/tizen/src/ui/controller/hwkeybutton.h
+++ b/tizen/src/ui/controller/hwkeybutton.h
@@ -42,6 +42,7 @@ public:
~HWKeyButton();
protected:
+ void showEvent(QShowEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);