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]Display small image to cover all available space.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Display small image to cover all available space.

Scheduled Pinned Locked Moved General and Desktop
qgraphicsview
2 Posts 1 Posters 548 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.
  • ealioneE Offline
    ealioneE Offline
    ealione
    wrote on last edited by ealione
    #1

    I have a small, usually 8x8 image that I want to fit to my QGraphicsView.
    No matter how I resize my view the image should keep up and resize accordingly, so if for example I make my window fullscreen what I will see are 64 huge pixels.

    How can this be done?

    Side note: I know about fitInView but it seems that I can not use it correctly.

    1 Reply Last reply
    0
    • ealioneE Offline
      ealioneE Offline
      ealione
      wrote on last edited by
      #2

      After experimenting for a while

      view->fitInView(view->scene()->sceneRect(), Qt::KeepAspectRatio);

      does what I want.
      Using also view->setAlignment(Qt::AlignTop);
      creates the effect quite nicely

      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