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 8206177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:34:53+00:00 2026-06-07T08:34:53+00:00

My problem is that when I’m setting values to QPointF, I get strange values

  • 0

My problem is that when I’m setting values to QPointF, I get strange values like 1.32841e+09 when I check what they really are.
I’m not getting those values when I print it out on the sixth line in the while-loop.

void MainView::showAllGraphs(){
     QMapIterator<QString, QRectF> i(graphRectangles);
     QPointF topLeft;
     QPointF bottomRight;
     QRectF maxRect;
while (i.hasNext()) {
     i.next();
     qreal tlX = i.value().topLeft().x();
     qreal tlY = i.value().topLeft().y();
     qreal brX = i.value().bottomRight().x();
     qreal brY = i.value().bottomRight().y();
     QTextStream(stdout) << tlY << " " << brY << endl;
     if(tlY < topLeft.y()){
         topLeft.setY(tlY);
         topLeft.setX(tlX);
     }
     if(brY > bottomRight.y()){
         bottomRight.setY(brY);
         bottomRight.setX(brX);
     }
}
maxRect.setTopLeft(topLeft);
maxRect.setBottomRight(bottomRight);
QTextStream(stdout) << topLeft.y() << " x " << topLeft.y() << endl;
graphicsScene>setSceneRect(maxRect);
graphicsView->fitInView(maxRect);
matrixUpdated(graphicsView->matrix());
}

With the first print, I get values between -100 and 100 (which is valid). When I print out at the end I suddenly get a value like 2.45841e+09 or sometimes 0. I don’t want it to change to that.

So what is the reason for this change in value? I can’t figure out why it is set to a value like that.

  • 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-07T08:34:54+00:00Added an answer on June 7, 2026 at 8:34 am

    topLeft is not initialized.

    You only assign a value to topLeft(or bottomRight) if your conditions are met. So make sure to initialize your rectangle to sensible values which allow meaningful comparisons in your if statements.

    Furthermore, topLeft is not changed as you assume. In the while loop, you print the elements of the map (tl and br), not (the uninitialized) topLeft that you print after the while-loop. That’s why you get different results.

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

Sidebar

Related Questions

I have a problem that I have not managed to solve. I developed a
Strange problem that just starting to happen on a SL/WCF RIA Services project that
I have a strange problem that I've never encountered before, I have data in
The problem that I am having is that my values aren't coming through with
I have a Java problem that involves reading a text file and check that
I have a problem that I have not seen addressed in this particular way
Simple problem that I can't figure out... How can I print a '%' character
The problem that I have is somehow very specific. I have to implement a
I have a problem that I'm working on for quite some time now. I
Here is a problem that has been bothering me a lot about Python, I

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.