QWidget geometry()
От: jobdead  
Дата: 14.10.10 09:53
Оценка:
Всем привет.

Использую qt 4.6.2 под windows. Внутри QWidget вызываю geometry(по нажатии кнопки), она возвращает QRect(900, 329, 1022, 392), пробую spy(из ms visual) показывает rectangle: (900, 329)(1023, 393). В чем прикол?

Спасибо.
Re: QWidget geometry()
От: vng Беларусь https://organicmaps.app/
Дата: 15.10.10 13:21
Оценка:
Здравствуйте, jobdead, Вы писали:

J>Всем привет.


J>Использую qt 4.6.2 под windows. Внутри QWidget вызываю geometry(по нажатии кнопки), она возвращает QRect(900, 329, 1022, 392), пробую spy(из ms visual) показывает rectangle: (900, 329)(1023, 393). В чем прикол?


J>Спасибо.


1. Не факт, что geometry должно совпадать с размером физического окна ОС.
2. Попробуй frameGeometry().
... << RSDN@Home 1.2.0 alpha 4 rev. 1476>>
Re[2]: QWidget geometry()
От: jobdead  
Дата: 18.10.10 07:39
Оценка:
Здравствуйте, vng, Вы писали:

vng>1. Не факт, что geometry должно совпадать с размером физического окна ОС.

vng>2. Попробуй frameGeometry().

И geometry() и frameGeometry() съедает по 1 пикселу.
Re: QWidget geometry()
От: goloveshin Россия  
Дата: 18.10.10 10:33
Оценка:
Здравствуйте, jobdead, Вы писали:

J>Всем привет.


J>Использую qt 4.6.2 под windows. Внутри QWidget вызываю geometry(по нажатии кнопки), она возвращает QRect(900, 329, 1022, 392), пробую spy(из ms visual) показывает rectangle: (900, 329)(1023, 393). В чем прикол?


J>Спасибо.


Может это?

Note that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle: The right() function returns left() + width() — 1 and the bottom() function returns top() + height() — 1. The same is the case for the point returned by the bottomRight() convenience function. In addition, the x and y coordinate of the topRight() and bottomLeft() functions, respectively, contain the same deviation from the true right and bottom edges.
Re[2]: QWidget geometry()
От: jobdead  
Дата: 18.10.10 12:29
Оценка:
Здравствуйте, goloveshin, Вы писали:


G>Может это?


G>Note that for historical reasons the values returned by the bottom() and right() functions deviate from the true bottom-right corner of the rectangle: The right() function returns left() + width() — 1 and the bottom() function returns top() + height() — 1. The same is the case for the point returned by the bottomRight() convenience function. In addition, the x and y coordinate of the topRight() and bottomLeft() functions, respectively, contain the same deviation from the true right and bottom edges.


Ага. Нашел эти строки в Qt-тях.
Спасибо.

Вопрос закрыт.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.