Results 1 to 13 of 13

Thread: Drawing a graphic?

  1. #1
    Join Date
    Nov 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Question Drawing a graphic?

    Hi everybody,

    I'm new at qt, so i have some questions.

    i have a double array and it occurs 10 or 15 numbers. How can I draw a number line graphic according to these numbers? Which can i use components or objects? Do you know any examples about it? i didn't find an example exactly in internet.

    Thanks

  2. #2
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    518
    Thanks
    13
    Thanked 77 Times in 75 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drawing a graphic?

    Hi, I'm not sure what you mean, so two interpretations:
    - use QLCDWidget to show the numbers
    - use QGraphicsView and friends to draw what you like.

    Ginsengelf

  3. #3
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drawing a graphic?

    If you need technical graphics then there is qwt - but do some training in qt itself first

  4. #4
    Join Date
    Nov 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drawing a graphic?

    Thanks for replies.

    I want a number line like that:
    quadraticdemo.png

    Is there any source code example or full project? I just want a graphic with 10 or 15 numbers.

  5. #5
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drawing a graphic?

    I don't know whether there is a piece of source code available but your picture is exactly what qwt knows. Try google, search "qwt" and see.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Drawing a graphic?

    Or you could use QCustomPlot, which drew that graph in the first place. It is a GPL release: http://www.qcustomplot.com
    "We can't solve problems by using the same kind of thinking we used when we created them." -- Einstein
    If you are posting code then please use [code] [/code] tags around it - makes addressing the problem easier.

  7. #7
    Join Date
    Nov 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drawing a graphic?

    Quote Originally Posted by ChrisW67 View Post
    Or you could use QCustomPlot, which drew that graph in the first place. It is a GPL release: http://www.qcustomplot.com
    I tried this example but it didn't work: http://codingexodus.blogspot.com/201...-with-qwt.html

    No example doesn't work in my pc !!


    Added after 1 22 minutes:


    I found that example: http://doc.qt.digia.com/QtCharts/qt-...t-example.html

    But i can't use it. Because i can't find these libraries: #include <QChartView> #include <QLineSeries> . Help pls
    Last edited by ImNoob; 26th November 2013 at 09:31.

  8. #8
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drawing a graphic?

    What did not work on the blogspot example? The example seems to be enough simple.

    Try not to use '-L' and '-l' when specifying the qwt library. I have a better experience with specifying libraries directly. With Linux it should be
    Qt Code:
    1. LIBS += /usr/local/qwt-6.1.0-rc3/lib/qwt.so
    To copy to clipboard, switch view to plain text mode 
    With winblows it should be
    Qt Code:
    1. LIBS += C:\path\qwt.lib
    To copy to clipboard, switch view to plain text mode 

    Beware of prefixes! Instead of qwt.so, you can have libqwt.so and so on. If you have libqwt.so then
    Qt Code:
    1. LIBS += /usr/local/qwt-6.1.0-rc3/lib/libqwt.so
    To copy to clipboard, switch view to plain text mode 
    Check with your file manager. Also, with winblows, you should have both LIB and DLL. You link with the LIB and the DLL must be on your PATH.

  9. #9
    Join Date
    Nov 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drawing a graphic?

    Quote Originally Posted by Radek View Post
    What did not work on the blogspot example? The example seems to be enough simple.

    Try not to use '-L' and '-l' when specifying the qwt library. I have a better experience with specifying libraries directly. With Linux it should be
    Qt Code:
    1. LIBS += /usr/local/qwt-6.1.0-rc3/lib/qwt.so
    To copy to clipboard, switch view to plain text mode 
    With winblows it should be
    Qt Code:
    1. LIBS += C:\path\qwt.lib
    To copy to clipboard, switch view to plain text mode 

    Beware of prefixes! Instead of qwt.so, you can have libqwt.so and so on. If you have libqwt.so then
    Qt Code:
    1. LIBS += /usr/local/qwt-6.1.0-rc3/lib/libqwt.so
    To copy to clipboard, switch view to plain text mode 
    Check with your file manager. Also, with winblows, you should have both LIB and DLL. You link with the LIB and the DLL must be on your PATH.
    Thanks Radek I added qwt_plot.h header file but i have this error: 'qwt_plot.h':no such file or directory

    (i am using windows os)


    I found this example: http://doc.qt.digia.com/QtCharts/qt-...t-example.html

    But where are these files:
    #include <QChartView>
    #include <QLineSeries>

    And what is that: QTCOMMERCIALCHART_USE_NAMESPACE
    Last edited by ImNoob; 26th November 2013 at 17:40.

  10. #10
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drawing a graphic?

    Either you do not have headers at all (you have installed a "runtime", not a "development package") or your headers aren't at your local INCLUDE. Check with your file manager where are your headers, you can search "qwt_plot.h". Update INCLUDEPATH in your PRO file.

  11. #11
    Join Date
    Nov 2013
    Posts
    5
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Drawing a graphic?

    Quote Originally Posted by Radek View Post
    Either you do not have headers at all (you have installed a "runtime", not a "development package") or your headers aren't at your local INCLUDE. Check with your file manager where are your headers, you can search "qwt_plot.h". Update INCLUDEPATH in your PRO file.
    I did all that you wrote. On the other hand i haven't these files:
    #include <qwt_plot_curve.h>
    #include <qwt_plot_grid.h>

    But i have #include <qwt_curve.h> #include <qwt_grid.h>

  12. #12
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Drawing a graphic?

    qwt_plot_curve.h and qwt_curve.h seem to be almost the same headers. The same can be said for other "plot" and "no plot" headers. I have found "no plot" headers in qwt4 while the "plot" headers are in qwt6. It's a matter of versioning.

    Try to replace missing "plot" headers with "no plot" ones and see. You need not pass, the headers aren't identical. Four your reference, there are links to sources (including headers) of qwt 4.2 and qwt 6.1:

    qwt 4.2, "no plot": ftp://ftp-lcd.slac.stanford.edu/glas...tml/index.html
    qwt 6.1 "plot": http://qwt.sourceforge.net/dir_9ccb3...0bc8a6a19.html

    My apologies for your problems. I did not imagine that newer qwt is so inconsistent with older versions

  13. #13
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,325
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Drawing a graphic?

    Quote Originally Posted by Radek View Post
    My apologies for your problems. I did not imagine that newer qwt is so inconsistent with older versions
    Come on: Qwt 4.x is from 2004 - written for Qt 2.x !

    Uwe

Similar Threads

  1. QtQuick2.0 and Graphic Card
    By alizadeh91 in forum Qt Programming
    Replies: 3
    Last Post: 6th April 2013, 16:09
  2. Graphic by Qwt in a QGraphicsView
    By ChoCChoK in forum Qwt
    Replies: 3
    Last Post: 16th March 2011, 22:00
  3. Reshape graphic items
    By jsmith in forum Qt Programming
    Replies: 3
    Last Post: 31st July 2009, 07:46
  4. QLabel to scale a graphic
    By Scorp2us in forum Qt Programming
    Replies: 1
    Last Post: 17th March 2009, 05:55
  5. Graphic evaluation
    By jd in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2008, 14:46

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
  •  
Qt is a trademark of The Qt Company.