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. [Solved]Can't show the image with default size after calling fitInView
Forum Updated to NodeBB v4.3 + New Features

[Solved]Can't show the image with default size after calling fitInView

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 909 Views 1 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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    Every time I load the pixmap, I will call

    @
    graph_pixmap_->setPixmap(QPixmap::fromImage(image));
    graph_scene_->setSceneRect(image.rect());
    @

    After I fit the pixmap into the view

    @
    graph_pixmap_->setPixmap(QPixmap::fromImage(image));
    graph_view_->fitInView(graph_pixmap_, Qt::KeepAspectRatio);
    @

    Then whatever every images I open wouldn't show the image with
    the original size of the image again.

    How could I ask the graph_view_ show the images by the original size again?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      I solved the problem
      @
      graph_pixmap_->setPixmap(QPixmap::fromImage(image));
      graph_scene_->setSceneRect(image.rect());
      graph_view_->resetMatrix(); //call this
      @

      because fitInView would change the matrix, so I should reset it every time I open
      the image, thanks

      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