Results 1 to 9 of 9

Thread: QScrollArea wrong behavior on the Symbian platform

  1. #1

    Default QScrollArea wrong behavior on the Symbian platform

    Hello all.

    I have an issue with scrolling.

    This code works fine on the windows platform but it does not scroll on the Symbian one.
    Qt Code:
    1. Widget::Widget(QWidget *parent)
    2. : QWidget(parent)
    3. {
    4. QScrollArea* scrollArea = new QScrollArea( this );
    5. scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    6. scrollArea->setFrameStyle( QFrame::NoFrame );
    7.  
    8. QWidget* scrollWidget = new QWidget(scrollArea);
    9. QVBoxLayout* verticalLayout = new QVBoxLayout(scrollWidget);
    10. scrollWidget->setLayout(verticalLayout);
    11.  
    12. QLabel* label = new QLabel( "After university in 1977, she joined the Radio Times as a sub-editor before moving in 1978 to the Times Higher Education Supplement as the deputy literary editor. She began freelance writing at the same time. Truss was Literary Editor of The Listener (1986–90) and was an arts and books reviewer for The Independent on Sunday before joining The Times in 1991, where first she spent six years writing television criticism, illustrated by John Minnion, followed by four years as a sports columnist. She won Columnist of the Year for her work for Woman's Journal. She now reviews books for The Sunday Times. Her book Eats, Shoots & Leaves (November 2003), about the misuse of punctuation, became a bestseller in both Britain and the United States. The book's declaration for a Zero Tolerance Approach to Punctuation is considered a rallying call for punctuation sticklers of the world. In 2005 she released a book on rudeness titled Talk to the Hand: the utter bloody rudeness of the world today (or six good reasons to stay home and bolt the door)." );
    13. label->setWordWrap( true );
    14. verticalLayout->addWidget(label);
    15.  
    16. scrollArea->setWidget(scrollWidget);
    17. QHBoxLayout* horizontalLayout = new QHBoxLayout();
    18. horizontalLayout->addWidget( scrollArea );
    19. setLayout( horizontalLayout );
    20. }
    To copy to clipboard, switch view to plain text mode 

    Seems like wrong widget has focus.

    Does anybody know how to fix it. I've tried a lot of variants how to do it, google a lot but without any success.
    Could you help me please?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Do you have the scroll bar visible?
    Last edited by wysota; 6th October 2010 at 10:05.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Quote Originally Posted by wysota View Post
    Do you have the scroll bar visible?
    Yes, I have. And it works on touch devices correctly. On the non-touch devices it does not work.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollArea wrong behavior on the Symbian platform

    How are you trying to scroll the area then?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Quote Originally Posted by wysota View Post
    How are you trying to scroll the area then?
    Just with cursor.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Does it work on Windows if you try to scroll using the cursor keys without first making the scroll area have focus? I doubt that. If you want to send key events to some widget, this widget needs to have focus. If you want to avoid that, install an event filter on your other widgets and forward cursor key events to the scroll area. You can install an event filter on the application object to intercept all events in your application. Just prevent falling into an infinite loop when forwarding the events to the scroll area - your filter will catch those as well. Note that you shouldn't need to do that if you don't have any widgets accepting focus outside or inside the scroll area.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Quote Originally Posted by wysota View Post
    Does it work on Windows if you try to scroll using the cursor keys without first making the scroll area have focus? I doubt that. If you want to send key events to some widget, this widget needs to have focus. If you want to avoid that, install an event filter on your other widgets and forward cursor key events to the scroll area. You can install an event filter on the application object to intercept all events in your application. Just prevent falling into an infinite loop when forwarding the events to the scroll area - your filter will catch those as well. Note that you shouldn't need to do that if you don't have any widgets accepting focus outside or inside the scroll area.
    - Yes it work on Windows if I try to scroll using the cursor keys without first making the scroll area have focus.
    - I try to set focus on the scroll area
    Qt Code:
    1. void Widget::keyPressEvent(QKeyEvent* aEvent)
    2. {
    3. iScrollArea->setFocus();
    4. qDebug( "Widget::keyPressEvent." );
    5. }
    To copy to clipboard, switch view to plain text mode 
    but it does not work.
    - how to forward events to specified widget?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Quote Originally Posted by sq_vasya View Post
    - Yes it work on Windows if I try to scroll using the cursor keys without first making the scroll area have focus.
    Hail Bill Gates then! It doesn't work on Linux.
    - I try to set focus on the scroll area
    If you execute some code in a method that never gets called then it will never execute. Key events are delivered to widgets that have focus. So if your "Widget" instance doesn't have focus, it won't receive the key press event.
    - how to forward events to specified widget?
    Send/post the widget an event you wish it to receive.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9

    Default Re: QScrollArea wrong behavior on the Symbian platform

    Quote Originally Posted by wysota View Post
    Hail Bill Gates then! It doesn't work on Linux.

    If you execute some code in a method that never gets called then it will never execute. Key events are delivered to widgets that have focus. So if your "Widget" instance doesn't have focus, it won't receive the key press event.
    It calls. I have logged.

Similar Threads

  1. Replies: 1
    Last Post: 9th September 2010, 16:49
  2. Texting Behavior on an Embedded Platform (How to Do it?)
    By cloaked_and_coastin in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 12th July 2010, 19:54
  3. Replies: 2
    Last Post: 16th January 2010, 19:10
  4. Replies: 3
    Last Post: 13th October 2009, 15:31
  5. Replies: 7
    Last Post: 17th July 2009, 09:40

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.