Пример #1
0
QSize GtkProxyStyle::sizeFromContents(ContentsType type, const QStyleOption *option,  const QSize &size, const QWidget *widget) const
{
    QSize sz=baseStyle()->sizeFromContents(type, option, size, widget);

    if (CT_ComboBox==type && widget && widget->property(constSlimComboProperty).toBool()) {
        QSize orig=baseStyle()->sizeFromContents(type, option, size, widget);
        QSize other=baseStyle()->sizeFromContents(type, option, size, toolbarCombo);
        if (orig.height()>other.height()) {
            return QSize(orig.width(), other.height());
        }
        return orig;
    } else if (SB_Standard!=sbarType && CT_ScrollBar==type) {
        if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
            int extent(pixelMetric(PM_ScrollBarExtent, option, widget)),
                sliderMin(pixelMetric(PM_ScrollBarSliderMin, option, widget));

            if (sb->orientation == Qt::Horizontal) {
                sz = QSize(sliderMin, extent);
            } else {
                sz = QSize(extent, sliderMin);
            }
        }
    }
    return sz;
}
Пример #2
0
  void serializeBaseStyle() {
    DCHECK(!m_isInGroup);
    PagePopupClient::addString("baseStyle: {", m_buffer);
    addProperty("backgroundColor", m_backgroundColor.serialized(), m_buffer);
    addProperty(
        "color",
        baseStyle().visitedDependentColor(CSSPropertyColor).serialized(),
        m_buffer);
    addProperty("textTransform",
                String(textTransformToString(baseStyle().textTransform())),
                m_buffer);
    addProperty("fontSize", baseFont().specifiedSize(), m_buffer);
    addProperty("fontStyle", String(fontStyleToString(baseFont().style())),
                m_buffer);
    addProperty("fontVariant",
                baseFont().variantCaps() == FontDescription::SmallCaps
                    ? String("small-caps")
                    : String(),
                m_buffer);

    PagePopupClient::addString("fontFamily: [", m_buffer);
    for (const FontFamily* f = &baseFont().family(); f; f = f->next()) {
      addJavaScriptString(f->family().getString(), m_buffer);
      if (f->next())
        PagePopupClient::addString(",", m_buffer);
    }
    PagePopupClient::addString("]", m_buffer);
    PagePopupClient::addString("},\n", m_buffer);
  }
Пример #3
0
void
QTMStyle::drawControl (ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const {
  switch (element) {
#if 0
    case CE_MenuItem:
      if (const QStyleOptionMenuItem *mi =
          qstyleoption_cast<const QStyleOptionMenuItem *> (option)) {
        QStyleOptionMenuItem mi2(*mi);
        mi2.text= QString ("pippo");
        baseStyle()->drawControl (element, &mi2, painter, widget);
        break;
      }
#endif

    case CE_ToolBar: {
#ifdef UNIFIED_TOOLBAR
      if ((widget) &&  (widget->windowTitle() == "mode toolbar"))  {

          // For unified tool bars, draw nothing.
          if (QMainWindow * mainWindow = qobject_cast<QMainWindow *>(widget->window())) {
            if ((mainWindow->unifiedTitleAndToolBarOnMac()) && 
                (widget->parent()->objectName() != "central widget"))
              break;
          }

          //QColor mainWindowGradientBeginActive (150, 150, 150);
          //QColor mainWindowGradientBegin (200, 200, 200);
          //QColor mainWindowGradientEnd (232, 232, 232);

          QColor mainWindowGradientBeginActive (222, 222, 222);
          QColor mainWindowGradientEndActive (202, 202, 202);
          QColor mainWindowGradientBegin (236, 236, 236);
          QColor mainWindowGradientEnd (226, 226, 226);
  
          if (widget->window()->isActiveWindow())
            mainWindowGradientBegin = mainWindowGradientBeginActive;
          if (widget->window()->isActiveWindow())
            mainWindowGradientEnd = mainWindowGradientEndActive;

          // draw background gradient
          QLinearGradient linearGrad;
          if (option->state & State_Horizontal)
            linearGrad = QLinearGradient(0, option->rect.top(), 0, option->rect.bottom());
          else
            linearGrad = QLinearGradient(option->rect.left(), 0,  option->rect.right(), 0);
          
          linearGrad.setColorAt(0, mainWindowGradientBegin);
          linearGrad.setColorAt(1, mainWindowGradientEnd);
          painter->fillRect(option->rect, linearGrad);
        }
#endif // UNIFIED_TOOLBAR
    } break;
      
    default:
      baseStyle()->drawControl (element, option, painter, widget);
  }
}
Пример #4
0
void
QTMStyle::drawControl (ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const {
  switch (element) {
    case CE_MenuItem:
      if (const QStyleOptionMenuItem *mi =
          qstyleoption_cast<const QStyleOptionMenuItem *> (option)) {
        QStyleOptionMenuItem mi2(*mi);
        mi2.text= QString ("pippo");
        baseStyle()->drawControl (element, &mi2, painter, widget);
        break;
      }
    default:
      baseStyle()->drawControl (element, option, painter, widget);
  }
}
Пример #5
0
void GtkProxyStyle::polish(QWidget *widget)
{
    #ifdef ENABLE_OVERLAYSCROLLBARS
    if (SB_Overlay==sbarType && sbarThumb && widget && qobject_cast<QAbstractScrollArea *>(widget) && qstrcmp(widget->metaObject()->className(), "QComboBoxListView")) {
        addEventFilter(widget, this);
        widget->setAttribute(Qt::WA_Hover, true);
    } else if (SB_Standard!=sbarType && usePlainScrollbars(widget)) {
        widget->setAttribute(Qt::WA_Hover, true);
    }
    #else

//    TODO: Why was this here?? Should it not have just been for QScrollBars???
//    if (SB_Standard!=sbarType) {
//        widget->setAttribute(Qt::WA_Hover, true);
//    }
    if (SB_Standard!=sbarType && qobject_cast<QScrollBar *>(widget) && isOnCombo(widget)) {
        widget->setProperty(constOnCombo, true);
    }
    #endif

    #ifndef ENABLE_KDE_SUPPORT
    if (widget && qobject_cast<QMenu *>(widget) && !widget->property(constAccelProp).isValid()) {
        AcceleratorManager::manage(widget);
        widget->setProperty(constAccelProp, true);
    }
    #endif
    baseStyle()->polish(widget);
}
    void serializeBaseStyle()
    {
        ASSERT(!m_isInGroup);
        PagePopupClient::addString("baseStyle: {", m_buffer);
        addProperty("backgroundColor", m_backgroundColor.serialized(), m_buffer);
        addProperty("color", baseStyle().visitedDependentColor(CSSPropertyColor).serialized(), m_buffer);
        addProperty("textTransform", String(textTransformToString(baseStyle().textTransform())), m_buffer);
        addProperty("fontSize", baseFont().computedPixelSize(), m_buffer);
        addProperty("fontStyle", String(fontStyleToString(baseFont().style())), m_buffer);
        addProperty("fontVariant", String(fontVariantToString(baseFont().variant())), m_buffer);

        PagePopupClient::addString("fontFamily: [", m_buffer);
        for (const FontFamily* f = &baseFont().family(); f; f = f->next()) {
            addJavaScriptString(f->family().string(), m_buffer);
            if (f->next())
                PagePopupClient::addString(",", m_buffer);
        }
        PagePopupClient::addString("]", m_buffer);
        PagePopupClient::addString("},\n", m_buffer);
    }
Пример #7
0
void BookTextView::paintHeader() const {
	const int unit = baseStyle()->fontSize() / 4;
	const int left = leftMargin();
	const int right = context().width() - rightMargin() - 1;
	const int bottom = topMargin() + unit * 4;
	context().setColor(color(ZLTextStyle::REGULAR_TEXT));
	context().setFont(baseStyle()->fontFamily(), unit * 3, false, true);
	context().drawLine(left, bottom, right, bottom);

	// TODO: use chapter name instead
	const std::string leftText = myBook->title();
	context().drawString(left, bottom - unit, leftText.c_str(), leftText.length(), false);

	std::string rightText;
	ZLStringUtil::appendNumber(rightText, 1 + sizeOfTextBeforeCursor(textArea().endCursor()) / 2048);
	rightText += '/';
	ZLStringUtil::appendNumber(rightText, 1 + sizeOfTextBeforeParagraph(endTextIndex()) / 2048);
	const std::size_t rightTextWidth = context().stringWidth(rightText.c_str(), rightText.length(), false);
	context().drawString(right - rightTextWidth, bottom - unit, rightText.c_str(), rightText.length(), false);
}
Пример #8
0
int GtkProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const
{
    if (SB_Standard!=sbarType && PM_ScrollBarExtent==metric) {
        #ifdef ENABLE_OVERLAYSCROLLBARS
        return !sbarThumb || usePlainScrollbars(widget) ? sbarPlainViewWidth : sbarWidth;
        #else
        return sbarPlainViewWidth;
        #endif
    }
    return baseStyle()->pixelMetric(metric, option, widget);
}
Пример #9
0
int BookTextView::headerHeight() const {
	shared_ptr<ZLTextPositionIndicatorInfo> indicatorInfo = this->indicatorInfo();
	if (!indicatorInfo.isNull()) {
		switch (indicatorInfo->type()) {
			default:
				return 0;
			case ZLTextPositionIndicatorInfo::PAGE_HEADER:
				return baseStyle()->fontSize() / 4 * 5;
		}
	}
	return 0;
}
Пример #10
0
int
QTMStyle::styleHint (StyleHint hint, const QStyleOption* option, const QWidget* widget, QStyleHintReturn* returnData) const {
  switch (hint) {
    case SH_MenuBar_AltKeyNavigation:
      return 0;
      // Set SH_MenuBar_AltKeyNavigation to false. Typically this would be the job of the style that is selected.
      // However: That mechanism seems to be broken with some Qt versions. Furthermore, the Alt key is heavily
      // used within TeXmacs, so the menubar navigation gets in the way quite often.
    default:
      return baseStyle()->styleHint (hint, option, widget, returnData);
  }
}
Пример #11
0
QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const
{
    QIcon icon;
    switch (standardIcon) {
    case QStyle::SP_TitleBarCloseButton:
    case QStyle::SP_ToolBarHorizontalExtensionButton:
        return QIcon(standardPixmap(standardIcon, option, widget));
    default:
        icon = baseStyle()->standardIcon(standardIcon, option, widget);
    }
    return icon;
}
Пример #12
0
void ManhattanStyle::polish(QWidget *widget)
{
    QProxyStyle::polish(widget);

    // OxygenStyle forces a rounded widget mask on toolbars and dock widgets
    if (baseStyle()->inherits("OxygenStyle") || baseStyle()->inherits("Oxygen::Style")) {
        if (qobject_cast<QToolBar*>(widget) || qobject_cast<QDockWidget*>(widget)) {
            widget->removeEventFilter(baseStyle());
            widget->setContentsMargins(0, 0, 0, 0);
        }
    }
    if (panelWidget(widget)) {

        // Oxygen and possibly other styles override this
        if (qobject_cast<QDockWidget*>(widget))
            widget->setContentsMargins(0, 0, 0, 0);

        widget->setAttribute(Qt::WA_LayoutUsesWidgetRect, true);
        if (qobject_cast<QToolButton*>(widget)) {
            widget->setAttribute(Qt::WA_Hover);
            if (!widget->property("extraframe").toBool())
                widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
        }
        else if (qobject_cast<QLineEdit*>(widget)) {
            widget->setAttribute(Qt::WA_Hover);
            widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
        }
        else if (qobject_cast<QLabel*>(widget))
            widget->setPalette(panelPalette(widget->palette(), lightColored(widget)));
        else if (widget->property("panelwidget_singlerow").toBool())
            widget->setFixedHeight(StyleHelper::navigationWidgetHeight());
        else if (qobject_cast<QStatusBar*>(widget))
            widget->setFixedHeight(StyleHelper::navigationWidgetHeight() + 2);
        else if (qobject_cast<QComboBox*>(widget)) {
            widget->setMaximumHeight(StyleHelper::navigationWidgetHeight() - 2);
            widget->setAttribute(Qt::WA_Hover);
        }
    }
}
Пример #13
0
void GtkProxyStyle::unpolish(QWidget *widget)
{
    #ifdef ENABLE_OVERLAYSCROLLBARS
    if (SB_Overlay==sbarType && sbarThumb && widget) {
        if (qobject_cast<QAbstractScrollArea *>(widget) && qstrcmp(widget->metaObject()->className(), "QComboBoxListView")) {
            widget->removeEventFilter(this);
        }
        if (sbarThumb && sbarThumbTarget==widget) {
            sbarThumb->hide();
        }
    }
    #endif
    baseStyle()->unpolish(widget);
}
Пример #14
0
int
QTMStyle::pixelMetric (PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const {
  switch (metric) {
    case PM_ToolBarItemSpacing:
      return 0;
    case PM_ToolBarIconSize:
      return 17;
  //  case PM_ToolBarFrameWidth:
  //    return 2;
    default:
      ;
  }
  return baseStyle()->pixelMetric(metric,opt,widget);
}
Пример #15
0
int GtkProxyStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const
{
    switch (hint) {
    case SH_DialogButtonBox_ButtonsHaveIcons:
        return false;
    case SH_UnderlineShortcut:
        return widget ? shortcutHander->showShortcut(widget) : true;
    case SH_ScrollView_FrameOnlyAroundContents:
        if (SB_Standard!=sbarType) {
            return false;
        }
    default:
        break;
    }

    return baseStyle()->styleHint(hint, option, widget, returnData);
}
Пример #16
0
QSize 
QTMStyle::sizeFromContents (ContentsType type, const QStyleOption* option, const QSize& contentsSize, const QWidget* widget) const {
  QSize sz(contentsSize);
  switch (type) {
    case CT_LineEdit:
      sz = QSize(sz.width() + 2, sz.height() + 2);
      break;
      
    case CT_ToolButton:
      sz = QSize(sz.width() + 4, sz.height() + 6);
      break;
      
    default:
      sz = baseStyle()->sizeFromContents(type, option, contentsSize, widget);
  }
  return sz;
}
Пример #17
0
int ProxyStyle::pixelMetric(PixelMetric metric, const QStyleOption* option, const QWidget* widget) const
{
    switch (metric) {
    case PM_TabBarTabHSpace:
        if (m_TabBarTabHSpace == -1) {
            m_TabBarTabHSpace = qMin(QProxyStyle::pixelMetric(PM_TabBarTabHSpace, option, widget), 14);

            if (baseStyle()->objectName() == QLatin1String("oxygen")) {
                m_TabBarTabHSpace = 14;
            }
        }

        return m_TabBarTabHSpace;

    default:
        return QProxyStyle::pixelMetric(metric, option, widget);
    }
}
Пример #18
0
void
QTMStyle::drawPrimitive (PrimitiveElement element, const QStyleOption *opt, QPainter *p, const QWidget *widget) const {
  //  if (element == QStyle::PE_FrameStatusBarItem) return;
  switch (element) {
    case PE_FrameStatusBar : 
      return;
    case PE_PanelButtonTool:
      if ((opt->state & (State_Sunken | State_On))) {
        qtmDrawShadeRoundPanel(p, opt->rect,  QPalette(opt->palette.color(QPalette::Mid)),//opt->palette,
                        (opt->state & (State_Sunken | State_On)), 2,
                        &opt->palette.brush(QPalette::Mid));
      } else {
        qtmDrawShadeRoundPanel(p, opt->rect, opt->palette, //QPalette(opt->palette.color(QPalette::Mid)),//opt->palette,
                        (opt->state & (State_Sunken | State_On)), 0,
                        &opt->palette.brush(QPalette::Mid));
      }
      return;
    default:
      ;
  }
  baseStyle()->drawPrimitive(element,opt,p,widget);  
}
Пример #19
0
void GtkProxyStyle::polish(QApplication *app)
{
    addEventFilter(app, shortcutHander);
    baseStyle()->polish(app);
}
Пример #20
0
void GtkProxyStyle::polish(QPalette &pal)
{
    baseStyle()->polish(pal);
}
Пример #21
0
QRect
QTMProxyStyle::subControlRect (ComplexControl control, const QStyleOptionComplex* option, SubControl subControl, const QWidget* widget) const {
  return baseStyle()->subControlRect (control, option, subControl, widget);
}
Пример #22
0
void GtkProxyStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
{
    if (SB_Standard!=sbarType && CC_ScrollBar==control) {
        if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
            QRect r=option->rect;
            QRect slider=subControlRect(control, option, SC_ScrollBarSlider, widget);
            painter->save();
            #ifdef ENABLE_OVERLAYSCROLLBARS
            bool usePlain=!sbarThumb || usePlainScrollbars(widget);
            #else
            bool usePlain=true;
            #endif

            if (usePlain) {
                #if 0
                QLinearGradient grad(r.topLeft(), Qt::Horizontal==sb->orientation ? r.bottomLeft() : r.topRight());
                QColor col=option->palette.base().color();
                grad.setColorAt(0, col.darker(110));
                grad.setColorAt(1, col.darker(102));
                painter->fillRect(r, grad);
                #else
                if (widget && widget->property(constOnCombo).toBool()) {
                    painter->fillRect(r, option->palette.background());
                } else if (!widget || widget->testAttribute(Qt::WA_OpaquePaintEvent)) {
                    painter->fillRect(r, option->palette.base());
                }
                #endif
            }
            #ifdef ENABLE_OVERLAYSCROLLBARS
            else {
                painter->fillRect(r, usePlain ? option->palette.base() : option->palette.background());
                const QAbstractItemView *v=view(widget);
                if (v && qobject_cast<const QTreeView *>(v) && ((const QTreeView *)v)->header()&& ((const QTreeView *)v)->header()->isVisible()) {
                    QStyleOptionHeader ho;
                    ho.rect=QRect(r.x()+r.width()-(sbarWidth), r.y(), sbarWidth, ((const QTreeView *)v)->header()->height());
                    ho.state=option->state;
                    ho.palette=option->palette;
                    painter->save();
                    drawControl(CE_Header, &ho, painter, ((const QTreeView *)v)->header());
                    painter->restore();
                }
            }
            #endif
            if (slider.isValid()) {
                if (usePlain) {
                    bool inactive=!(sb->activeSubControls&SC_ScrollBarSlider && (option->state&State_MouseOver || option->state&State_Sunken));
                    int adjust=inactive ? 3 : 1;
                    painter->setRenderHint(QPainter::Antialiasing, true);
                    if (Qt::Horizontal==sb->orientation) {
                        slider.adjust(1, adjust, -1, -adjust);
                    } else {
                        slider.adjust(adjust, 1, -adjust, -1);
                    }
                    int dimension=(Qt::Horizontal==sb->orientation ? slider.height() : slider.width());
                    QPainterPath path=buildPath(QRectF(slider.x()+0.5, slider.y()+0.5, slider.width()-1, slider.height()-1),
                                                dimension>6 ? (dimension/4.0) : (dimension/8.0));
                    QColor col(option->palette.highlight().color());
                    if (!(option->state&State_Active)) {
                        col=col.darker(115);
                    }
                    painter->fillPath(path, col);
                    painter->setPen(col);
                    painter->drawPath(path);
                }
                #ifdef ENABLE_OVERLAYSCROLLBARS
                else {
                    QRect toThumb;
                    QPalette::ColorGroup cg=option->palette.currentColorGroup();
                    if (sbarThumb && sbarThumbTarget && sbarThumbTarget==widget && sbarThumb->isVisible()) {
                        QPoint p=sbarThumbTarget->mapFromGlobal(sbarThumb->pos())+QPoint(1, 1);
                        if (Qt::Horizontal==sb->orientation) {
                            if (p.x()<slider.x()) {
                                toThumb=QRect(p.x(), slider.y(), slider.x()-p.x(), slider.width());
                            } else if (p.x()>(slider.x()+slider.width())) {
                                toThumb=QRect(slider.x()+slider.width(), slider.x(), p.x()-(slider.y()+slider.width()), slider.width());
                            }
                        } else {
                            if (p.y()<slider.y()) {
                                toThumb=QRect(slider.x(), p.y(), slider.width(), slider.y()-p.y());
                            } else if (p.y()>(slider.y()+slider.height())) {
                                toThumb=QRect(slider.x(), slider.y()+slider.height(), slider.width(), p.y()-(slider.y()+slider.height()));
                            }
                        }
                        cg=QPalette::Active;
                    }
                    if (toThumb.isValid()) {
                        QColor col(option->palette.color(cg, QPalette::Text));
                        col.setAlphaF(0.35);
                        painter->fillRect(toThumb, col);
                    }
                    painter->fillRect(slider, option->palette.color(cg, QPalette::Highlight));
                }
                #endif
            }

            painter->restore();
            return;
        }
    }
    baseStyle()->drawComplexControl(control, option, painter, widget);
}
Пример #23
0
QRect GtkProxyStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget) const
{
    if (SB_Standard!=sbarType && CC_ScrollBar==control) {
        if (const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(option))  {
            QRect ret;
            bool  horizontal(Qt::Horizontal==sb->orientation);
            int   sbextent(pixelMetric(PM_ScrollBarExtent, sb, widget)),
                  sliderMaxLength(horizontal ? sb->rect.width() : sb->rect.height()),
                  sliderMinLength(pixelMetric(PM_ScrollBarSliderMin, sb, widget)),
                  sliderLength;

            if (sb->maximum != sb->minimum) {
                uint valueRange = sb->maximum - sb->minimum;
                sliderLength = (sb->pageStep * sliderMaxLength) / (valueRange + sb->pageStep);

                if (sliderLength < sliderMinLength) {
                    sliderLength = sliderMinLength;
                }
                if (sliderLength > sliderMaxLength) {
                    sliderLength = sliderMaxLength;
                }
            } else {
                sliderLength = sliderMaxLength;
            }

            int sliderstart(sliderPositionFromValue(sb->minimum, sb->maximum, sb->sliderPosition, sliderMaxLength - sliderLength, sb->upsideDown));

            // Subcontrols
            switch(subControl)
            {
            case SC_ScrollBarSubLine:
            case SC_ScrollBarAddLine:
                return QRect();
            case SC_ScrollBarSubPage:
                if (horizontal) {
                    ret.setRect(0, 0, sliderstart, sbextent);
                } else {
                    ret.setRect(0, 0, sbextent, sliderstart);
                }
                break;
            case SC_ScrollBarAddPage:
                if (horizontal) {
                    ret.setRect(sliderstart + sliderLength, 0, sliderMaxLength - sliderstart - sliderLength, sbextent);
                } else {
                    ret.setRect(0, sliderstart + sliderLength, sbextent, sliderMaxLength - sliderstart - sliderLength);
                }
                break;
            case SC_ScrollBarGroove:
                if (horizontal) {
                    ret=QRect(0, 0, sb->rect.width(), sb->rect.height());
                } else {
                    ret=QRect(0, 0, sb->rect.width(), sb->rect.height());
                }
                break;
            case SC_ScrollBarSlider:
                if (horizontal) {
                    ret=QRect(sliderstart, 0, sliderLength, sbextent);
                } else {
                    ret=QRect(0, sliderstart, sbextent, sliderLength);
                }
                break;
            default:
                ret = baseStyle()->subControlRect(control, option, subControl, widget);
                break;
            }
            return visualRect(sb->direction/*Qt::LeftToRight*/, sb->rect, ret);
        }
    }
    return baseStyle()->subControlRect(control, option, subControl, widget);
}
Пример #24
0
void 
QTMStyle::drawComplexControl (ComplexControl cc, const QStyleOptionComplex* opt, QPainter* p, const QWidget* widget) const {
  switch (cc) {
    case CC_ToolButton:
      if (const QStyleOptionToolButton *toolbutton
          = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
        QRect button, menuarea;
        button = proxy()->subControlRect(cc, toolbutton, SC_ToolButton, widget);
        menuarea = proxy()->subControlRect(cc, toolbutton, SC_ToolButtonMenu, widget);
        
        State bflags = toolbutton->state & ~State_Sunken;
        
        if (bflags & State_AutoRaise) {
          if (!(bflags & State_MouseOver) || !(bflags & State_Enabled)) {
            bflags &= ~State_Raised;
          }
        }
        State mflags = bflags;
        if (toolbutton->state & State_Sunken) {
          if (toolbutton->activeSubControls & SC_ToolButton)
            bflags |= State_Sunken;
          mflags |= State_Sunken;
        }
        
        QStyleOption tool(0);
        tool.palette = toolbutton->palette;
        if (toolbutton->subControls & SC_ToolButton) {
          if (bflags & (State_Sunken | State_On | State_Raised)) {
            tool.rect = button;
            tool.state = bflags;
            proxy()->drawPrimitive(PE_PanelButtonTool, &tool, p, widget);
          }
        }
        
        if (toolbutton->state & State_HasFocus) {
          QStyleOptionFocusRect fr;
          fr.QStyleOption::operator=(*toolbutton);
          fr.rect.adjust(3, 3, -3, -3);
          if (toolbutton->features & QStyleOptionToolButton::MenuButtonPopup)
            fr.rect.adjust(0, 0, -proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator,
                                                       toolbutton, widget), 0);
          proxy()->drawPrimitive(PE_FrameFocusRect, &fr, p, widget);
        }
        QStyleOptionToolButton label = *toolbutton;
        label.state = bflags;
        int fw = proxy()->pixelMetric(PM_DefaultFrameWidth, opt, widget);
        label.rect = button.adjusted(fw, fw, -fw, -fw);
        proxy()->drawControl(CE_ToolButtonLabel, &label, p, widget);
        
        if (toolbutton->subControls & SC_ToolButtonMenu) {
          tool.rect = menuarea;
          tool.state = mflags;
          if (mflags & (State_Sunken | State_On | State_Raised))
            proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, p, widget);
          proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, p, widget);
        } else if ((toolbutton->features & QStyleOptionToolButton::HasMenu) 
                   && (mflags & State_MouseOver))
        {
          int mbi = proxy()->pixelMetric(PM_MenuButtonIndicator, toolbutton, widget);
          QRect ir = toolbutton->rect;
          QStyleOptionToolButton newBtn = *toolbutton;
          newBtn.rect = QRect(ir.right() + 5 - mbi, ir.y() + ir.height() - mbi + 4, mbi - 6, mbi - 6);
          proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, p, widget);
        }
      }
      break;
    default:
      baseStyle()->drawComplexControl (cc, opt, p, widget);
  }
}
Пример #25
0
void
QTMProxyStyle::drawComplexControl (ComplexControl control, const QStyleOptionComplex* option, QPainter* painter, const QWidget* widget) const {
  baseStyle()->drawComplexControl (control, option, painter, widget);
}
Пример #26
0
void
QTMProxyStyle::unpolish (QWidget* widget) {
  baseStyle()->unpolish (widget);
}
Пример #27
0
void GtkProxyStyle::unpolish(QApplication *app)
{
    app->removeEventFilter(shortcutHander);
    baseStyle()->unpolish(app);
}
Пример #28
0
QRect
QTMProxyStyle::subElementRect (SubElement element, const QStyleOption* option, const QWidget* widget) const {
  return baseStyle()->subElementRect (element, option, widget);
}
Пример #29
0
void
QTMProxyStyle::drawControl (ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const {
  baseStyle()->drawControl (element, option, painter, widget);
}
Пример #30
0
void
QTMProxyStyle::unpolish (QApplication* app) {
  baseStyle()->unpolish (app);
}