Qt-interest Archive, April 2007
Qline query
Message 1 in thread
Hi,
I do not see a function like resize() or stretch() for a QLine class.
I want to create a line such that the end point of the line follows the
mouse movement.
Hence I need to move the endpoint of the line on MouseMove.
Would anyone point to the correct approach or API to do this ?
Thnx
Prateek
Message 2 in thread
Hi,
> I do not see a function like resize() or stretch() for a QLine class.
> I want to create a line such that the end point of the line follows the
> mouse movement.
Just create a new QLine.
--
[ signature omitted ]
Message 3 in thread
Yes. That works, but isnt it too expensive an operation to do ?
On every mouse move, I will delete the old line and create a new one ...
--Prateek
-----Original Message-----
From: Dimitri [mailto:dimitri@xxxxxxxxxxxxx]
Sent: Monday, April 09, 2007 9:41 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Qline query
Hi,
> I do not see a function like resize() or stretch() for a QLine class.
> I want to create a line such that the end point of the line follows
> the mouse movement.
Just create a new QLine.
--
[ signature omitted ]
Message 4 in thread
Hi,
> Yes. That works, but isnt it too expensive an operation to do ?
> On every mouse move, I will delete the old line and create a new one ...
That could be expensive if using new/delete, but that shouldn't be
necessary.
Could you explain the context in more detail? Why do you need to modify
a QLine at such high rate? We should be able to provide an alternative.
It could be that the QLine API lacks some functions, but it would be
nice to learn about the context first, before suggesting sending a
feature request to Trolltech.
--
[ signature omitted ]
Message 5 in thread
Hi Dimitri,
I am creating a circuit board desgner sort of an application.
There are various geometries on the canvas, and to connect then the user
selects teh connector, the connector(QLine) follows the mouse and the
endpoint
is reached when the user clicks.
To do this, I remove the QGraphicsLineItem from QGraphicsView and then
add again with the new position of mouse.
So on every mouse move I remove and add QGraphicsLineItem from
QGraphicsView. This seems to be an expensive
way of doing this.
Is there a better solution ?
Thnx
Prateek
-----Original Message-----
From: Dimitri [mailto:dimitri@xxxxxxxxxxxxx]
Sent: Tuesday, April 10, 2007 11:11 PM
To: qt-interest@xxxxxxxxxxxxx
Subject: Re: Qline query
Hi,
> Yes. That works, but isnt it too expensive an operation to do ?
> On every mouse move, I will delete the old line and create a new one
...
That could be expensive if using new/delete, but that shouldn't be
necessary.
Could you explain the context in more detail? Why do you need to modify
a QLine at such high rate? We should be able to provide an alternative.
It could be that the QLine API lacks some functions, but it would be
nice to learn about the context first, before suggesting sending a
feature request to Trolltech.
--
[ signature omitted ]
Message 6 in thread
Instead of re-creating the line each time the mouse moves, simply call
QGraphicsLineItem::setLine
Prateek Tiwari wrote:
> Hi Dimitri,
>
> I am creating a circuit board desgner sort of an application.
> There are various geometries on the canvas, and to connect then the user
>
> selects teh connector, the connector(QLine) follows the mouse and the
> endpoint
> is reached when the user clicks.
>
> To do this, I remove the QGraphicsLineItem from QGraphicsView and then
> add again with the new position of mouse.
> So on every mouse move I remove and add QGraphicsLineItem from
> QGraphicsView. This seems to be an expensive
> way of doing this.
>
> Is there a better solution ?
>
> Thnx
> Prateek
>
> -----Original Message-----
> From: Dimitri [mailto:dimitri@xxxxxxxxxxxxx]
> Sent: Tuesday, April 10, 2007 11:11 PM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Re: Qline query
>
> Hi,
>
>
>> Yes. That works, but isnt it too expensive an operation to do ?
>> On every mouse move, I will delete the old line and create a new one
>>
> ...
>
> That could be expensive if using new/delete, but that shouldn't be
> necessary.
>
> Could you explain the context in more detail? Why do you need to modify
> a QLine at such high rate? We should be able to provide an alternative.
>
> It could be that the QLine API lacks some functions, but it would be
> nice to learn about the context first, before suggesting sending a
> feature request to Trolltech.
>
> --
> Dimitri
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
--
[ signature omitted ]