PDA

View Full Version : lineedit in qpainter



Devoraz
31st July 2009, 03:50
hi, how can i create a lineedit in the below void?


void QGraphicsItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )

spirit
31st July 2009, 06:37
creation widget in paint method it's worth, since that method is called many times (memory leaks can occur) and that will influence on an application performance. it's better to create widgets in ctors.

wagmare
31st July 2009, 07:05
creation widget in paint method it's worth, since that method is called many times (memory leaks can occur) and that will influence on an application performance. it's better to create widgets in ctors.

but why we cant paint our own paint item to get any input from the user ...?
every time we have to derive any input widget like QLineEdit or textEdit()

spirit
31st July 2009, 07:07
for taking input you can use QGraphicsProxyWidget.

wagmare
31st July 2009, 07:27
ya thanks ... but there also we use only our input widgets ... my point is did Qt gives us any option for making our item get input interface ... other than using QLineEdit() or like that

nish
31st July 2009, 07:52
did Qt gives us any option for making our item get input interface ... other than using QLineEdit() or like that
you are confusing yourself. Qt only gives one widget that is QWidget. All the other widgets are made by inheriting QWidget and reimplementing the paint, mouse, keyboard events. you can very well design your own custom widget which could accept input.

Devoraz
3rd August 2009, 04:02
i place the QGraphicsProxyWidget in the paint()?

or create a void for QGraphicsProxyWidget?

Devoraz
4th August 2009, 01:49
am i right? if not can someone enlighten me? thanks

profoX
4th August 2009, 10:54
Can you explain what it is that you want to accomplish exactly?

Devoraz
5th August 2009, 01:52
Can you explain what it is that you want to accomplish exactly?

i had attached an image of it, i wanna place the lineedit in the rect of the node. the node is drawn using qpainter.