Results 1 to 20 of 27

Thread: no compile error, error on run

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2007
    Posts
    117
    Thanks
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default no compile error, error on run

    I can compile my project with no error, but a windows error (send report, end task) suddenly appears when the program executes this function.

    By the way, I am trying to resize a loaded Image to the scene's size keeping the image's aspect ratio. any other suggestions would be nice.

    Qt Code:
    1. void MainWindow::loadGraphicsViewParameter(QGraphicsView *graphicsView)
    2. {
    3. QString fileName = QFileDialog::getOpenFileName(this,
    4. tr("Open Image"), QDir::currentPath());
    5. if (!fileName.isEmpty())
    6. {
    7. QImage tempImage(fileName);
    8. if (tempImage.isNull())
    9. {
    10. QMessageBox::information(this, tr("Load Warning"),
    11. tr("Cannot load %1.").arg(fileName));
    12. return;
    13. }
    14. QImage image = tempImage.convertToFormat(QImage::Format_ARGB32);
    15. QGraphicsScene* viewScene = graphicsView->scene();
    16. QPixmap pixmap = QPixmap::fromImage(image);
    17.  
    18. scene->addPixmap(pixmap.scaled(QSize((int)viewScene->width(), (int)viewScene->height()), Qt::KeepAspectRatio, Qt::SmoothTransformation));
    19.  
    20. qDebug() << "Width = " << viewScene->width();
    21. qDebug() << "Height = " << viewScene->height();
    22.  
    23. graphicsView->setScene(scene);
    24. graphicsView->show();
    25. }
    26. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by sincnarf; 18th September 2007 at 07:43. Reason: insufficient info
    Image Analysis Development Framework Using Qt (IADFUQ)

Similar Threads

  1. Use VC2005 to compile Qt program (4.3.0)
    By firegun9 in forum Qt Programming
    Replies: 3
    Last Post: 8th June 2007, 16:04
  2. Qt-4.2.2 qmake won't compile under visual studio 2005 on vista
    By moowy in forum Installation and Deployment
    Replies: 7
    Last Post: 13th January 2007, 21:06
  3. Compile Errors
    By luffy27 in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 05:26
  4. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 19:15
  5. Can't Compile Tutorial 7
    By Reenen in forum Newbie
    Replies: 10
    Last Post: 9th February 2006, 14:06

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.