×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    99

    QGestures on Symbian^3 (Qt 4.7.3)

    Ok guys, i am getting mad here. I am trying to enable pinch zoom in my app but with no luck whatsoever. What i am doing wrong?

    Code:
    class PreviewWidget : public QWidget
    {
    Q_OBJECT
    public:
        PreviewWidget(QWidget *parent = 0);
    
    protected:
        void paintEvent(QPaintEvent *);
        void resizeEvent(QResizeEvent *);
        void mousePressEvent(QMouseEvent *);
        void mouseMoveEvent(QMouseEvent *);
        void mouseReleaseEvent(QMouseEvent *);
    
        void pinchGesture(QPinchGesture *);
    
        bool event(QEvent *event);
        bool gestureEvent(QGestureEvent *event);
    
    private:
        QPixmap image;
        QPointF _viewOffset;
        qreal _zoomFactor;
        bool isDragging;
    
    };
    And:

    Code:
    PreviewWidget::PreviewWidget(QWidget *parent) :
        QWidget(parent)
    {
        grabGesture(Qt::PinchGesture);
        isDragging = false;
    }
    
    void PreviewWidget::resizeEvent(QResizeEvent * re)
    {
        calculateZoom(re->size());
        update();
    }
    
    void PreviewWidget::paintEvent(QPaintEvent *)
    {
        QPainter painter(this);
        painter.scale( _zoomFactor, _zoomFactor );
        painter.translate( -_viewOffset );
        painter.drawPixmap( 0,0, image );
    }
    
    void PreviewWidget::mousePressEvent(QMouseEvent * me)
    {
        isDragging = true;
        _dragStart = me->posF();
    }
    
    void PreviewWidget::mouseMoveEvent(QMouseEvent *me)
    {
        if ( isDragging )
        {
              [...omitted...]
        }
    }
    
    void PreviewWidget::mouseReleaseEvent(QMouseEvent *me)
    {
        isDragging = false;
    }
    
    bool PreviewWidget::event(QEvent *event)
    {
        if (event->type() == QEvent::Gesture)
            return gestureEvent(static_cast<QGestureEvent*>(event));
        return QWidget::event(event);
    }
    
    bool PreviewWidget::gestureEvent(QGestureEvent *event)
    {
        if (QGesture *pinch = event->gesture(Qt::PinchGesture))
            pinchGesture(static_cast<QPinchGesture *>(pinch));
        return true;
    }
    
    void PreviewWidget::pinchGesture(QPinchGesture * gesture)
    {
        _zoomFactor *= gesture->scaleFactor();
    }
    i have oimitted some extra methods which are not relevant. The point is my widget NEVER receive any gesture... Why is this? Can somebody help me?

    I am building using Qt 4.7.3 for Symbian^3 and testing on a C6-01...

    I cannot see the problem and i have been trying hard, also the imagegestures kinda work (pinch seems, other does not seems)

  2. #2
    Nokia Developer Expert
    Join Date
    Sep 2011
    Posts
    382

    Re: QGestures on Symbian^3 (Qt 4.7.3)

    There are few known issues on certain devices with certain Qt versions:

    https://bugreports.qt.nokia.com/brow...story-tabpanel

    We apologize for the inconvenience.
    /0

Similar Threads

  1. How to get a Symbian application tested for all popular nokia symbian phones?
    By James West in forum Feedback - Nokia Developer Services & Infrastructure
    Replies: 2
    Last Post: 2009-08-28, 07:48
  2. Replies: 4
    Last Post: 2009-01-12, 13:57
  3. Replies: 1
    Last Post: 2007-04-27, 13:29
  4. Replies: 1
    Last Post: 2003-02-07, 16:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×