Re: QFrame inner rectangle
if you want inner rectangle's size, frameWidth() and frameHeight() is your answer
Re: QFrame inner rectangle
I see frameWidth() but I don't see frameHeight(). Are you sure? :confused:
Re: QFrame inner rectangle
frameHeight is not there. and it is obvious.
From the docs -
Quote:
frameWidth : const int
This property holds the width of the frame that is drawn.
ie., it is something like the border width. subtract this from the frame rect, and you will get the inner rect :)
Re: QFrame inner rectangle
oops, my bad..i assumed that height would be there :) plus on second thought..i think if u call contentsRect() on frame, u'd get right values that u want..also, to make sure u r doing right, call frameRect() and frameWidth()..frameRect() should be adjusted to framewidth on contentsRect().
Re: QFrame inner rectangle
here is how frameRect() is calculated inside QFrame:
Code:
{
QRect fr
= contentsRect
();
if ((d
->oldFrameStyle
& QFrame::Shape_Mask) == QFrame::StyledPanel) { fr.adjust(-d->leftFrameWidth, -d->topFrameWidth, d->rightFrameWidth, d->bottomFrameWidth);
} else
fr.adjust(-d->frameWidth, -d->frameWidth, d->frameWidth, d->frameWidth);
return fr;
}
thus i believe contentsRect() should be what u need
Re: QFrame inner rectangle
That makes sense. There a sentence on the QFrame documentation page that states...
Quote:
The margin between the frame and the contents of the frame can be customized with the QWidget::setContentsMargins() function.
so the contentsRect() call should be what I need.
Thanks!
-Mic