PDA

View Full Version : Continuous wave Drawing



Girish1483
25th January 2014, 07:51
Hi,
I am using Qt5.2 & QtCreator 3, and my class in inherit from QDialog having some widget(ie push button) which open other dialog.
How to draw continuous infinite line in main Dialog which should not be effected if we pressed any push button.

wysota
25th January 2014, 10:08
By reimplementing the widget's paintEvent() and using QPainter API to draw.

Girish1483
25th January 2014, 11:12
By reimplementing the widget's paintEvent() and using QPainter API to draw.

Hi wysota thaks for reply,
I had create a label & start drawing infinite wave (or line in Round Robin manner) on it.In the mean time if i clicked on push button for open a new dialog wave stuck till dialog open (i.e ~ 1 sec).Kindly let me know the solution.

wysota
25th January 2014, 13:01
Apparently you did something wrong. Hard to say what without seeing any of your code.

anda_skoa
25th January 2014, 16:19
Maybe the dialog's construction takes considerable time and occupies the main thread too long.

You could try creating the dialog at startup or before showing the main UI and then show/exec the already existing dialog instance when needed.

Cheers,
_

Girish1483
26th January 2014, 06:40
Kindly let me know in my case it's recommended in qt to draw wave in label or have any alternate solution?

wysota
27th January 2014, 21:41
Kindly let me know in my case it's recommended in qt to draw wave in label or have any alternate solution?

See post #2.

Girish1483
30th January 2014, 09:42
Thanks both of you..It's working now

Girish1483
31st January 2014, 10:40
Hi,
I am facing strange problem, I used QImage for drawing wave.Mouse clicked not working on button but keyboard event working.
On keyboard enter button click, wave stuck for a while.PFA & let me know the solution for smooth drawing.

Girish1483
4th February 2014, 05:57
Hi experts,
Kindly do the needfull for the same.

anda_skoa
4th February 2014, 11:04
You are creating a layout for WaveDraw but forget to add the two frames that contain the buttons.

You are also lucky that QThread::msleep() is a static method, because WaveDraw::thread() returns the thread that owns the WaveDraw object, which is the main thread.

You do not have any synchronization on access to the data shared between the two threads.

Cheers.
_

Girish1483
4th February 2014, 12:10
Hi anda_skoa,
Kindly let me know the solution for smooth drawing in same code.

anda_skoa
4th February 2014, 13:15
I have no idea what you mean, the drawing seems to work fine.

Cheers,
_

Girish1483
10th February 2014, 07:00
I have no idea what you mean, the drawing seems to work fine.

Cheers,
_

Hi anda_skoa,
I used QImage for drawing wave.Mouse clicked not working on button but keyboard event working.
On keyboard enter button click, wave stuck for a while.Please find Attachment for updated WaveDraw.zip file.
I also used a separate thread class,problem is still remain same.Kindly let me know the solution for smooth drawing.

anda_skoa
10th February 2014, 10:34
I used QImage for drawing wave.Mouse clicked not working on button but keyboard event working.

I already answered that one in comment #11.



On keyboard enter button click, wave stuck for a while.

Worked for me. How long does it get stuck for you? What is your main thread doing while this is happening?

Cheers,
_

Girish1483
10th February 2014, 11:01
I already answered that one in comment #11.


Worked for me. How long does it get stuck for you? What is your main thread doing while this is happening?

Cheers,
_

Hi anda_skoa,
Kindly check new updated code which i attached above.Wave stuck till new dialog open.