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