Hi,

I'm trying to get a window displaying a grid of images. (Like the ones that
would exist in either a character loader or a pose manager). Each of those
buttons would execute or import a different file.

I want the QGridLayout to react to the size of the window. In order to do
that, this is what I've done:

   - Created a main layout for the window
   - Created a QScrollArea (Since I want to get a vertical scroll bar if
   the grid has too many rows to be displayed with the current size)
   - Created a QWidget inside the QScrollArea so I can add a layout to it
   - Created a QGridLayout within the QWidget previously created (This one
   will contain the buttons)

At the moment, I'm overwritting the 'resizeEvent' method of the window to
calculate how many rows and columns I'm going to need and I re-draw the
rowss and columns of buttons based on the result.

For some reason, I have the feeling that I might be re-inventing the wheel
and there might be an easier way to do this. That's why I'm sending this
message.  :-)

This is the code that I have so far:

- https://gist.github.com/davidmartinezanim/9640295

Also there are a few questions that I have:


   - I'm not sure if the current method is really intensive on the
   computer. (Of it it is the best one to use for that matter).
   - Ideally, I want to implement a MVP solution. (Displaying the
   information using images will be only one of the options). Should I scratch
   my current code or will it be usable?
   - I want to be able to add borders to the image (of different colors
   depending of status of characters). My plan was to flatten the button,
   change it's background color and add a Pixmap on top so the background of
   the button will act as border and the image will be on top. Is that a good
   approach?
   - I'd like to have the grid aligned to the left and not adding spacing
   between buttons when increasing the width of the window. New columns and
   rows should be added if necessary but not this strange spacing that I'm
   getting right now. The spacing between buttons should be the same
   regardless of the size of the window.

I know that there are quite a few questions in this email and I intend to
start fixing things one step at a time, but I wanted to check with you guys
if I'm going in the right direction or not.

Many thanks in advance

--
David Martinez - Technical Animator

Email: [email protected]
Website: http://www.elusiveideas.com

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAMLeNpxVO57NYLzudWa7SZE_AOEAucJayBBy3%2Bx0afNNrBjcPA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to