fix: Delete gui gestures in MainWindow.
This commit is contained in:
@@ -98,10 +98,10 @@ int main(int argc, char* argv[])
|
|||||||
SystemOperationLog::getInstance();
|
SystemOperationLog::getInstance();
|
||||||
|
|
||||||
QObject::connect(TouchScreenSignalSender::getInstance(), SIGNAL(touchScreen()), Locker::getInstance(), SLOT(refreshTimer()));
|
QObject::connect(TouchScreenSignalSender::getInstance(), SIGNAL(touchScreen()), Locker::getInstance(), SLOT(refreshTimer()));
|
||||||
QList<Qt::GestureType> gestures;
|
// QList<Qt::GestureType> gestures;
|
||||||
gestures << Qt::SwipeGesture;
|
// gestures << Qt::SwipeGesture;
|
||||||
gestures << Qt::PanGesture;
|
// gestures << Qt::PanGesture;
|
||||||
w.grabGestures(gestures);
|
// w.grabGestures(gestures);
|
||||||
|
|
||||||
QStringList app_args = a.arguments();
|
QStringList app_args = a.arguments();
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|||||||
@@ -247,14 +247,14 @@ void MainWindow::triggerInfo(const QPair<QString, unsigned int>& aInfoData)
|
|||||||
//------events-----------------------------------------------------------------
|
//------events-----------------------------------------------------------------
|
||||||
|
|
||||||
//! [event handler]
|
//! [event handler]
|
||||||
bool MainWindow::event(QEvent* aEvent)
|
//bool MainWindow::event(QEvent* aEvent)
|
||||||
{
|
//{
|
||||||
if (aEvent->type() == QEvent::Gesture)
|
// if (aEvent->type() == QEvent::Gesture)
|
||||||
{
|
// {
|
||||||
return gestureEvent(static_cast<QGestureEvent*>(aEvent));
|
// return gestureEvent(static_cast<QGestureEvent*>(aEvent));
|
||||||
}
|
// }
|
||||||
return QMainWindow::event(aEvent);
|
// return QMainWindow::event(aEvent);
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::changeEvent(QEvent* aEvent)
|
void MainWindow::changeEvent(QEvent* aEvent)
|
||||||
{
|
{
|
||||||
@@ -283,61 +283,61 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
|
|||||||
QWidget::keyPressEvent(event);
|
QWidget::keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::gestureEvent(QGestureEvent* aGestureEvent)
|
//bool MainWindow::gestureEvent(QGestureEvent* aGestureEvent)
|
||||||
{
|
//{
|
||||||
if (QGesture* swipe = aGestureEvent->gesture(Qt::SwipeGesture))
|
// if (QGesture* swipe = aGestureEvent->gesture(Qt::SwipeGesture))
|
||||||
{
|
// {
|
||||||
swipeTriggered(static_cast<QSwipeGesture*>(swipe));
|
// swipeTriggered(static_cast<QSwipeGesture*>(swipe));
|
||||||
}
|
// }
|
||||||
if (QGesture* pan = aGestureEvent->gesture(Qt::PanGesture))
|
// if (QGesture* pan = aGestureEvent->gesture(Qt::PanGesture))
|
||||||
{
|
// {
|
||||||
panTriggered(static_cast<QPanGesture*>(pan));
|
// panTriggered(static_cast<QPanGesture*>(pan));
|
||||||
}
|
// }
|
||||||
return true;
|
// return true;
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::grabGestures(const QList<Qt::GestureType>& aGestures)
|
//void MainWindow::grabGestures(const QList<Qt::GestureType>& aGestures)
|
||||||
{
|
//{
|
||||||
//! [enable gestures]
|
// //! [enable gestures]
|
||||||
foreach(Qt::GestureType gesture, aGestures)
|
// foreach(Qt::GestureType gesture, aGestures)
|
||||||
{
|
// {
|
||||||
grabGesture(gesture);
|
// grabGesture(gesture);
|
||||||
}
|
// }
|
||||||
//! [enable gestures]
|
// //! [enable gestures]
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::panTriggered(QPanGesture* aPanGesture)
|
//void MainWindow::panTriggered(QPanGesture* aPanGesture)
|
||||||
{
|
//{
|
||||||
if (aPanGesture->state() == Qt::GestureFinished)
|
// if (aPanGesture->state() == Qt::GestureFinished)
|
||||||
{
|
// {
|
||||||
QPointF delta = aPanGesture->offset();
|
// QPointF delta = aPanGesture->offset();
|
||||||
int index = mTabWidget->currentIndex();
|
// int index = mTabWidget->currentIndex();
|
||||||
if (delta.x() > 50)
|
// if (delta.x() > 50)
|
||||||
{
|
// {
|
||||||
|
|
||||||
index--;
|
// index--;
|
||||||
if (index >= 0)
|
// if (index >= 0)
|
||||||
{
|
// {
|
||||||
mTabWidget->setCurrentIndex(index);
|
// mTabWidget->setCurrentIndex(index);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (delta.x() < -50)
|
// if (delta.x() < -50)
|
||||||
{
|
// {
|
||||||
index++;
|
// index++;
|
||||||
if (index < mTabWidget->count())
|
// if (index < mTabWidget->count())
|
||||||
{
|
// {
|
||||||
mTabWidget->setCurrentIndex(index);
|
// mTabWidget->setCurrentIndex(index);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void MainWindow::swipeTriggered(QSwipeGesture* aSwipeGesture)
|
//void MainWindow::swipeTriggered(QSwipeGesture* aSwipeGesture)
|
||||||
{
|
//{
|
||||||
if (aSwipeGesture->state() == Qt::GestureFinished)
|
// if (aSwipeGesture->state() == Qt::GestureFinished)
|
||||||
{
|
// {
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
//------actions & slots--------------------------------------------------------
|
//------actions & slots--------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
void centerWidgetHide();
|
void centerWidgetHide();
|
||||||
void centerWidgetShow();
|
void centerWidgetShow();
|
||||||
void requestScreenSaver();
|
void requestScreenSaver();
|
||||||
void grabGestures(const QList<Qt::GestureType>& aGestures);
|
//void grabGestures(const QList<Qt::GestureType>& aGestures);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void requestLogin();
|
void requestLogin();
|
||||||
@@ -40,16 +40,16 @@ public slots:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void changeEvent(QEvent* aEvent) override;
|
void changeEvent(QEvent* aEvent) override;
|
||||||
bool event(QEvent* aEvent) override;
|
// bool event(QEvent* aEvent) override;
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent *event) override;
|
void keyPressEvent(QKeyEvent *event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initializeTabWidget();
|
void initializeTabWidget();
|
||||||
void initializeLayout();
|
void initializeLayout();
|
||||||
bool gestureEvent(QGestureEvent* aGestureEvent);
|
// bool gestureEvent(QGestureEvent* aGestureEvent);
|
||||||
void swipeTriggered(QSwipeGesture* aSwipeGesture);
|
// void swipeTriggered(QSwipeGesture* aSwipeGesture);
|
||||||
void panTriggered(QPanGesture* aPanGesture);
|
// void panTriggered(QPanGesture* aPanGesture);
|
||||||
void loadStyleSheet(const QString& aSheetName);
|
void loadStyleSheet(const QString& aSheetName);
|
||||||
void showShutdownWidget();
|
void showShutdownWidget();
|
||||||
void processShutdownDmsFailed();
|
void processShutdownDmsFailed();
|
||||||
|
|||||||
Reference in New Issue
Block a user