summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihye Won <jihye.won1@samsung.com>2015-12-10 14:34:41 +0900
committerSeokYeon Hwang <syeon.hwang@samsung.com>2015-12-18 16:13:13 +0900
commit3222978a1535435fa3b56c3d1f1cbcb3078e9185 (patch)
treea6d91f49ba7297dc905d97f28c2e2bea23e107f5
parentbe1df7f9d085e8681bc7fd215a9ce3f462664c7f (diff)
downloadqemu-3222978a1535435fa3b56c3d1f1cbcb3078e9185.tar.gz
qemu-3222978a1535435fa3b56c3d1f1cbcb3078e9185.tar.bz2
qemu-3222978a1535435fa3b56c3d1f1cbcb3078e9185.zip
controller: fix the bug on the event of dockingconview
Because handling the mouse event of dockingconview is incorrect, the controller could be moved unintenionally in certain case. Therefore, I added codes for setting dockingconview's status correctly. Also the enumeration like CONVIEW_* is designed to react the left mouse button. Change-Id: I8fbe0951bd3804b7edd843aeec03624770498329 Signed-off-by: Jihye Won <jihye.won1@samsung.com> Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com> (cherry picked from commit 8c0cb0b479bed1550a69730459574adbb0db46f0)
-rw-r--r--tizen/src/ui/controller/dockingconview.cpp63
-rw-r--r--tizen/src/ui/controller/dockingconview.h11
-rw-r--r--tizen/src/ui/controller/floatingconview.cpp29
-rw-r--r--tizen/src/ui/controller/floatingconview.h3
-rw-r--r--tizen/src/ui/mainview.cpp16
-rw-r--r--tizen/src/ui/mainview.h4
-rw-r--r--tizen/src/ui/skinview.cpp21
-rw-r--r--tizen/src/ui/skinview.h7
8 files changed, 99 insertions, 55 deletions
diff --git a/tizen/src/ui/controller/dockingconview.cpp b/tizen/src/ui/controller/dockingconview.cpp
index d518cb1e10..9953eda57c 100644
--- a/tizen/src/ui/controller/dockingconview.cpp
+++ b/tizen/src/ui/controller/dockingconview.cpp
@@ -37,13 +37,13 @@ DockingConView::DockingConView(QWidget *parent,
ControllerForm *conForm, QGraphicsScene *scene) : SkinView(parent, scene)
{
this->parent = (DockingController *)parent;
- this->conViewStat = CONVIEW_RELEASED;
+ this->conViewStat = CONVIEW_NORMAL;
setFocusPolicy(Qt::NoFocus);
setStyleSheet("DockingConView { background: transparent; border-style: none; }" +
QString(STYLE_TOOLTIP));
- rubberPos = QPoint(-1, -1);
+ rubberPos = SKINVIEW_NULLITY_POSITION;
rubberBand = new QRubberBand(QRubberBand::Rectangle, NULL);
createItems(conForm);
@@ -76,6 +76,22 @@ void DockingConView::createItems(ControllerForm *conForm)
}
}
+void DockingConView::grabWindow(QMouseEvent *event)
+{
+ SkinView::grabWindow(event->globalPos());
+
+ eventPos = event->pos();
+}
+
+/* override */
+void DockingConView::releaseWindow()
+{
+ SkinView::releaseWindow();
+
+ eventPos = SKINVIEW_NULLITY_POSITION;
+ setConViewStatus(CONVIEW_NORMAL);
+}
+
/* override */
QRegion DockingConView::getKeyWinRegion(
QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type)
@@ -103,10 +119,9 @@ void DockingConView::mousePressEvent(QMouseEvent *event)
}
if (event->button() == Qt::LeftButton) {
- QWidget *win = parent->parentWidget();
+ grabWindow(event);
- grabPos = event->globalPos();
- eventPos = event->pos();
+ QWidget *win = parent->parentWidget();
rubberPos.setX(win->pos().x() + parent->pos().x());
rubberPos.setY(win->pos().y() + parent->pos().y());
@@ -115,8 +130,6 @@ void DockingConView::mousePressEvent(QMouseEvent *event)
rubberBand->show();
}
}
-
- setConViewStatus(CONVIEW_PRESSED);
}
/* override */
@@ -124,17 +137,7 @@ void DockingConView::mouseDoubleClickEvent(QMouseEvent *event)
{
SkinView::mouseDoubleClickEvent(event);
- if (bezelItem->isHWKeyHandling() == true) {
- /* do nothing */
- return;
- }
-
- if (event->button() == Qt::LeftButton) {
- grabPos = event->globalPos();
- eventPos = event->pos();
- }
-
- setConViewStatus(CONVIEW_DOUBLECLICKED);
+ /* do nothing */
}
/* override */
@@ -148,13 +151,12 @@ void DockingConView::mouseReleaseEvent(QMouseEvent *event)
}
if (event->button() == Qt::LeftButton) {
- if (grabPos != QPoint(-1, -1)) {
+ if (isGrabWindow() == true) {
if (rubberBand != NULL) {
rubberBand->hide();
}
- if (getConViewStatus() != CONVIEW_PRESSED &&
- getConViewStatus() != CONVIEW_DOUBLECLICKED) {
+ if (getConViewStatus() == CONVIEW_DRAG_OUT) {
/* toggle */
MainWindow *win = ((MainWindow *)parent->parent());
win->getUiState()->getConState()->setRecentlyFloatPos(
@@ -165,7 +167,7 @@ void DockingConView::mouseReleaseEvent(QMouseEvent *event)
}
}
- setConViewStatus(CONVIEW_RELEASED);
+ releaseWindow();
}
/* override */
@@ -178,21 +180,18 @@ void DockingConView::mouseMoveEvent(QMouseEvent *event)
return;
}
- if (grabPos != QPoint(-1, -1) && rubberBand != NULL) {
- rubberBand->setGeometry(
- QRect(rubberPos + (event->globalPos() - grabPos), size()));
+ if (isGrabWindow() == true) {
+ if (rubberBand != NULL) {
+ rubberBand->setGeometry(
+ QRect(rubberPos + (event->globalPos() - grabPos), size()));
+ }
+ setConViewStatus(CONVIEW_DRAG_OUT);
}
-
- setConViewStatus(CONVIEW_MOVED);
}
void DockingConView::setConViewStatus(conViewStatus status)
{
- if (conViewStat == CONVIEW_PRESSED && status == CONVIEW_MOVED) {
- conViewStat = CONVIEW_DRAGGED;
- } else {
- conViewStat = status;
- }
+ conViewStat = status;
}
int DockingConView::getConViewStatus()
diff --git a/tizen/src/ui/controller/dockingconview.h b/tizen/src/ui/controller/dockingconview.h
index 3854972378..abd0f01059 100644
--- a/tizen/src/ui/controller/dockingconview.h
+++ b/tizen/src/ui/controller/dockingconview.h
@@ -47,16 +47,17 @@ public:
~DockingConView();
enum conViewStatus {
- CONVIEW_PRESSED,
- CONVIEW_DOUBLECLICKED,
- CONVIEW_RELEASED,
- CONVIEW_MOVED,
- CONVIEW_DRAGGED
+ CONVIEW_NORMAL,
+ CONVIEW_DRAG_OUT
};
+
void setConViewStatus(conViewStatus status);
int getConViewStatus();
protected:
+ void grabWindow(QMouseEvent *event);
+ void releaseWindow();
+
QRegion getKeyWinRegion(
QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type);
diff --git a/tizen/src/ui/controller/floatingconview.cpp b/tizen/src/ui/controller/floatingconview.cpp
index 95aa75f948..8e093ab53e 100644
--- a/tizen/src/ui/controller/floatingconview.cpp
+++ b/tizen/src/ui/controller/floatingconview.cpp
@@ -43,7 +43,7 @@ FloatingConView::FloatingConView(QWidget *parent,
setStyleSheet("FloatingConView { background: transparent; border-style: none; }" +
QString(STYLE_TOOLTIP));
- conPos = QPoint(-1, -1);
+ conPos = SKINVIEW_NULLITY_POSITION;
rubberBand = new QRubberBand(QRubberBand::Rectangle, NULL);
createItems(conForm);
@@ -80,6 +80,22 @@ void FloatingConView::createItems(ControllerForm *conForm)
}
/* override */
+void FloatingConView::grabWindow(QPoint pos)
+{
+ SkinView::grabWindow(pos);
+
+ conPos = parent->pos();
+}
+
+/* override */
+void FloatingConView::releaseWindow()
+{
+ SkinView::releaseWindow();
+
+ conPos = SKINVIEW_NULLITY_POSITION;
+}
+
+/* override */
QRegion FloatingConView::getKeyWinRegion(
QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type)
{
@@ -163,8 +179,7 @@ void FloatingConView::mousePressEvent(QMouseEvent *event)
}
if (event->button() == Qt::LeftButton) {
- grabPos = event->globalPos();
- conPos = parent->pos();
+ grabWindow(event->globalPos());
}
}
@@ -179,14 +194,14 @@ void FloatingConView::mouseReleaseEvent(QMouseEvent *event)
}
if (event->button() == Qt::LeftButton) {
- grabPos = QPoint(-1, -1);
if (rubberBand != NULL) {
rubberBand->hide();
}
}
- const FloatingController *con = parent;
- MainWindow *win = ((MainWindow *)con->parent());
+ releaseWindow();
+
+ MainWindow *win = ((MainWindow *)parent->parentWidget());
int dockPos = isDockable((QWidget *)win, (QWidget *)parent);
if (dockPos != -1) {
@@ -207,7 +222,7 @@ void FloatingConView::mouseMoveEvent(QMouseEvent *event)
return;
}
- if (grabPos != QPoint(-1, -1)) {
+ if (isGrabWindow() == true) {
/* draw guide for dockable position */
const FloatingController *con = parent;
MainWindow *win = ((MainWindow *)con->parent());
diff --git a/tizen/src/ui/controller/floatingconview.h b/tizen/src/ui/controller/floatingconview.h
index c31938b735..bf1ce1bc67 100644
--- a/tizen/src/ui/controller/floatingconview.h
+++ b/tizen/src/ui/controller/floatingconview.h
@@ -45,6 +45,9 @@ public:
~FloatingConView();
protected:
+ void grabWindow(QPoint pos);
+ void releaseWindow();
+
QRegion getKeyWinRegion(
QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type);
diff --git a/tizen/src/ui/mainview.cpp b/tizen/src/ui/mainview.cpp
index 4a95a6b2be..899666310c 100644
--- a/tizen/src/ui/mainview.cpp
+++ b/tizen/src/ui/mainview.cpp
@@ -38,7 +38,7 @@ MainView::MainView(QGraphicsScene *scene, QWidget *parent) :
SkinView(parent, scene)
{
this->win = ((MainWindow *)parent);
- this->grabWinPos = QPoint(-1, -1);
+ this->grabWinPos = SKINVIEW_NULLITY_POSITION;
this->kbdHelper = new KeyboardHelper(this);
updateLayout();
@@ -74,20 +74,20 @@ KeyboardHelper *MainView::getKbdHelper()
return kbdHelper;
}
-bool MainView::isGrabWindow()
+/* override */
+void MainView::grabWindow(QPoint pos)
{
- return (grabPos != QPoint(-1, -1));
-}
+ SkinView::grabWindow(pos);
-void MainView::grabWindow(QPoint globalPos)
-{
grabWinPos = parentWidget()->pos();
- grabPos = globalPos;
}
+/* override */
void MainView::releaseWindow()
{
- grabPos = QPoint(-1, -1);
+ SkinView::releaseWindow();
+
+ grabWinPos = SKINVIEW_NULLITY_POSITION;
}
void MainView::updateLayout()
diff --git a/tizen/src/ui/mainview.h b/tizen/src/ui/mainview.h
index a829952bef..f231a56aaf 100644
--- a/tizen/src/ui/mainview.h
+++ b/tizen/src/ui/mainview.h
@@ -46,12 +46,12 @@ public:
~MainView();
KeyboardHelper *getKbdHelper();
- bool isGrabWindow();
- void grabWindow(QPoint globalPos);
+
void releaseWindow();
void updateLayout();
protected:
+ void grabWindow(QPoint pos);
QRegion getKeyWinRegion(QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type);
void resizeEvent(QResizeEvent *event);
diff --git a/tizen/src/ui/skinview.cpp b/tizen/src/ui/skinview.cpp
index 33d42c426d..83b33889a3 100644
--- a/tizen/src/ui/skinview.cpp
+++ b/tizen/src/ui/skinview.cpp
@@ -35,7 +35,7 @@
SkinView::SkinView(QWidget *parent, QGraphicsScene *scene) :
QGraphicsView(scene, parent)
{
- this->grabPos = QPoint(-1, -1);
+ this->grabPos = SKINVIEW_NULLITY_POSITION;
/* note: do not call setStyleSheet() separately for each style */
setStyleSheet("QGraphicsView { border-style: none; }" +
@@ -74,6 +74,25 @@ SkinKeyItem *SkinView::createKeyItem(QGraphicsItem *parent,
&pressedKeyImg, reMasking, form->getHoverType());
}
+bool SkinView::isGrabWindow()
+{
+ return (grabPos != SKINVIEW_NULLITY_POSITION);
+}
+
+void SkinView::grabWindow(QPoint pos)
+{
+ qDebug("grab");
+
+ grabPos = pos;
+}
+
+void SkinView::releaseWindow()
+{
+ qDebug("release");
+
+ grabPos = SKINVIEW_NULLITY_POSITION;
+}
+
SkinView::~SkinView()
{
/* do nothing */
diff --git a/tizen/src/ui/skinview.h b/tizen/src/ui/skinview.h
index a45b35dd4b..4333017f75 100644
--- a/tizen/src/ui/skinview.h
+++ b/tizen/src/ui/skinview.h
@@ -36,12 +36,16 @@
#include "skinkeyitem.h"
#include "layout/layoutform.h"
+#define SKINVIEW_NULLITY_POSITION QPoint(-1, -1)
+
class SkinView : public QGraphicsView
{
public:
SkinView(QWidget *parent, QGraphicsScene *scene);
~SkinView();
+ bool isGrabWindow();
+
virtual QRegion getKeyWinRegion(
QWidget *base, QRect &keyRect, LayoutForm::SkinImgType type) = 0;
@@ -50,6 +54,9 @@ protected:
SkinKeyItem *createKeyItem(QGraphicsItem *parent,
LayoutForm *form, HardwareKey *hwKey);
+ void grabWindow(QPoint pos);
+ void releaseWindow();
+
QPoint grabPos;
};