Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. setting the axis location
Forum Update on Tuesday, May 27th 2025

setting the axis location

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 502 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vidisha
    wrote on 29 Sept 2015, 10:23 last edited by
    #1

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

    M 1 Reply Last reply 29 Sept 2015, 15:06
    0
    • V vidisha
      29 Sept 2015, 10:23

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

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 29 Sept 2015, 15:06 last edited by
      #2

      @vidisha
      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.setRenderHint(QPainter::Antialiasing);
         p.setPen(QPen(Qt::black, 12, Qt::DashDotLine, Qt::RoundCap));
         p.drawLine(0, 0, 200, 200);
         p.end(); // Don't forget this line!
         l.setPicture(pi);
         l.show();
         return a.exec();
      }
      
      1 Reply Last reply
      0

      1/2

      29 Sept 2015, 10:23

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved