src/gui/styles/qmotifstyle.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
  1152                     p->fillRect(x, y, w, h, opt->palette.brush(QPalette::Button));
  1152                     p->fillRect(x, y, w, h, opt->palette.brush(QPalette::Button));
  1153                     proxy()->drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
  1153                     proxy()->drawItemText(p, menuitem->rect.adjusted(10, 0, -5, 0), Qt::AlignLeft | Qt::AlignVCenter,
  1154                                  menuitem->palette, menuitem->state & State_Enabled, menuitem->text,
  1154                                  menuitem->palette, menuitem->state & State_Enabled, menuitem->text,
  1155                                  QPalette::Text);
  1155                                  QPalette::Text);
  1156                     textWidth = menuitem->fontMetrics.width(menuitem->text) + 10;
  1156                     textWidth = menuitem->fontMetrics.width(menuitem->text) + 10;
  1157                     y += menuitem->fontMetrics.lineSpacing() / 2;
  1157                     y += menuitem->fontMetrics.height() / 2;
  1158                     p->setFont(oldFont);
  1158                     p->setFont(oldFont);
  1159                 }
  1159                 }
  1160                 p->setPen(opt->palette.dark().color());
  1160                 p->setPen(opt->palette.dark().color());
  1161                 p->drawLine(x, y, x + 5, y);
  1161                 p->drawLine(x, y, x + 5, y);
  1162                 p->drawLine(x + 5 + textWidth, y, x+w, y);
  1162                 p->drawLine(x + 5 + textWidth, y, x+w, y);
  2054             sz = QCommonStyle::sizeFromContents(ct, opt, sz, widget);
  2054             sz = QCommonStyle::sizeFromContents(ct, opt, sz, widget);
  2055             int w = sz.width(), h = sz.height();
  2055             int w = sz.width(), h = sz.height();
  2056 
  2056 
  2057             if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
  2057             if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
  2058                 w = 10;
  2058                 w = 10;
  2059                 h = (mi->text.isEmpty()) ? motifSepHeight : mi->fontMetrics.lineSpacing();
  2059                 h = (mi->text.isEmpty()) ? motifSepHeight : mi->fontMetrics.height();
  2060             }
  2060             }
  2061 
  2061 
  2062             // a little bit of border can never harm
  2062             // a little bit of border can never harm
  2063             w += 2*motifItemHMargin + 2*motifItemFrame;
  2063             w += 2*motifItemHMargin + 2*motifItemFrame;
  2064 
  2064