So?
Sounds like a QGraphicsPixmapItem on top of a QGraphicsRetangleItem.
Or a custom item that paints a background and then the image
Cheers,
_
So?
Sounds like a QGraphicsPixmapItem on top of a QGraphicsRetangleItem.
Or a custom item that paints a background and then the image
Cheers,
_
Could you please give me a pseudo code or some example?
The graphics item framework allows you to create new items by either aggregating existing items or by implementing your own items directly.
For the first you could, for example, group a rectangle item and a pixmap item in a graphics item group, or using the rectangle item as the parent of the pixmap item.
For the latter, there is a simple example in the documentation of QGraphicsItem, basically providing a bounding rectangle and some custom painting.
The examples provided by in Qt's documentation have occurences of both approaches http://doc.qt.io/qt-5/examples-graphicsview.html
Cheers,
_
thank you anda_skoa but i didn't see any example for QGraphicsPixmapItem on top of a QGraphicsRetangleItem.
I am sorry, did you expect that any of the examples would be miraculously have exactly the combined item you wanted instead of showing generically useful techniques?
Cheers,
_
no but i do not know know how to combine QGraphicsPixmapItem and QGraphicsRetangleItem. any example or pseudo code of how can i fix my problem would be helpful.
Last edited by Santa.fat; 26th October 2015 at 17:05.
Either by using a QGraphicsItemGroup (as already mentioned in comment #6) or by having both as children of a common parent, or by using the rectangle as the parent of the pixmap (as also already mentioned in comment #6)
Cheers,
_
dear anda_skoa this is my first time using QGraphicsView and i am a little bit confused. could you please give me pseudo code even in 5 lines of code.
thank you
hi.
could you please give me an example of how to arrange QGraphicsPixmapItem in QGraphicsScene vertically?
Using a rect item as a parent of a pixmap item
or with aggregationQt Code:
To copy to clipboard, switch view to plain text mode
or, as said earlier, using QGraphicsItemGroupQt Code:
{ QGraphicsPixmapItem *m_pixmap; public: { } }To copy to clipboard, switch view to plain text mode
Cheers,
_
Santa.fat (30th October 2015)
thank you.
can i set a fixed size for items? becuase i want set a fixed size for all of my items and then fill theme with pixmap.
another question is that how can i get the size of item after scaling?
Last edited by Santa.fat; 29th October 2015 at 19:03.
Bookmarks