Results 1 to 7 of 7

Thread: scrollbars strange behavior

  1. #1
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default scrollbars strange behavior

    Hi all!
    I have a problem with scrollbars using QTableView.
    If I change any row both scrolls moves to the left-top corner. What can I do to prevent this? It would be nice if the scrolls will stay at the same position they was when I starting to edit row.

  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: scrollbars strange behavior

    Are you using a recent version of Qt?
    J-P Nurmi

  3. #3
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scrollbars strange behavior

    Qt Code:
    1. sinelnikov@designer02:~/coding/bezzubov$ dpkg -l|grep libqt4
    2. ii libqt4-core 4.2.1-2
    3. ii libqt4-dev 4.2.1-2
    4. ii libqt4-gui 4.2.1-2
    To copy to clipboard, switch view to plain text mode 
    Debian Etch at work. Ok, I'll try to compile my app with qt-4.2.2 for Windows.

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

    Default Re: scrollbars strange behavior

    My guess is that your model is incorrect. It is probably being reset after a change occurs which causes the view to be reset as well which would produce the behaviour you describe. How did you implement setData() and insertRows() in your model?

  5. #5
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scrollbars strange behavior

    Quote Originally Posted by wysota View Post
    My guess is that your model is incorrect. It is probably being reset after a change occurs which causes the view to be reset as well which would produce the behaviour you describe. How did you implement setData() and insertRows() in your model?
    I don't think so beacouse I'm just using standart QSqlRelationTabelModel. I can publish the sources tomorrow if it will be helpful.

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

    Default Re: scrollbars strange behavior

    Quote Originally Posted by siniy View Post
    I don't think so beacouse I'm just using standart QSqlRelationTabelModel.
    Whenever this model submits its data to the storage, it is also being refreshed (which does a reset of the model), so if you use any other edit strategy than QSqlTableModel::OnManualSubmit, then you experience the behaviour I described in my previous post. Try changing the edit strategy and you'll see the view starts to behave properly. I suggest you use manual submit and submit the data just before you exit the application (or when all views using the model are closed).

  7. The following user says thank you to wysota for this useful post:

    siniy (29th December 2006)

  8. #7
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: scrollbars strange behavior

    Thanks, you are absolutely right.

Similar Threads

  1. very strange behaviour
    By regix in forum Qt Programming
    Replies: 23
    Last Post: 20th July 2006, 17:38
  2. QComboBox +SUSE10.0 +qt4.1 strange behavior
    By antonio.r.tome in forum Qt Programming
    Replies: 6
    Last Post: 20th March 2006, 17:49

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.