×

Discussion Board

Results 1 to 5 of 5

Thread: Just curious

  1. #1
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Just curious

    I used contentsRect() to receive a QRect object, then used .height() to extract the height. Viewed in the debugger, the QRect is (8,8,352,220), but when I retrieve the height it's retrieved as 213.

    Not causing a problem -- just curious as to what's going on here.

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,800

    Re: Just curious

    Did you do anything special? I tried to do the same thing on a widget and a pushButton and it returned correct results.

    For example, the following returned 30. The rect() was (QRect) 100x30+0+0 in debug. Makes sense.
    Code:
    pushButton->setText(QString::number(pushButton->contentsRect().height()));
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Just curious

    Was it something like that?

    Code:
    QRect rect = object->contentsRect();
    qDebug() << rect;
    int height = rect.height();
    qDebug() << height;

  4. #4
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: Just curious

    Two assignments pretty much like that, and isolated from any other similar logic that might have confused things. I was viewing the values with the Carbide debugger, though.

    Here's the actual code:
    Code:
        QRect scrollWindowRect = ui ->mScrollWindow ->contentsRect();
        int scrollWindowHeight = scrollWindowRect.height();

  5. #5
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Just curious

    Quote Originally Posted by danhicksbyron View Post
    Two assignments pretty much like that, and isolated from any other similar logic that might have confused things. I was viewing the values with the Carbide debugger, though.

    Here's the actual code:
    Code:
        QRect scrollWindowRect = ui ->mScrollWindow ->contentsRect();
        int scrollWindowHeight = scrollWindowRect.height();
    It might be a problem of the Carbide debugger. You can verify it with qDebug.

Similar Threads

  1. Curious Function Declaration
    By leejx in forum Symbian
    Replies: 5
    Last Post: 2009-08-26, 03:37
  2. Curious about how open c/c++ is tested
    By fmcgeough in forum Open C/C++
    Replies: 3
    Last Post: 2009-06-11, 10:08
  3. Replies: 4
    Last Post: 2008-12-29, 07:40
  4. curious
    By deanjameswilding in forum General Messaging
    Replies: 1
    Last Post: 2008-07-16, 18:18
  5. Curious Benchmark
    By mushakk in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2004-03-03, 16:12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×