Results 1 to 8 of 8

Thread: width()

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default width()

    hi, I put at begin of paintGL that code but print strange things.......

    Qt Code:
    1. cout << " size.width() " << size().width() << " " << " size.height() " << size().height() << endl;
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. // at start of app
    2. size.width() 101 size.height() 31
    3. paintGL
    4. size.width() 101 size.height() 31
    5. paintGL
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. //after a rotation or traslation
    2. size.width() 320 size.height() 340
    3. paintGL
    4. size.width() 447 size.height() 363
    5. paintGL
    To copy to clipboard, switch view to plain text mode 
    why this change of values printed?? thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: width()

    What is "size"? What gets rotated and translated? What is the rotation?

  3. #3
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: width()

    we are inside paintGL so size is the member of myWidgetGL; doesn't important what rotate do...but it's called with mouseMove+mousedown and it call an update().....when update is called I can see change value of size().width() change (the value printed from cout in PaintGL() )...........then: at start app I see some values of width() end height(); when I call update these values changed.... (I don't resize the app....)
    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: width()

    Are those initial values correct? Remember that widgets show an incorrect size before show() is called for the first time. And when those values change, does the widget actually get resized? The changes are significant, so you'd surely notice that. Which values are correct?

  5. #5
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: width()

    correct are:
    size.width() 447 size.height() 363 I put it inside resizeGL and see it....)
    but the widget isn't resize when value correct appear...I don't see it....
    Regards

  6. #6
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: width()

    ok my app start with wrong width() and hieght() values.....to see correct values I need to dragging corner app and so call resizeGL. Why? can I force th resizeGL() call? thanks
    Regards

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: width()

    I think I already told you why...

    Quote Originally Posted by wysota
    Remember that widgets show an incorrect size before show() is called for the first time.

  8. #8
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: width()

    thanks its ok. in fact I have a widget that is in a tab page don't sown at startUP and its values are 1, 29.....
    Regards

Similar Threads

  1. Change column width in a QTreeWidget
    By mace in forum Qt Programming
    Replies: 2
    Last Post: 27th May 2006, 13:19
  2. QTable column stretchable with minimum Width
    By sunil.thaha in forum Qt Programming
    Replies: 0
    Last Post: 24th April 2006, 14:17
  3. width()
    By mickey in forum Newbie
    Replies: 1
    Last Post: 1st April 2006, 01:34
  4. How to get size (length, width ....) of string or char
    By Krishnacins in forum Qt Programming
    Replies: 1
    Last Post: 20th March 2006, 10:55
  5. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 23:34

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.