Well, here is the basic example of how it looks the test code: graphic_View_TEST.png
I use QLabel but with setText() and using HTML code, so I can display both Pixmap and Text
Cheers.
Well, here is the basic example of how it looks the test code: graphic_View_TEST.png
I use QLabel but with setText() and using HTML code, so I can display both Pixmap and Text
Cheers.
Gustavo A. DÃ*az
artistic.gdnet.com.ar
Santosh Reddy: I have another dub: in this example I've subclassed QLabel, to implemente a focus "effect" (by using focusInEvent and focusOutEvent event, and stylesheet to change border color when selected). Now, how i do select multiple items/widgets in QGraphicsView?
Thanks.
Gustavo A. DÃ*az
artistic.gdnet.com.ar
Set QGraphicsItem::ItemIsSelectable flag for the QGraphicsWidget (subclassed QLabel). Note that you will have to draw the selection rectangle explicitly.
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
Yeah, already applied that flag (Python):
And for the subclassed QLabel, for focus i've added:graphicItem.setFlags(QGraphicsItem.ItemIsFocusable | QGraphicsItem.ItemIsSelectable)
This last one, would be a problem for selecting more than one QLabel/widget at time? or is something that i must handle from QGraphicsView itself?def focusInEvent(self, event):
self.focusState.emit(True)
self.setStyleSheet("QLabel{background-color: transparent; border: 2px solid #90b6e2; border-radius: 5px;}")
return QLabel.focusInEvent(self, event)
def focusOutEvent(self, event):
self.focusState.emit(False)
self.setStyleSheet("QLabel{background-color: transparent; border: 2px solid transparent; border-radius: 5px;}")
return QLabel.focusInEvent(self, event)
Gustavo A. DÃ*az
artistic.gdnet.com.ar
Bookmarks