Results 1 to 12 of 12

Thread: can the image be displayed as it is in chips prog..

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2008
    Posts
    52
    Qt products
    Qt4
    Platforms
    Windows

    Default can the image be displayed as it is in chips prog..

    Can somebody please tell me if the image can be displayed as it is in chips program.Here image is displayed as chips instead of the original image.After doing zoom-out the original image appears.The chip program's path is:\Qt\4.4.3\demos\chip.The code is :
    void MainWindow::populateScene()
    {
    scene = new QGraphicsScene;

    QImage image(":/img_2.png");

    // Populate scene
    int xx = 0;
    int nitems = 0;
    for ([color=blue]int i = -11000; i < 11000; i += 110) {
    ++xx;
    int yy = 0;
    for (int j = -7000; j < 7000; j += 70) {
    ++yy;
    qreal x = (i + 11000) / 22000.0;
    qreal y = (j + 7000) / 14000.0;

    QColor color (image.pixel (int (image.width () * x), int (image.height () * y)));
    QGraphicsItem *item = new Chip(color, xx, yy);
    item->setPos(QPointF(i, j));
    scene->addItem(item);

    ++nitems;
    }
    }
    }
    Last edited by sh123; 3rd February 2009 at 11:56. Reason: reformatted to look better

Similar Threads

  1. QSlider custom handle image not displayed
    By planglois in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2008, 13:49
  2. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  3. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  4. no image displayed on QGraphicsView
    By sincnarf in forum Qt Programming
    Replies: 9
    Last Post: 28th June 2007, 12:33
  5. JPEG Image isn't displayed!?
    By GodOfWar in forum Qt Programming
    Replies: 9
    Last Post: 16th April 2007, 15:01

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.