Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8052441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:32:47+00:00 2026-06-05T07:32:47+00:00

Resolved. I’m creating a fullscreen app with C++ and Qt. In the screen l

  • 0

Resolved. I’m creating a fullscreen app with C++ and Qt. In the screen l have a graphicsScene (and a View for it) that takes out a section of the screen. l can’t figure out how to get the coordinates right.

l want the view size to match the size of the container. l can either create a view that is larger than the container so there are scrollbars (don’t want initially) but the point (0,0) is at the top-left corner (l want this) OR a view that is smaller but the point (0,0) is no longer in the top-left corner, there are ‘margins’. l want the (0,0) point to be top-left so l can programmatically draw a grid.

scene = new NoteMatrix(LayoutB2);
view = new QGraphicsView(scene);
scene->setSceneRect(0,0,view->frameSize().width(), view->frameSize().height());
view->fitInView(view->sceneRect());
view->setAlignment(Qt::AlignLeft);
scene->addRect(0, 0, scene->width(), scene->height()); //visualize boundaries
QWidget *widget = new QWidget(parent);
widget->setLayout(LayoutB2);
mainLayout->setStretchFactor(widget, 1);
setCentralWidget(widget);

I resolved my initial problem. There was nothing wrong with the coordinates. I need to set the alignment to whichever side l wish, in this scenario left.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:32:49+00:00Added an answer on June 5, 2026 at 7:32 am

    If you want to fit a scene in QGraphicsview

    view->setScene(YourScene);
    view->setSceneRect(0,0,view->frameSize().width(),view->frameSize().height());
    

    Use this for setting scene rect..If you set the rect with width and height less than or eaual to of views..No scroll bars will be displayed else it will.

    Try also QGraphicsView::fitInView().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: RESOLVED. Hio, So I can't figure out why this error is ocurring in
I resolved this issue myself. It turns out that the activation framework requires some
How can I resolved this error that I see in Gradle after upgrading to
I am creating a tickets opened vs resolved per week gadget that reports back
I need to have resource messages that contain EL expressions be resolved when loaded
While I have the problem itself seemingly resolved, I'm hoping someone can shed some
How can I get the resolved (<%%> resolved) view (aspx or ascx) in a
If I have a class that has a dependency that is resolved via property
I have an XML file (urlrewrite.xml) that needs a property placeholder resolved. I enable
With your help I have successfully resolved a question that I have asked here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.