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
Qt 6.11 is out! See what's new in the release blog

setting the axis location

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.1k 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 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...

    mrjjM 1 Reply Last reply
    0
    • V vidisha

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

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on 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

      • Login

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