Results 1 to 16 of 16

Thread: Continuous wave Drawing

  1. #1
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Continuous wave Drawing

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Continuous wave Drawing

    By reimplementing the widget's paintEvent() and using QPainter API to draw.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Quote Originally Posted by wysota View Post
    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.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Continuous wave Drawing

    Apparently you did something wrong. Hard to say what without seeing any of your code.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Continuous wave Drawing

    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,
    _

  6. #6
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Kindly let me know in my case it's recommended in qt to draw wave in label or have any alternate solution?

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Continuous wave Drawing

    Quote Originally Posted by Girish1483 View Post
    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.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #8
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Thanks both of you..It's working now

  9. #9
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    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.
    Attached Files Attached Files
    Last edited by Girish1483; 31st January 2014 at 09:57. Reason: updated contents

  10. #10
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Hi experts,
    Kindly do the needfull for the same.

  11. #11
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Continuous wave Drawing

    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.
    _

  12. #12
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Hi anda_skoa,
    Kindly let me know the solution for smooth drawing in same code.

  13. #13
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Continuous wave Drawing

    I have no idea what you mean, the drawing seems to work fine.

    Cheers,
    _

  14. #14
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Quote Originally Posted by anda_skoa View Post
    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.
    Attached Files Attached Files
    Last edited by Girish1483; 10th February 2014 at 09:24.

  15. #15
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Continuous wave Drawing

    Quote Originally Posted by Girish1483 View Post
    I used QImage for drawing wave.Mouse clicked not working on button but keyboard event working.
    I already answered that one in comment #11.

    Quote Originally Posted by Girish1483 View Post
    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,
    _

  16. #16
    Join Date
    Sep 2013
    Posts
    14
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows Android

    Default Re: Continuous wave Drawing

    Quote Originally Posted by anda_skoa View Post
    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.

Similar Threads

  1. Generating continuous wave (sine/cos)
    By mind_freak in forum Qwt
    Replies: 1
    Last Post: 21st August 2012, 12:47
  2. QGLWidget tilts on continuous resize ?
    By tonnot in forum Qt Programming
    Replies: 1
    Last Post: 5th August 2011, 03:04
  3. CONTINUOUS PDF page problem
    By xiangxw in forum Qt Programming
    Replies: 1
    Last Post: 20th July 2011, 12:05
  4. create non continuous vertical bar
    By bibhukalyana in forum Qt Programming
    Replies: 3
    Last Post: 9th May 2011, 11:35
  5. Continuous Printing
    By Prabha in forum General Discussion
    Replies: 0
    Last Post: 28th July 2010, 11:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.