Results 1 to 9 of 9

Thread: setValue of ScrollBar Don't work at first time

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Location
    Palma de Mallorca, Islas Baleares, Spain
    Posts
    24
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: setValue of ScrollBar Don't work at first time

    Thanks!!
    I had already tested, and didn't works.

    I tried:
    Qt Code:
    1. scrollAreaCandidate->horizontalScrollBar()->update();
    2. scrollAreaCandidate->update();
    3. scrollAreaCandidate->horizontalScrollBar()->repaint();
    To copy to clipboard, switch view to plain text mode 

    But nothing works!!!

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: setValue of ScrollBar Don't work at first time

    were in you code you call openImage(), I mean which objects method / slot?
    If openImage() is a slot, to which signal is it connected?

  3. #3
    Join Date
    Apr 2011
    Location
    Palma de Mallorca, Islas Baleares, Spain
    Posts
    24
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: setValue of ScrollBar Don't work at first time

    Thanks for reply!

    The connexions are very sophisticated. MyClass emits a signal when is clicked a button. I connect this signal with another slot of other class (MainWindow). MainWindow do some operations and generates a string (path). I emit a signal with this string, and the receiver is MyClass:penImage.

    At fisrt time, mainWindow emits the signal with a default path. Perhaps the error could be there. But I can't understand why the first time it scale the image properly and not set the value of the scrollBar!

  4. #4
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: setValue of ScrollBar Don't work at first time

    try to use: QScrollArea::alignment-prop I think this is what you really want.

  5. The following user says thank you to MarekR22 for this useful post:

    sergio87 (8th June 2011)

  6. #5
    Join Date
    Apr 2011
    Location
    Palma de Mallorca, Islas Baleares, Spain
    Posts
    24
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: setValue of ScrollBar Don't work at first time

    Quote Originally Posted by MarekR22 View Post
    try to use: QScrollArea::alignment-prop I think this is what you really want.
    I read that this is to centre (for example) the content. http://lists.trolltech.com/qt4-previ...ad00063-0.html

    Maybe my poor english is confusing. My apologies. Anyway, I tried and it didn't work.

    I simplified the code to show you. The "2000", actually, is a variable that contains a different value called pointX. Point is calculated every time I load an image, before the setValue. It contain the correct number in each image, but it didn't set the value to the crolBar...

    Thank you very much!!
    Last edited by sergio87; 8th June 2011 at 11:06.

Similar Threads

  1. Replies: 0
    Last Post: 12th August 2010, 16:05
  2. How to use setValue in QSqlTableModel?
    By jtdavidson in forum Newbie
    Replies: 1
    Last Post: 21st July 2010, 15:10
  3. qsettings setvalue has something unnecessary
    By yj_yulin in forum Qt Programming
    Replies: 2
    Last Post: 14th June 2010, 05:46
  4. SetValue
    By phillip_Qt in forum Qt Programming
    Replies: 4
    Last Post: 3rd October 2007, 22:45

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.