Results 1 to 4 of 4

Thread: Propagating event to scrollBar

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Propagating event to scrollBar

    I'm trying to propagate an event to my QScrollbar.

    Qt Code:
    1. /* virtual */ void ZeContactFlow::wheelEvent(QWheelEvent * event)
    2. {
    3. std::cout << "Hello ?\n";
    4. if (mScrollBar)
    5. {
    6. QWheelEvent * newEvent = new
    7. QWheelEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(),
    8. Qt::NoModifier, event->orientation());
    9. QCoreApplication::postEvent(mScrollBar, newEvent);
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 

    This code has no effect. What am I doing wrong ?
    Last edited by bunjee; 22nd June 2008 at 14:22.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Propagating event to scrollBar

    So ZeContactFlow is something which doesn't inherit QAbstractScrollArea (which already does such thing)?
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Propagating event to scrollBar

    QAbstractScrollArea instance is a child of ZeContactFlow instance.

  4. #4
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Propagating event to scrollBar

    Qt Code:
    1. /* virtual */ void ZeContactFlow::wheelEvent(QWheelEvent * event)
    2. {
    3. std::cout << "Hello ?\n";
    4. if (mScrollBar)
    5. {
    6. //QWheelEvent * newEvent = new
    7. // QWheelEvent(event->pos(), event->globalPos(), event->delta(), event->buttons(),
    8. // Qt::NoModifier, event->orientation());
    9. QApplication::sendEvent(mScrollBar, event);
    10. }
    11. else
    12. {
    13. event->ignore();
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

    This implementation makes me crash

Similar Threads

  1. Qt event queue overloading?
    By gct in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2008, 18:39
  2. GraphicsView/GraphicsScene: scrollbar policy Qt::ScrollBarAsNeeded
    By Pieter from Belgium in forum Qt Programming
    Replies: 4
    Last Post: 21st March 2007, 13:15
  3. The event fired by the mouse click on the frame
    By Placido Currò in forum Qt Programming
    Replies: 8
    Last Post: 3rd March 2007, 09:05
  4. Workload in a QThread blocks main application's event loop ?
    By 0xBulbizarre in forum Qt Programming
    Replies: 14
    Last Post: 9th April 2006, 21:55
  5. QRubberBand painting in the scroll area widget
    By SkripT in forum Qt Programming
    Replies: 7
    Last Post: 17th January 2006, 16:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.