setting the axis location

  • Hello...i am new to QT ..i want to plot a graph with x axis and y axis to be at origin so plz can one suggest how to do it...

  • Qt Champions 2016

    Hi and welcome
    A simple line could be drawn like this.

    #include <QApplication>
    #include <QLabel>
    #include <QPicture>
    #include <QPainter>
    int main(int argc, char *argv[])
       QApplication a(argc, argv);
       QLabel l;
       QPicture pi;
       QPainter p(&pi);
       p.setPen(QPen(Qt::black, 12, Qt::DashDotLine, Qt::RoundCap));
       p.drawLine(0, 0, 200, 200);
       p.end(); // Don't forget this line!
       return a.exec();

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.