QtWidgets: convert some users of QSize::transpose() to transposed()

...because transposed() is inline (and transpose() is not),
and because it makes the code more readable and compact.

Change-Id: I5661ee6251be638fb40c5c748aa50a89de6f7735
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2014-12-17 16:21:03 +01:00
parent ceb753626f
commit 3f893e6fd9
10 changed files with 14 additions and 40 deletions

View File

@ -244,9 +244,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
QRect titleRect = rect;
if (docker->verticalTitleBar) {
QRect r = rect;
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
titleRect = QRect(r.left() + rect.bottom()
- titleRect.bottom(),

View File

@ -2021,9 +2021,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
if (verticalTitleBar) {
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
p->save();
p->translate(r.left(), r.top() + r.width());
@ -2898,11 +2896,8 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
// If this is a vertical titlebar, we transpose and work as if it was
// horizontal, then transpose again.
if (verticalTitleBar) {
QSize size = rect.size();
size.transpose();
rect.setSize(size);
}
if (verticalTitleBar)
rect.setSize(rect.size().transposed());
do {

View File

@ -1210,9 +1210,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
if (verticalTitleBar) {
QRect rect = dwOpt->rect;
QRect r = rect;
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
titleRect = QRect(r.left() + rect.bottom()
- titleRect.bottom(),
r.top() + titleRect.left() - rect.left(),

View File

@ -2902,9 +2902,7 @@ void QGtkStyle::drawControl(ControlElement element,
if (verticalTitleBar) {
QRect r = rect;
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
titleRect = QRect(r.left() + rect.bottom()
- titleRect.bottom(),

View File

@ -4367,9 +4367,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (verticalTitleBar) {
QRect rect = dwOpt->rect;
QRect r = rect;
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
titleRect = QRect(r.left() + rect.bottom()
- titleRect.bottom(),
@ -5196,11 +5194,8 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
// If this is a vertical titlebar, we transpose and work as if it was
// horizontal, then transpose again.
if (verticalTitleBar) {
QSize size = srect.size();
size.transpose();
srect.setSize(size);
}
if (verticalTitleBar)
srect.setSize(srect.size().transposed());
do {
int right = srect.right();

View File

@ -4049,9 +4049,7 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
if (!dwOpt->title.isEmpty()) {
QRect r = subElementRect(SE_DockWidgetTitleBarText, opt, w);
if (dwOpt->verticalTitleBar) {
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
p->save();
p->translate(r.left(), r.top() + r.width());
p->rotate(-90);

View File

@ -5686,9 +5686,7 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
QRect r = rect;
if (verticalTitleBar) {
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
painter->save();
painter->translate(r.left(), r.top() + r.width());

View File

@ -1767,9 +1767,7 @@ void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPai
QRect r = rect;
if (verticalTitleBar) {
QSize s = r.size();
s.transpose();
r.setSize(s);
r.setSize(r.size().transposed());
p->save();
p->translate(r.left(), r.top() + r.width());

View File

@ -1382,9 +1382,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
if (verticalTitleBar) {
QSize s = rect.size();
s.transpose();
rect.setSize(s);
rect.setSize(rect.size().transposed());
painter->translate(rect.left() - 1, rect.top() + rect.width());
painter->rotate(-90);

View File

@ -2372,9 +2372,7 @@ void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *op
bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
if (verticalTitleBar) {
QSize s = rect.size();
s.transpose();
rect.setSize(s);
rect.setSize(rect.size().transposed());
p->translate(rect.left() - 1, rect.top() + rect.width());
p->rotate(-90);