Results 1 to 4 of 4

Thread: Sliders to print a point on a 2D screen

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2010
    Posts
    17
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Sliders to print a point on a 2D screen

    Hello everybody

    i'll explain my problem:
    i make 2 sliders which give a position in function of 2 axes


    MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    ...
    ui->horizontalSlider->setRange(0,431);
    ui->verticalSlider->setRange(0,401);
    connect(ui->horizontalSlider, SIGNAL(valueChanged(int)),ui->lcdNumber, SLOT(display(int)));
    connect(ui->verticalSlider, SIGNAL(valueChanged(int)),ui->lcdNumber_2, SLOT(display(int)));


    i connect them to LCD to check values.

    for the screen, for the moment i just have that in an another file :

    Screen2DGL::Screen2DGL(){
    background = QBrush(QColor(Qt::black));
    }

    void Screen2DGL:aint(QPainter *painter, QPaintEvent *event){
    painter->fillRect(event->rect(), background);
    painter->setPen(Qt::white);
    painter->drawPoint(200,200);
    }



    i would like to print a point with the coordinates gaven by the sliders instead of "200, 200" on a 2D screen...
    How can i do?
    Last edited by valy12; 13th May 2010 at 18:14.

Similar Threads

  1. Print screen key in Qt windows
    By hanumanth in forum Qt Programming
    Replies: 2
    Last Post: 16th April 2010, 15:44
  2. Replies: 1
    Last Post: 3rd December 2009, 14:23
  3. Cancelling Long-running Print/Print Preview
    By ChrisW67 in forum Newbie
    Replies: 4
    Last Post: 16th June 2009, 23:05
  4. display a plot point by point
    By oswalidos in forum Newbie
    Replies: 32
    Last Post: 13th March 2009, 15:37
  5. Point to Pixel Calculation on all screen
    By patrik08 in forum General Programming
    Replies: 0
    Last Post: 3rd April 2008, 08:10

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.