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

📄 qcleanlooksstyle.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    "+#            <+",    "+#            <+",    "+#            <+",    ".+<<<<<<<<<<<<<+",    " .++++++++++++++"};static const char * const qt_scrollbar_button_right[] = {    "16 16 6 1",    "   c None",    ".  c #BFBFBF",    "+  c #979797",    "#  c #FAFAFA",    "<  c #FAFAFA",    "*  c #FAFAFA",    "++++++++++++++. ",    "+#############+.",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+<<<<<<<<<<<<<+.",    "++++++++++++++. "};static const char * const qt_scrollbar_button_up[] = {    "16 16 6 1",    "   c None",    ".  c #BFBFBF",    "+  c #979797",    "#  c #FAFAFA",    "<  c #FAFAFA",    "*  c #FAFAFA",    " .++++++++++++. ",    ".+############+.",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+<<<<<<<<<<<<<<+",    "++++++++++++++++"};static const char * const qt_scrollbar_button_down[] = {    "16 16 6 1",    "   c None",    ".  c #BFBFBF",    "+  c #979797",    "#  c #FAFAFA",    "<  c #FAFAFA",    "*  c #FAFAFA",    "++++++++++++++++",    "+##############+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    "+#            <+",    ".+<<<<<<<<<<<<+.",    " .++++++++++++. "};static const char * const qt_cleanlooks_menuitem_checkbox_checked[] = {    "8 7 6 1",    " 	g None",    ".	g #959595",    "+	g #676767",    "@	g #454545",    "#	g #1D1D1D",    "0	g #101010",    "      ..",    "     .+ ",    "    .+  ",    "0  .@   ",    "@#++.   ",    "  @#    ",    "   .    "};static const char * const qt_cleanlooks_checkbox_checked[] = {    "13 13 8 1",    " 	c None",    "%	c #ABB0B2",    ".	c #373E44",    "+	c #444B52",    "@	c #575E65",    "#	c #727981",    "$	c #999EA0",    "&	c #BCC1C3",    "             ",    "             ",    "         %%  ",    "        %#   ",    "       %+    ",    "  %.% &.%    ",    "  &..&@+     ",    "   %...$     ",    "    %..      ",    "     +%      ",    "     &       ",    "             ",    "             "};#define BEGIN_CLEANLOOKS_PIXMAPCACHE(a) \    QRect rect = option->rect; \    QPixmap cache; \    QPainter *p = painter; \    QString unique = uniqueName((a), option, option->rect.size()); \    if (UsePixmapCache) { \        if (!QPixmapCache::find(unique, cache)) { \            rect.setRect(0, 0, option->rect.width(), option->rect.height()); \            cache = QPixmap(option->rect.size()); \            cache.fill(Qt::transparent); \            p = new QPainter(&cache); \        } else { \            painter->drawPixmap(option->rect.topLeft(), cache); \            break; \        } \    }#define END_CLEANLOOKS_PIXMAPCACHE \    if (p != painter) { \        p->end(); \        delete p; \        painter->drawPixmap(option->rect.topLeft(), cache); \        QPixmapCache::insert(unique, cache); \    }class QCleanlooksStylePrivate : public QWindowsStylePrivate{    Q_DECLARE_PUBLIC(QCleanlooksStyle)public:    QCleanlooksStylePrivate()        : QWindowsStylePrivate()    {        animationFps = 24;    }~QCleanlooksStylePrivate()    { }    void lookupIconTheme() const;};static void qt_cleanlooks_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,                                        const QColor &gradientStop, Direction direction = TopDown, QBrush bgBrush = QBrush()){        int x = rect.center().x();        int y = rect.center().y();        QLinearGradient *gradient;        switch(direction) {            case FromLeft:                gradient = new QLinearGradient(rect.left(), y, rect.right(), y);                break;            case FromRight:                gradient = new QLinearGradient(rect.right(), y, rect.left(), y);                break;            case BottomUp:                gradient = new QLinearGradient(x, rect.bottom(), x, rect.top());            case TopDown:            default:                gradient = new QLinearGradient(x, rect.top(), x, rect.bottom());                break;        }        if (bgBrush.gradient())            gradient->setStops(bgBrush.gradient()->stops());        else {            gradient->setColorAt(0, gradientStart);            gradient->setColorAt(1, gradientStop);        }        painter->fillRect(rect, *gradient);        delete gradient;}static void qt_cleanlooks_draw_buttongradient(QPainter *painter, const QRect &rect, const QColor &gradientStart,                                                const QColor &gradientMid, const QColor &gradientStop, Direction direction = TopDown,                                                QBrush bgBrush = QBrush()){        int x = rect.center().x();        int y = rect.center().y();        QLinearGradient *gradient;        bool horizontal = false;        switch(direction) {            case FromLeft:                horizontal = true;                gradient = new QLinearGradient(rect.left(), y, rect.right(), y);                break;            case FromRight:                horizontal = true;                gradient = new QLinearGradient(rect.right(), y, rect.left(), y);                break;            case BottomUp:                gradient = new QLinearGradient(x, rect.bottom(), x, rect.top());            case TopDown:            default:                gradient = new QLinearGradient(x, rect.top(), x, rect.bottom());                break;        }        if (bgBrush.gradient())            gradient->setStops(bgBrush.gradient()->stops());        else {            int size = horizontal ? rect.width() : rect.height() ;            if (size < 1)                size = 1;            float edge = 4.0/(float)size;            gradient->setColorAt(0, gradientStart);            gradient->setColorAt(edge, gradientMid.lighter(104));            gradient->setColorAt(1.0 - edge, gradientMid.darker(100));            gradient->setColorAt(1.0, gradientStop);        }        painter->fillRect(rect, *gradient);        delete gradient;}static QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size){    QString tmp;    const QStyleOptionComplex *complexOption = qstyleoption_cast<const QStyleOptionComplex *>(option);    tmp.sprintf("%s-%d-%d-%lld-%dx%d", key.toLatin1().constData(), uint(option->state),                complexOption ? uint(complexOption->activeSubControls) : uint(0),                option->palette.cacheKey(), size.width(), size.height());#ifndef QT_NO_SPINBOX    if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {        tmp.append(QLatin1Char('-'));        tmp.append(QString::number(spinBox->buttonSymbols));        tmp.append(QLatin1Char('-'));        tmp.append(QString::number(spinBox->stepEnabled));        tmp.append(QLatin1Char('-'));        tmp.append(QLatin1Char(spinBox->frame ? '1' : '0'));    }#endif // QT_NO_SPINBOX    return tmp;}static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken){    QColor dark;    dark.setHsv(option->palette.button().color().hue(),                CL_MIN(255, (int)(option->palette.button().color().saturation()*1.9)),                CL_MIN(255, (int)(option->palette.button().color().value()*0.7)));    QColor highlight = option->palette.highlight().color();    bool active = (option->titleBarState & QStyle::State_Active);    QColor titleBarHighlight(active ? highlight.lighter(106): option->palette.background().color().lighter(106));    if (hover)        painter->fillRect(tmp.adjusted(1, 1, -1, -1), QColor(255, 255, 255, 20));    else if (sunken)        painter->fillRect(tmp.adjusted(1, 1, -1, -1), option->palette.highlight().color().darker(130));    QColor mdiButtonGradientStartColor;    QColor mdiButtonGradientStopColor;    mdiButtonGradientStartColor = QColor(active ? highlight.lighter(115): option->palette.background().color().lighter(115));    mdiButtonGradientStopColor = QColor(active ? highlight.darker(110) : option->palette.background().color());    if (sunken)        titleBarHighlight = highlight.darker(130);    QLinearGradient gradient(tmp.center().x(), tmp.top(), tmp.center().x(), tmp.bottom());    gradient.setColorAt(0, mdiButtonGradientStartColor);    gradient.setColorAt(1, mdiButtonGradientStopColor);    QColor mdiButtonBorderColor(active ? option->palette.highlight().color().darker(180): dark.darker(110));    painter->setPen(QPen(mdiButtonBorderColor, 1));    painter->drawLine(tmp.left() + 2, tmp.top(), tmp.right() - 2, tmp.top());    painter->drawLine(tmp.left() + 2, tmp.bottom(), tmp.right() - 2, tmp.bottom());    painter->drawLine(tmp.left(), tmp.top() + 2, tmp.left(), tmp.bottom() - 2);    painter->drawLine(tmp.right(), tmp.top() + 2, tmp.right(), tmp.bottom() - 2);    painter->drawPoint(tmp.left() + 1, tmp.top() + 1);    painter->drawPoint(tmp.right() - 1, tmp.top() + 1);    painter->drawPoint(tmp.left() + 1, tmp.bottom() - 1);    painter->drawPoint(tmp.right() - 1, tmp.bottom() - 1);    painter->setPen(titleBarHighlight);    painter->drawLine(tmp.left() + 2, tmp.top() + 1, tmp.right() - 2, tmp.top() + 1);    painter->drawLine(tmp.left() + 1, tmp.top() + 2, tmp.left() + 1, tmp.bottom() - 2);    painter->setPen(QPen(gradient, 1));    painter->drawLine(tmp.right() + 1, tmp.top() + 2, tmp.right() + 1, tmp.bottom() - 2);    painter->drawPoint(tmp.right() , tmp.top() + 1);    painter->drawLine(tmp.left() + 2, tmp.bottom() + 1, tmp.right() - 2, tmp.bottom() + 1);    painter->drawPoint(tmp.left() + 1, tmp.bottom());    painter->drawPoint(tmp.right() - 1, tmp.bottom());    painter->drawPoint(tmp.right() , tmp.bottom() - 1);}/*!    \class QCleanlooksStyle    \brief The QCleanlooksStyle class provides a widget style similar to the    Clearlooks style available in GNOME.    \since 4.2    The Cleanlooks style provides a look and feel for widgets    that closely resembles the Clearlooks style, introduced by Richard    Stellingwerff and Daniel Borgmann.    \sa {Cleanlooks Style Widget Gallery}, QWindowsXPStyle, QMacStyle, QWindowsStyle,        QCDEStyle, QMotifStyle, QPlastiqueStyle*//*!    Constructs a QCleanlooksStyle object.*/QCleanlooksStyle::QCleanlooksStyle() : QWindowsStyle(*new QCleanlooksStylePrivate){    setObjectName(QLatin1String("CleanLooks"));}/*!    Destroys the QCleanlooksStyle object.*/QCleanlooksStyle::~QCleanlooksStyle(){}/*!    \fn void QCleanlooksStyle::drawItemText(QPainter *painter, const QRect &rectangle, int alignment, const QPalette &palette,

⌨️ 快捷键说明

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