On Wed, Mar 26, 2014 at 2:17 AM, David Martinez <
[email protected]> wrote:

> I think it's worth learning how to do it.
>
> I need to be able to draw a few dozen images so I think the QGraphics
> approach is the appropriate one.
> I do understand that layouts are not visual but define how elements are
> arranged. But how does work within a QGraphics approach?
>
> As you mention, it looks like when working in a QGraphics setup, I need to
> have a scene (the model) and the view.
> Does that mean that the layout will exist within the view? Or is it
> supposed to be part of a QGraphicsWidget?
>

A view is just a QWidget that visualizes a certain area of a given
QGraphicsScene. It provides the link of communicating user interactions to
the scene and the items of the scene. It really has no intimate knowledge
of the actual items in the scene.

Just like a normal QLayout, you have to add a QGraphicsLayout to a parent
item. In this case it would be any
QGraphicsWidget<http://qt-project.org/doc/qt-4.8/qgraphicswidget.html>.
QGraphicsWidget is an extension to the QGraphicsItem, which adds support
for layout and geometry and things like act more like QWidget. So if you
want to work with QGraphicsLayouts, then you have to work with
QGraphicsWidgets as the items being added to the layout.

Then you just think of your parent QGraphicsWidget like a window. While
your QMainWindow exists somewhere on your global screen space, your parent
QGraphicsWidget will exists somewhere in the global scene space.


>
> With regular QWidgets, I can create a window to be that QWidget but that
> doesn't seem to be the case with QGraphicsWidget.
>
> Finally, is the layout going to accept regular widgets and pixmaps or
> QGraphicsWidgets?
>

You would probably be working with QGraphicsItem subclasses, like
QGraphicsPixmapItem<http://qt-project.org/doc/qt-4.8/qgraphicspixmapitem.html>

While QGraphics does support a concept called "proxy widgets", which let
you put normal QWidgets into a QGraphics scene, they should be avoided for
performance reasons. That suggestion even comes from Qt core dev. It was
put there as a convenience, but if you use it, then you are kind of making
it pointless to really use QGraphics.


>
>
> Sorry about the confusion but given how big the documentation is, I want
> to make sure that I'm looking at the correct elements to get the whole
> thing working.
>
> Cheers
>
>
> --
> David Martinez - Technical Animator
>
> Email: [email protected]
> Website: http://www.elusiveideas.com
>
>
>
>
> On Mon, Mar 24, 2014 at 6:48 PM, Justin Israel <[email protected]>wrote:
>
>> Did you need to do a QGraphics approach or was this just an experiment
>> after I mentioned I was doing it? Technically it will work as QWidget, but
>> can end up being more performant as QGraphics if you use a ton of images.
>>
>> Porting the flow layout is basically just converting it to be a subclass
>> of QGraphicsLayout which has some slightly different concepts when it comes
>> to the geometry. But it is the same in terms of what it functions as.
>> Layouts don't inherently have any visual representation. They just manage
>> the size and position of the items assigned to it. So it wouldn't be
>> considered a view. Just like in QWidgets, you still have to add the layout
>> to the parent widget for which it will conform all the child widgets.
>> In a QGraphics setup, you have a QGraphicsView which looks into a
>> QGraphicsScene (the model) to view all of the items. Layouts aren't
>> actually part of the core concepts. They are something you can use if you
>> are using QGraphicsWidgets, which support a mixture of graphics items a
>> qwidget concepts.
>>  On Mar 25, 2014 3:51 AM, "David Martinez" <[email protected]>
>> wrote:
>>
>>>  I think that I'm getting rather confused when it comes to port the
>>> class.
>>>
>>>
>>>
>>> As far as I know, when we deal with graphic elements we need both a
>>> 'Scene' (data) and a 'View' (what displays data). When we inherit from
>>> QGraphicsLayout, what we are creating is a 'Layout', right? Does that mean
>>> that the resulting class is going to be our view class?  Could you explain
>>> how the different elements relate to each other? This is the first time
>>> that I deal with graphic elements. All what I've done so far were regular
>>> widgets.
>>>
>>>
>>>
>>> Many thanks
>>>
>>>
>>> --
>>> David Martinez - Technical Animator
>>>
>>> Email: [email protected]
>>> Website: http://www.elusiveideas.com
>>>
>>>
>>>
>>>
>>> On Thu, Mar 20, 2014 at 12:52 AM, Justin Israel 
>>> <[email protected]>wrote:
>>>
>>>> @David, my implementation was a direct port of the example
>>>> flowlayout.py from a QLayout -> QGraphicsLayout so that I could use it in a
>>>> QGraphicsScene. I do all of my image result listing there instead of a
>>>> QWidget system
>>>>
>>>>
>>>> On Thu, Mar 20, 2014 at 12:16 PM, David Martinez <
>>>> [email protected]> wrote:
>>>>
>>>>> Thanks for the heads up Fredik
>>>>> I will take a look    :-)
>>>>>
>>>>>
>>>>> --
>>>>> David Martinez - Technical Animator
>>>>>
>>>>> Email: [email protected]
>>>>> Website: http://www.elusiveideas.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Mar 19, 2014 at 10:31 PM, Fredrik Averpil <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> +1 for flowlayout
>>>>>>
>>>>>> I have a side project which hasn't gotten a lot of attention lately
>>>>>> but you can see how I implemented it here:
>>>>>> https://github.com/fredrikaverpil/pyVFX-viewer
>>>>>>
>>>>>> // Fredrik
>>>>>>
>>>>>> --
>>>>>> 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/CAD%3DwhWM3bV7irujE9P4jcWnJ31bCfg%2BaJuuainNz%2BQjVW3qKWA%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWM3bV7irujE9P4jcWnJ31bCfg%2BaJuuainNz%2BQjVW3qKWA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>  --
>>>>> 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/CAMLeNpzcVbrWco%2B5-%2BsHXijmCX8RmWAyTiB-6z-_519pGh8_mQ%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAMLeNpzcVbrWco%2B5-%2BsHXijmCX8RmWAyTiB-6z-_519pGh8_mQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>  --
>>>> 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/CAPGFgA2J9AkmOAKjvJKvyiHzZEaAiUAeLpf%2BhSF55Fdz5CqAZg%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2J9AkmOAKjvJKvyiHzZEaAiUAeLpf%2BhSF55Fdz5CqAZg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>  --
>>> 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/CAMLeNpzMRae5Kw4wiO7wPydmSgcLGyhSOLas4i2rosUJR%2B6PBA%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAMLeNpzMRae5Kw4wiO7wPydmSgcLGyhSOLas4i2rosUJR%2B6PBA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>  --
>> 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/CAPGFgA0nQSYRqNuFj%2B0Q34uccxmH4gaKn5nXBsUt98vTRPc6Og%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0nQSYRqNuFj%2B0Q34uccxmH4gaKn5nXBsUt98vTRPc6Og%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> 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/CAMLeNpxbJBthXRJiip38hzZ6nXnRby%3DL9%2BdBq8ORb7povw-NZA%40mail.gmail.com<https://groups.google.com/d/msgid/python_inside_maya/CAMLeNpxbJBthXRJiip38hzZ6nXnRby%3DL9%2BdBq8ORb7povw-NZA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPGFgA1X3_-QoBn7TKtU_m7UhLfKEmygHcxzzgCBNABepH-NAQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to