diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 9ab8f8f..604cc8f 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -1065,6 +1065,7 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, void QWindowsStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *widget) const { + qDebug() << __FUNCTION__ << ce << opt->rect << widget; switch (ce) { #ifndef QT_NO_RUBBERBAND case CE_RubberBand: diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp index 2f36944..74a02b9 100644 --- a/src/widgets/styles/qwindowsvistastyle.cpp +++ b/src/widgets/styles/qwindowsvistastyle.cpp @@ -869,6 +869,7 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { + qDebug() << __FUNCTION__ << element << option->rect << widget; QWindowsVistaStylePrivate *d = const_cast(d_func()); if (!QWindowsVistaStylePrivate::useVista()) { @@ -1235,6 +1236,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption #ifndef QT_NO_MENU case CE_MenuItem: if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast(option)) { + QString s = menuitem->text; // windows always has a check column, regardless whether we have an icon or not int checkcol = 28; { @@ -1244,20 +1246,30 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption MENU_POPUPCHECKBACKGROUND, MBI_HOT); pGetThemePartSize(theme.handle(), NULL, MENU_POPUPCHECK, 0, NULL,TS_TRUE, &size); pGetThemeMargins(theme.handle(), NULL, MENU_POPUPCHECK, 0, TMT_CONTENTMARGINS, NULL, &margins); - checkcol = qMax(menuitem->maxIconWidth, int(6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth)); + const int wwS = 6 + size.cx + margins.cxLeftWidth + margins.cxRightWidth; + checkcol = qMax(menuitem->maxIconWidth, int(wwS)); + qDebug() << __FUNCTION__ << widget << "checkcol" << checkcol + << "maxIconWidth" << menuitem->maxIconWidth << "wwS" <rect; //draw vertical menu line QPoint p1 = QStyle::visualPos(option->direction, menuitem->rect, QPoint(checkcol, rect.top())); QPoint p2 = QStyle::visualPos(option->direction, menuitem->rect, QPoint(checkcol, rect.bottom())); + qDebug() << __FUNCTION__ << "GL" << p1 << p2; QRect gutterRect(p1.x(), p1.y(), 3, p2.y() - p1.y() + 1); XPThemeData theme2(widget, painter, QWindowsXPStylePrivate::MenuTheme, MENU_POPUPGUTTER, stateId, gutterRect); d->drawBackground(theme2); + qDebug() << __FUNCTION__ << "Gutter" << gutterRect; int x, y, w, h; menuitem->rect.getRect(&x, &y, &w, &h); + qDebug() << __FUNCTION__ << "RECT" << menuitem->rect; int tab = menuitem->tabWidth; bool dis = !(menuitem->state & State_Enabled); bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable @@ -1336,6 +1348,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption pmr.moveCenter(vCheckRect.center()); painter->setPen(menuitem->palette.text().color()); painter->drawPixmap(pmr.topLeft(), pixmap); + qDebug() << __FUNCTION__ << s << pmr; } painter->setPen(menuitem->palette.buttonText().color()); @@ -1350,7 +1363,6 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption int xpos = menuitem->rect.x() + xm; QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin); QRect vTextRect = visualRect(option->direction, menuitem->rect, textRect); - QString s = menuitem->text; if (!s.isEmpty()) { // draw text painter->save(); int t = s.indexOf(QLatin1Char('\t')); @@ -1369,6 +1381,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption font.setBold(true); painter->setFont(font); painter->setPen(discol); + qDebug() << __FUNCTION__ << "TEXT" << vTextRect << s.left(t); painter->drawText(vTextRect, text_flags, s.left(t)); painter->restore(); } diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index 63ed3ef..f285c7b 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -738,10 +738,13 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) if (themeData.widget) dc = hdcForWidgetBackingStore(themeData.widget); + QPoint redirectionDelta(int(painter->deviceMatrix().dx()), int(painter->deviceMatrix().dy())); QRect area = themeData.rect.translated(redirectionDelta); - + qDebug() << __FUNCTION__ << dc << "themerect" << themeData.rect + << themeData.widget<< "delta" << redirectionDelta + << "area: " << area; QRegion sysRgn = painter->paintEngine()->systemClip(); if (sysRgn.isEmpty()) sysRgn = area; @@ -820,6 +823,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa { QPainter *painter = themeData.painter; QRect rect = themeData.rect; + qDebug() << __FUNCTION__ << themeData.rect << themeData.widget; if ((themeData.rotate + 90) % 180 == 0) { // Catch 90,270,etc.. degree flips. rect = QRect(0, 0, rect.height(), rect.width()); @@ -1954,6 +1958,7 @@ case PE_Frame: void QWindowsXPStyle::drawControl(ControlElement element, const QStyleOption *option, QPainter *p, const QWidget *widget) const { + qDebug() << __FUNCTION__ << element << option->rect << widget; QWindowsXPStylePrivate *d = const_cast(d_func()); if (!QWindowsXPStylePrivate::useXP()) { QWindowsStyle::drawControl(element, option, p, widget); diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index d1b0da1..3f4331d 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -206,6 +206,7 @@ QList > QMenuPrivate::calcCausedStack() const void QMenuPrivate::updateActionRects() const { Q_Q(const QMenu); + qDebug() << __FUNCTION__; updateActionRects(popupGeometry(q)); } @@ -1180,6 +1181,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) option->tabWidth = d->tabWidth; option->maxIconWidth = d->maxIconWidth; option->menuRect = rect(); + qDebug() << this << __FUNCTION__ << option->rect << option->menuRect << option->maxIconWidth; } /*! @@ -2203,6 +2205,7 @@ void QMenu::hideEvent(QHideEvent *) */ void QMenu::paintEvent(QPaintEvent *e) { + qDebug() << ">" << __FUNCTION__; Q_D(QMenu); d->updateActionRects(); QPainter p(this); @@ -2220,6 +2223,7 @@ void QMenu::paintEvent(QPaintEvent *e) for (int i = 0; i < d->actions.count(); ++i) { QAction *action = d->actions.at(i); QRect adjustedActionRect = d->actionRects.at(i); + qDebug() << __FUNCTION__ << i << adjustedActionRect; if (!e->rect().intersects(adjustedActionRect) || d->widgetItems.value(action)) continue; @@ -2294,6 +2298,7 @@ void QMenu::paintEvent(QPaintEvent *e) menuOpt.rect = rect(); menuOpt.menuRect = rect(); style()->drawControl(QStyle::CE_MenuEmptyArea, &menuOpt, &p, this); + qDebug() << "<" << __FUNCTION__; } #ifndef QT_NO_WHEELEVENT