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

📄 qstyle.cpp

📁 qt-x11-opensource-src-4.1.4.tar.gz源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    Late initialization of the QApplication object \a app.    \sa unpolish()*/void QStyle::polish(QApplication * /* app */){}/*!    \overload    Undoes the polish of application \a app.    \sa polish()*/void QStyle::unpolish(QApplication * /* app */){}/*!    \overload    The style may have certain requirements for color palettes. In    this function it has the chance to change the palette \a pal    according to these requirements.    \sa QPalette, QApplication::setPalette()*/void QStyle::polish(QPalette & /* pal */){}/*!    Returns the appropriate area (see below) within rectangle \a rect in    which to draw \a text using the font metrics \a metrics.    The text is aligned in accordance with \a alignment. The \a enabled bool    indicates whether or not the item is enabled.    If \a rect is larger than the area needed to render the \a text    the rectangle that is returned will be offset within \a rect in    accordance with the alignment \a alignment. For example, if \a    alignment is Qt::AlignCenter, the returned rectangle will be    centered within \a rect. If \a rect is smaller than the area    needed, the rectangle that is returned will be \e larger than \a    rect (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;}/*!    Returns the appropriate area within rectangle \a rect in    which to draw the \a pixmap with alignment defined in \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;}/*!    Draws the \a text in rectangle \a rect using \a painter and    palette \a pal.    Text is drawn using the painter's pen. If an explicit \a textRole    is specified, then the text is drawn using the color specified in    \a pal for the specified role.  The \a enabled bool indicates    whether or not the item is enabled; when reimplementing this bool    should influence how the item is drawn.    The text is aligned and wrapped according to \a alignment.    \sa Qt::Alignment*/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(pal.color(textRole));    }    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);}/*!    Draws the \a pixmap in rectangle \a rect with alignment \a alignment using    \a painter.*/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.intersect(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 represents a style's PrimitiveElements. A    PrimitiveElement 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_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 tabbar, ususally drawn for a tabbar 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_CustomBase  Base value for custom PrimitiveElements.        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    This enum represents flags for drawing PrimitiveElements. Not all    primitives use all of these flags. Note that these flags may mean    different things to different primitives.    \value State_Active    \value State_AutoRaise    \value State_Bottom    \value State_Children    \value State_None    \value State_DownArrow    \value State_Editing    \value State_Enabled    \value State_FocusAtBorder    \value State_HasFocus    \value State_HasFocus    \value State_Horizontal    \value State_Item    \value State_MouseOver    \value State_NoChange    \value State_Off    \value State_On    \value State_Open    \value State_Raised    \value State_Selected    \value State_Sibling    \value State_Sunken    \value State_Top    \value State_UpArrow    \value State_KeyboardFocusChange    \value State_ReadOnly    \omitvalue State_Default    \sa drawPrimitive()*//*!    \fn void QStyle::drawPrimitive(PrimitiveElement elem, const QStyleOption *option, \                                   QPainter *painter, const QWidget *widget) const    Draw the primitive option \a elem with \a painter using the style    options specified by \a option.    The \a widget argument is optional and may contain a widget that may    aid in drawing the primitive.    What follows is a table of the elements and the QStyleOption    structure the \a option parameter can be cast to. The flags    stored in the QStyleOption state variable are also listed. If a    PrimitiveElement is not listed here, it uses a plain    QStyleOption.    The QStyleOption is the the following for the following types of PrimitiveElements.    \table    \header \o PrimitiveElement \o Option Cast \o Style Flag \o Remark    \row \o \l PE_FrameFocusRect \o \l QStyleOptionFocusRect         \o \l State_FocusAtBorder         \o Whether the focus is is at the border or inside the widget.    \row \o{1,2} \l PE_IndicatorCheckBox \o{1,2} \l QStyleOptionButton          \o \l State_NoChange \o Indicates a "tri-state" checkbox.    \row \o \l State_On \o Indicates the indicator is checked.    \row \o \l PE_IndicatorRadioButton \o \l QStyleOptionButton          \o \l State_On \o Indicates that a radio button is selected.    \row \o{1,3} \l PE_Q3CheckListExclusiveIndicator, \l PE_Q3CheckListIndicator         \o{1,3} \l QStyleOptionQ3ListView \o \l State_On         \o Indicates whether or not the controller is selected.    \row \o \l State_NoChange \o Indicates a "tri-state" controller.    \row \o \l State_Enabled \o Indicates the controller is enabled.    \row \o{1,2} \l PE_IndicatorBranch \o{1,2} \l QStyleOption         \o \l State_DownArrow \o Indicates that the Tree Branch is pressed    \row \o \l State_Open \o Indicates that the tree branch is expanded.    \row \o \l PE_IndicatorHeaderArrow \o \l QStyleOptionHeader         \o \l State_UpArrow \o Indicates that the arrow should be drawn up;         otherwise it should be down.    \row \o \l PE_FrameGroupBox, \l PE_Frame, \l PE_FrameLineEdit,            \l PE_FrameMenu, \l PE_FrameDockWidget         \o \l QStyleOptionFrame \o \l State_Sunken         \o Indicates that the Frame should be sunken.    \row \o \l PE_IndicatorToolBarHandle \o \l QStyleOption         \o \l State_Horizontal \o Indicates that the window handle is horizontal         instead of vertical.    \row \o \l PE_Q3DockWindowSeparator \o \l QStyleOption         \o \l State_Horizontal \o Indicates that the separator is horizontal         instead of vertical.    \row \o \l PE_IndicatorSpinPlus, \l PE_IndicatorSpinMinus, \l PE_IndicatorSpinUp,            \l PE_IndicatorSpinDown,

⌨️ 快捷键说明

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