summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Sørvig <msorvig@trolltech.com>2009-05-05 12:33:23 (GMT)
committerMorten Sørvig <msorvig@trolltech.com>2009-05-05 12:33:23 (GMT)
commite6d0c873c707bf076ba41924a445c0e1d343ac38 (patch)
tree622f0443032059cc6e02a5c106d5119d48c39101
parent8be2b24705da4bce99b3a3d588aedcfe2eb3f886 (diff)
parentce9379739616cd716371b073521f6bbf01e0ce61 (diff)
downloadQt-e6d0c873c707bf076ba41924a445c0e1d343ac38.zip
Qt-e6d0c873c707bf076ba41924a445c0e1d343ac38.tar.gz
Qt-e6d0c873c707bf076ba41924a445c0e1d343ac38.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r--src/gui/itemviews/qlistview.cpp7
-rw-r--r--src/gui/kernel/qapplication_win.cpp4
-rw-r--r--src/gui/styles/qcommonstyle.cpp73
3 files changed, 39 insertions, 45 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 07f0a38..48f53a0 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1997,14 +1997,15 @@ bool QListViewPrivate::doItemsLayout(int delta)
int first = batchStartRow();
int last = qMin(first + delta - 1, max);
- if (max < 0 || last < first)
- return true; // nothing to do
-
if (first == 0) {
layoutChildren(); // make sure the viewport has the right size
prepareItemsLayout();
}
+ if (max < 0 || last < first) {
+ return true; // nothing to do
+ }
+
QListViewLayoutInfo info;
info.bounds = layoutBounds;
info.grid = gridSize();
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index fae0335..bc32c14 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2432,10 +2432,12 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
widget = (QETWidget*)qApp->focusWidget();
HWND focus = ::GetFocus();
//if there is a current widget and the new widget belongs to the same toplevel window
+ //or if the current widget was embedded into non-qt window (i.e. we won't get WM_ACTIVATEAPP)
//then we clear the focus on the widget
//in case the new widget belongs to a different widget hierarchy, clearing the focus
//will be handled because the active window will change
- if (widget && ::IsChild(widget->window()->internalWinId(), focus)) {
+ const bool embedded = widget && ((QETWidget*)widget->window())->topData()->embedded;
+ if (widget && (embedded || ::IsChild(widget->window()->internalWinId(), focus))) {
widget->clearFocus();
result = true;
} else {
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 819965b..3cae08a 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -1779,46 +1779,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
drawControl(CE_TabBarTabShape, tab, p, widget);
-
- QStyleOptionTabV3 tabV3(*tab);
- QRect labelRect = tabV3.rect;
- QSize &left= tabV3.leftButtonSize;
- QSize &right = tabV3.rightButtonSize;
- const int spacing = 6 + 2;
-
- // left widget
- if (!left.isEmpty()) {
- if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast )
- labelRect.setTop(labelRect.top() + spacing + left.height());
- else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest)
- labelRect.setBottom(labelRect.bottom() - spacing - left.height());
- else
- labelRect.setLeft(labelRect.left() + spacing + left.width());
- }
-
- // right widget
- if (!right.isEmpty()) {
- if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast )
- labelRect.setBottom(labelRect.bottom() - spacing - right.height());
- else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest)
- labelRect.setTop(labelRect.top() + spacing + right.height());
- else
- labelRect.setRight(labelRect.right() - spacing - right.width());
- }
-
- tabV3.rect = visualRect(opt->direction, opt->rect, labelRect);
- drawControl(CE_TabBarTabLabel, &tabV3, p, widget);
- if (tabV3.state & State_HasFocus) {
- const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth);
- int x1, x2;
- x1 = tab->rect.left();
- x2 = tab->rect.right() - 1;
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*tab);
- fropt.rect.setRect(x1 + 1 + OFFSET, tab->rect.y() + OFFSET,
- x2 - x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
- }
+ drawControl(CE_TabBarTabLabel, tab, p, widget);
}
break;
case CE_TabBarTabShape:
@@ -2020,8 +1981,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
(tabV2.state & State_Enabled) ? QIcon::Normal
: QIcon::Disabled);
- int offset = 6;
+ int offset = 4;
int left = opt->rect.left();
+ if (tabV2.leftButtonSize.isEmpty())
+ offset += 2;
+ else
+ left += tabV2.leftButtonSize.width() + (6 + 2) + 2;
QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2,
tabIconSize.width(), tabIconSize.height());
if (!verticalTabs)
@@ -2032,6 +1997,20 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
if (verticalTabs)
p->restore();
+
+ if (tabV2.state & State_HasFocus) {
+ const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth);
+
+ int x1, x2;
+ x1 = tabV2.rect.left();
+ x2 = tabV2.rect.right() - 1;
+
+ QStyleOptionFocusRect fropt;
+ fropt.QStyleOption::operator=(*tab);
+ fropt.rect.setRect(x1 + 1 + OFFSET, tabV2.rect.y() + OFFSET,
+ x2 - x1 - 2*OFFSET, tabV2.rect.height() - 2*OFFSET);
+ drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ }
}
break;
#endif // QT_NO_TABBAR
@@ -2879,6 +2858,12 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
tr.setRight(tr.right() - horizontalShift);
}
+ // left widget
+ if (!tabV2.leftButtonSize.isEmpty()) {
+ tr.setLeft(tr.left() + 6 + 2 +
+ (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width()));
+ }
+
// icon
if (!tabV2.icon.isNull()) {
QSize iconSize = tabV2.iconSize;
@@ -2900,6 +2885,12 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
tr.setLeft(tr.left() + tabIconSize.width() + offset + 2);
}
+ // right widget
+ if (!tabV2.rightButtonSize.isEmpty()) {
+ tr.setRight(tr.right() - 6 - 2 -
+ (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width()));
+ }
+
if (!verticalTabs)
tr = visualRect(opt->direction, opt->rect, tr);
r = tr;