⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qstyle.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    Destroys the style object.*/QStyle::~QStyle(){}/*!    Initializes the appearance of the given \a widget.    This function is called for every widget at some point after it    has been fully created but just \e before it is shown for the very    first time.    Note that the default implementation does nothing. Reasonable    actions in this function might be to call the    QWidget::setBackgroundMode() function for the widget. Do not use    the function to set, for example, the geometry; reimplementing    this function do provide a back-door through which the appearance    of a widget can be changed, but with Qt 4.0's style engine there    is rarely necessary to implement this function; reimplement the    drawItemPixmap(), drawItemText(), drawPrimitive(), etc. instead.    The QWidget::inherits() function may provide enough information to    allow class-specific customizations. But because new QStyle    subclasses are expected to work reasonably with all current and \e    future widgets, limited use of hard-coded customization is    recommended.    \sa unpolish()*/void QStyle::polish(QWidget * /* widget */){}/*!    Uninitialize the given \a{widget}'s appearance.    This function is the counterpart to polish(). It is called for    every polished widget whenever the style is dynamically changed;    the former style has to unpolish its settings before the new style    can polish them again.    Note that unpolish() will only be called if the widget is    destroyed.  This can cause problems in some cases, e.g, if you    remove a widget from the UI, cache it, and then reinsert it after    the style has changed; some of Qt's classes cache their widgets.    \sa polish()*/void QStyle::unpolish(QWidget * /* widget */){}/*!    \fn void QStyle::polish(QApplication * application)    \overload    Late initialization of the given \a application object.*/void QStyle::polish(QApplication * /* app */){}/*!    \fn void QStyle::unpolish(QApplication * application)    \overload    Uninitialize the given \a application.*/void QStyle::unpolish(QApplication * /* app */){}/*!    \fn void QStyle::polish(QPalette & palette)    \overload    Changes the \a palette according to style specific requirements    for color palettes (if any).    \sa QPalette, QApplication::setPalette()*/void QStyle::polish(QPalette & /* pal */){}/*!    \fn QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rectangle, int alignment, bool enabled, const QString &text) const    Returns the area within the given \a rectangle in which to draw    the provided \a text according to the specified font \a metrics    and \a alignment. The \a enabled parameter indicates whether or    not the associated item is enabled.    If the given \a rectangle is larger than the area needed to render    the \a text, the rectangle that is returned will be offset within    \a rectangle according to the specified \a alignment.  For    example, if \a alignment is Qt::AlignCenter, the returned    rectangle will be centered within \a rectangle. If the given \a    rectangle is smaller than the area needed, the returned rectangle    will be the smallest rectangle large enough to render the \a text.    \sa Qt::Alignment*/QRect QStyle::itemTextRect(const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled,                       const QString &text) const{    QRect result;    int x, y, w, h;    rect.getRect(&x, &y, &w, &h);    if (!text.isEmpty()) {        result = metrics.boundingRect(x, y, w, h, alignment, text);        if (!enabled && styleHint(SH_EtchDisabledText)) {            result.setWidth(result.width()+1);            result.setHeight(result.height()+1);        }    } else {        result = QRect(x, y, w, h);    }    return result;}/*!    \fn QRect QStyle::itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const    Returns the area within the given \a rectangle in which to draw    the specified \a pixmap according to the defined \a alignment.*/QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pixmap) const{    QRect result;    int x, y, w, h;    rect.getRect(&x, &y, &w, &h);    if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)        y += h/2 - pixmap.height()/2;    else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom)        y += h - pixmap.height();    if ((alignment & Qt::AlignRight) == Qt::AlignRight)        x += w - pixmap.width();    else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter)        x += w/2 - pixmap.width()/2;    else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft())        x += w - pixmap.width();    result = QRect(x, y, pixmap.width(), pixmap.height());    return result;}/*!    \fn void QStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette, bool enabled, const QString& text, QPalette::ColorRole textRole) const    Draws the given \a text in the specified \a rectangle using the    provided \a painter and \a palette.    The text is drawn using the painter's pen, and aligned and wrapped    according to the specified \a alignment. If an explicit \a    textRole is specified, the text is drawn using the \a palette's    color for the given role. The \a enabled parameter indicates    whether or not the item is enabled; when reimplementing this    function, the \a enabled parameter should influence how the item is    drawn.    \sa Qt::Alignment, drawItemPixmap()*/void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &pal,                          bool enabled, const QString& text, QPalette::ColorRole textRole) const{    if (text.isEmpty())        return;    QPen savedPen;    if (textRole != QPalette::NoRole) {        savedPen = painter->pen();        painter->setPen(QPen(pal.brush(textRole), savedPen.widthF()));    }    if (!enabled) {        if (styleHint(SH_DitherDisabledText)) {            painter->drawText(rect, alignment, text);            painter->fillRect(painter->boundingRect(rect, alignment, text), QBrush(painter->background().color(), Qt::Dense5Pattern));            return;        } else if (styleHint(SH_EtchDisabledText)) {            QPen pen = painter->pen();            painter->setPen(pal.light().color());            painter->drawText(rect.adjusted(1, 1, 1, 1), alignment, text);            painter->setPen(pen);        }    }    painter->drawText(rect, alignment, text);    if (textRole != QPalette::NoRole)        painter->setPen(savedPen);}/*!    \fn void QStyle::drawItemPixmap(QPainter *painter, const QRect &rectangle, int alignment,                            const QPixmap &pixmap) const    Draws the given \a pixmap in the specified \a rectangle, according    to the specified \a alignment, using the provided \a painter.    \sa drawItemText()*/void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,                            const QPixmap &pixmap) const{    QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size(), rect);    QRect inter = aligned.intersected(rect);    painter->drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.x(), inter.y() - aligned.y(), inter.width(), inter.height());}/*!    \enum QStyle::PrimitiveElement    This enum describes that various primitive elements. A    primitive element is a common GUI element, such as a checkbox    indicator or button bevel.    \value PE_PanelButtonCommand  Button used to initiate an action, for        example, a QPushButton.    \value PE_FrameDefaultButton  This frame around a default button, e.g. in a dialog.    \value PE_PanelButtonBevel  Generic panel with a button bevel.    \value PE_PanelButtonTool  Panel for a Tool button, used with QToolButton.    \value PE_PanelLineEdit  Panel for a QLineEdit.    \value PE_IndicatorButtonDropDown  Indicator for a drop down button, for example, a tool                                       button that displays a menu.    \value PE_FrameFocusRect  Generic focus indicator.    \value PE_IndicatorArrowUp  Generic Up arrow.    \value PE_IndicatorArrowDown  Generic Down arrow.    \value PE_IndicatorArrowRight  Generic Right arrow.    \value PE_IndicatorArrowLeft  Generic Left arrow.    \value PE_IndicatorSpinUp  Up symbol for a spin widget, for example a QSpinBox.    \value PE_IndicatorSpinDown  Down symbol for a spin widget.    \value PE_IndicatorSpinPlus  Increase symbol for a spin widget.    \value PE_IndicatorSpinMinus  Decrease symbol for a spin widget.    \value PE_IndicatorViewItemCheck On/off indicator for a view item.    \value PE_IndicatorCheckBox  On/off indicator, for example, a QCheckBox.    \value PE_IndicatorRadioButton  Exclusive on/off indicator, for example, a QRadioButton.    \value PE_Q3DockWindowSeparator  Item separator for Qt 3 compatible dock window                                     and toolbar contents.    \value PE_IndicatorDockWidgetResizeHandle  Resize handle for dock windows.    \value PE_Frame  Generic frame; see also QFrame.    \value PE_FrameMenu  Frame for popup windows/menus; see also QMenu.    \value PE_PanelMenuBar  Panel for menu bars.    \value PE_PanelScrollAreaCorner  Panel at the bottom-right (or        bottom-left) corner of a scroll area.    \value PE_FrameDockWidget  Panel frame for dock windows and toolbars.    \value PE_FrameTabWidget  Frame for tab widgets.    \value PE_FrameLineEdit  Panel frame for line edits.    \value PE_FrameGroupBox  Panel frame around group boxes.    \value PE_FrameButtonBevel  Panel frame for a button bevel.    \value PE_FrameButtonTool  Panel frame for a tool button.    \value PE_IndicatorHeaderArrow  Arrow used to indicate sorting on a list or table        header.    \value PE_FrameStatusBar Frame for a section of a status bar; see also QStatusBar.    \value PE_FrameWindow  Frame around a MDI window or a docking window.    \value PE_Q3Separator  Qt 3 compatible generic separator.    \value PE_IndicatorMenuCheckMark  Check mark used in a menu.    \value PE_IndicatorProgressChunk  Section of a progress bar indicator; see also QProgressBar.    \value PE_Q3CheckListController  Qt 3 compatible controller part of a list view item.    \value PE_Q3CheckListIndicator  Qt 3 compatible checkbox part of a list view item.    \value PE_Q3CheckListExclusiveIndicator  Qt 3 compatible radio button part of a list view item.    \value PE_IndicatorBranch  Lines used to represent the branch of a tree in a tree view.    \value PE_IndicatorToolBarHandle  The handle of a toolbar.    \value PE_IndicatorToolBarSeparator  The separator in a toolbar.    \value PE_PanelToolBar  The panel for a toolbar.    \value PE_PanelTipLabel The panel for a tip label.    \value PE_FrameTabBarBase The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn't part of a tab widget.    \value PE_IndicatorTabTear An indicator that a tab is partially scrolled out of the visible tab bar when there are many tabs.    \value PE_IndicatorColumnViewArrow An arrow in a QColumnView.    \value PE_Widget  A plain QWidget.    \value PE_CustomBase Base value for custom primitive elements.    All values above this are reserved for custom use. Custom values    must be greater than this value.    \sa drawPrimitive()*//*!    \typedef QStyle::SFlags    \internal*//*!    \typedef QStyle::SCFlags    \internal*//*!    \enum QStyle::StateFlag

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -