PDA

View Full Version : background color for qgraphicstextitem



sanku
15th September 2010, 12:57
Hi,

I want to know if its possible to add background color for graphicstextitem, like in this url

http://doc.trolltech.com/4.3/qgraphicstextitem.html
the work "text editor"
foreground/textcolor is in 'black' and background 'blue'

I have code working for foreground color which was direct to set setDefaultTextColor but no luck for background color.


class graphicsTextitem(QtGui.QGraphicsTextItem):
def __init__(self,name):
QtGui.QGraphicsTextItem.__init__(self,name)

class layout_scene(QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.graphicsScene = QtGui.QGraphicsScene(self)
qgraphicsText = graphicsTextitem("Textbackground")
qgraphicsText .setPos(100,100)
qgraphicsText .setDefaultTextColor(QColor("blue"))
qgraphicsText .setFlag(QtGui.QGraphicsItem.ItemIsSelectable)
self.graphicsScene.addItem(qgraphicsText)
view = QtGui.QGraphicsView(self.graphicsScene)


2. Also can someone direct me for python based qt programming for node-edge example for connecting text with arrow lines so that when text is moved its associated lines moves along

Thanking you in advance