Results 1 to 11 of 11

Thread: QScrollArea Sizing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QScrollArea Sizing

    Quote Originally Posted by LIRiot View Post
    Maybe I should explain better. Let's say my dialog-size is 320*240 and they load an image that is 640*480. I would like to increase the dialog-size up to a maximum of 800*600. So, if they open a large image, they get scrolls, if they open a medium size image, it will put it in "perfect-view."
    Let's assume I am a user of your application. I have started the app and I have also started a web browser because I wanted to check out the live results of the latest Formula 1 GP. I reduced the size of the window belonging to your aplication because I wanted to see the complete table of results of all 24 drivers but at the same time I'm working with your application. I open some file in your app and wham! it resizes covering my browser window. So I scale your app down again to see the F1 results. I open some other file in your app and wham! it resizes again. What do I do next? I uninstall your application and find a replacement that won't try to be smarter than its user.
    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.


  2. #2
    Join Date
    Oct 2010
    Posts
    11

    Default Re: QScrollArea Sizing

    Wysota, you have a point, but that's why we have options. Are you honestly telling me that you can't ever see a reason to scale a scrollable area to size? What about when your image is a part of a multi-document interface? Doesn't it make sense to load a small->medium size image in full-view? And if you just set a static size at which it loads, then you have the problem of it perhaps being JUST too big for the static size. Then you have scroll bars which take up room causing the edges to be cut off when the image is just 1 pixel too large for the static size. Of course it becomes more than 1-pixel once the scroll-bars come into play.

    I take it by the responses there is no way to tell the size at which a scrollable area needs to be to fit its contents?

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

    Default Re: QScrollArea Sizing

    Quote Originally Posted by LIRiot View Post
    Wysota, you have a point, but that's why we have options. Are you honestly telling me that you can't ever see a reason to scale a scrollable area to size?
    I already had this discussion with someone on this forum. No, I can't ever see such a reason. If I wanted to have such functionality, I would put a button called "adjust window to content" in my application but would never do the adjustment automatically.

    What about when your image is a part of a multi-document interface? Doesn't it make sense to load a small->medium size image in full-view?
    I would rather maximize the document window when loading a new document. But if I had an existing window and loading a document into that, I would never scale up the window because it might break the user experience.

    And if you just set a static size at which it loads, then you have the problem of it perhaps being JUST too big for the static size. Then you have scroll bars which take up room causing the edges to be cut off when the image is just 1 pixel too large for the static size.
    The counter argument might be that you want to scale up to 800x600 and the image could have the size of 801x601 and you would still have scroll bars. Or my desktop could be 640x480 in size and I'd have to do weird things just to be able to resize the window (I actually had seen an application do that).

    I take it by the responses there is no way to tell the size at which a scrollable area needs to be to fit its contents?
    Sure there is. It's the size of the contents plus the size of the margins around the viewport plus the size of the viewport border.
    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.


  4. #4
    Join Date
    Oct 2010
    Posts
    11

    Default Re: QScrollArea Sizing

    What would the proper method be of getting the sizes of the margins and borders? If I were to create this "adjust-to-size" button? See, I completely understand why you would suggest that it could be a problem that such a thing is automated. But, I feel it is just as wrong not to allow this to be done at all. While you may not prefer your windows of size, some people do, and having to manually adjust the borders for each image ever loaded is a major pain.

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

    Default Re: QScrollArea Sizing

    Quote Originally Posted by LIRiot View Post
    What would the proper method be of getting the sizes of the margins and borders?
    Asking the style could be one way to do it.
    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.


  6. #6
    Join Date
    Oct 2010
    Posts
    11

    Default Re: QScrollArea Sizing

    Can you tell me how to retrieve the required margins and borders with QStyle?

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

    Default Re: QScrollArea Sizing

    No, I don't know all the constants by heart. It's best to look into source-code of QAbstractScrollArea to see what gets called by it. It could be that you can get the proper numbers (at least for the padding of the viewport relative to the whole widget) by the public API of the latter.
    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.


  8. #8
    Join Date
    Oct 2010
    Posts
    11

    Default Re: QScrollArea Sizing

    I will look into this, thank you. Also I think I have come to like the idea of a button. I think I will go with modding the UI to have an action which pops it to full-size or full-screen depending on obviously which makes more sense.

Similar Threads

  1. Replies: 0
    Last Post: 30th April 2010, 05:22
  2. Replies: 2
    Last Post: 10th March 2008, 20:16
  3. QGraphicsSvgItem sizing
    By jefferai in forum Qt Programming
    Replies: 1
    Last Post: 27th June 2007, 21:48
  4. Sizing problem
    By Levon Nikoghosyan in forum Qt Programming
    Replies: 7
    Last Post: 2nd April 2007, 17:31
  5. sizing question
    By jlgerber in forum Newbie
    Replies: 1
    Last Post: 20th November 2006, 16:48

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.