Results 1 to 5 of 5

Thread: Difficult:Dynamic Icon size change?!?

  1. #1
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Difficult:Dynamic Icon size change?!?

    Given data: QListview: length=desktop->width();


    Problem statement(s):
    1. You are dispaying some icons using Qlistview. The maximum allowed icon size is 48x48. Whenever the user shrinks the size of the window, the icons should also shrink to fit them selves within the viewport. Similarly the icon, should expand only till the max size as mentioned. In no case shall a scroll bar appear...assuming that there is only one row of Icons.

    2. (Qlistview height=52 pixels - fixed...can't be changed) Now assume that the maximum icons that can occupy one whole row (the breadth of the desktop screen) is 10. If the user drags another Icon into this widget (thus making the total num to 11) the other Icons should shrink in size to accommodate this extra Icon.

    2.1. Alternatively, You are allowed to add the scroll buttons (up & down) but the scroll bar itself should not be shown...i.e. the scrolling should be completely controlled by the buttons implying this, placed at the either end of the widget. Each scroll should be in steps of the icon size (fixed at 48 pixels)

    Any answers....

    Thanks..

    Nupul
    Last edited by nupul; 10th April 2006 at 07:29.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    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: Difficult:Dynamic Icon size change?!?

    Any specific questions?

    A general answer is to change icon size when container size changes and to set an scroll step (its called pageStep) to an appropriate value.

  3. #3
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Difficult:Dynamic Icon size change?!?

    Quote Originally Posted by wysota
    Any specific questions?
    w.r.t what? I've put forth 3 problems!

    A general answer is to change icon size when container size changes...
    ummm, I knew this is the answer, but I wanted to know how to do it

    and to set an scroll step (its called pageStep) to an appropriate value.
    didn't know this, thanks for the pointer...but can i do so without actually displaying a scrollbar, but buttons, as i mentioned...I'd appreciate if you can help me with some code snippet rather than plain text...it'll help me understand better!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    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: Difficult:Dynamic Icon size change?!?

    Quote Originally Posted by nupul
    w.r.t what? I've put forth 3 problems!
    We're giving hints here, not producing free solutions for every problem. You should first try to do something on your own and then if you have particular problems, ask for help. And we are very strict about it when it comes to academic projects like yours.

    ummm, I knew this is the answer, but I wanted to know how to do it
    But you didn't ask how to modify icon size when the container size changes, you just stated what final behaviour you want to have.

    You're probably using QListView so I guess you should reimplement QListView::iconSize() or use QListView::setIconSize() from within resizeEvent (or resize() method reimplementation).

    didn't know this, thanks for the pointer...but can i do so without actually displaying a scrollbar, but buttons, as i mentioned...I'd appreciate if you can help me with some code snippet rather than plain text...it'll help me understand better!
    I don't think a snippet is needed here Use QAbstractScrollArea::scrollContentsBy() from within a slot connected to the clicked() signal of those buttons. The only problem is implementing buttons themselves If you want to place them on the inside of the view, you can't use layouts but rather use setGeometry() from resizeEvent to move them to appropriate places. When they are to be outside, layouts should be fine, but you waste some space. Of course you have to make sure the scroll bar is hidden.

  5. #5
    Join Date
    Mar 2006
    Posts
    172
    Thanks
    30
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Difficult:Dynamic Icon size change?!?

    Quote Originally Posted by wysota
    We're giving hints here, not producing free solutions for every problem. You should first try to do something on your own and then if you have particular problems, ask for help. And we are very strict about it when it comes to academic projects like yours.
    This particular doubt is not concerned with my project. I had seen an app do this once and was just curious if the same could be achieved in Qt! As for trying to do this on my own is concerned....i just didn't know what to try and use to try a solution

    Thanks!

    Nupul

Similar Threads

  1. How to change Icon size in QMenu?
    By alex chpenst in forum Qt Programming
    Replies: 4
    Last Post: 3rd September 2008, 14:16
  2. Replies: 1
    Last Post: 2nd August 2008, 15:46
  3. Replies: 2
    Last Post: 21st May 2007, 21:12
  4. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  5. tool bar icon size looking small???
    By darpan in forum Qt Tools
    Replies: 7
    Last Post: 31st March 2006, 16:38

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.