当前位置: 首页>>代码示例>>C++>>正文


C++ SkinContext::hasNodeSelectString方法代码示例

本文整理汇总了C++中SkinContext::hasNodeSelectString方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinContext::hasNodeSelectString方法的具体用法?C++ SkinContext::hasNodeSelectString怎么用?C++ SkinContext::hasNodeSelectString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SkinContext的用法示例。


在下文中一共展示了SkinContext::hasNodeSelectString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setup

void WSearchLineEdit::setup(const QDomNode& node, const SkinContext& context) {
    // Background color
    QColor bgc(255,255,255);
    QString bgColorStr;
    if (context.hasNodeSelectString(node, "BgColor", &bgColorStr)) {
        bgc.setNamedColor(bgColorStr);
        setAutoFillBackground(true);
    }
    QPalette pal = palette();
    pal.setBrush(backgroundRole(), WSkinColor::getCorrectColor(bgc));

    // Foreground color
    m_fgc = QColor(0,0,0);
    QString fgColorStr;
    if (context.hasNodeSelectString(node, "FgColor", &fgColorStr)) {
        m_fgc.setNamedColor(fgColorStr);
    }
    bgc = WSkinColor::getCorrectColor(bgc);
    m_fgc = QColor(255 - bgc.red(), 255 - bgc.green(), 255 - bgc.blue());
    pal.setBrush(foregroundRole(), m_fgc);
    setPalette(pal);
}
开发者ID:DigitalBillMusic,项目名称:mixxx,代码行数:22,代码来源:wsearchlineedit.cpp

示例2: setup

void WRecordingDuration::setup(const QDomNode& node, const SkinContext& context) {
    WLabel::setup(node, context);
    connect(m_pRecordingManager, SIGNAL(durationRecorded(QString)),
        this, SLOT(refreshLabel(QString)));
    connect(m_pRecordingManager, SIGNAL(isRecording(bool)),
            this, SLOT(slotRecordingInactive(bool)));

    // When we're recording show text from "InactiveText" node
    QString inactiveText;
    if (context.hasNodeSelectString(node, "InactiveText", &inactiveText)) {
        m_inactiveText = inactiveText;
    } else {
        m_inactiveText = QString("--:--");
    }
    // Set inactiveText here already because slotRecordingInactive
    // is refreshed first when we start recording
    setText(m_inactiveText);
}
开发者ID:DJMaxergy,项目名称:mixxx,代码行数:18,代码来源:wrecordingduration.cpp

示例3: setup

void WLabel::setup(const QDomNode& node, const SkinContext& context) {
    // Colors
    QPalette pal = palette(); //we have to copy out the palette to edit it since it's const (probably for threadsafety)


    QDomElement bgColor = context.selectElement(node, "BgColor");
    if (!bgColor.isNull()) {
        m_qBgColor.setNamedColor(context.nodeToString(bgColor));
        pal.setColor(this->backgroundRole(), WSkinColor::getCorrectColor(m_qBgColor));
        setAutoFillBackground(true);
    }

    m_qFgColor.setNamedColor(context.selectString(node, "FgColor"));
    pal.setColor(this->foregroundRole(), WSkinColor::getCorrectColor(m_qFgColor));
    setPalette(pal);

    // Text
    if (context.hasNodeSelectString(node, "Text", &m_skinText)) {
        setText(m_skinText);
    }

    // Font size
    QString strFontSize;
    if (context.hasNodeSelectString(node, "FontSize", &strFontSize)) {
        int fontsize = strFontSize.toInt();
        // TODO(XXX) "Helvetica" should retrain the Qt default font matching, verify that.
        setFont(QFont("Helvetica", fontsize, QFont::Normal));
    }

    // Alignment
    QString alignment;
    if (context.hasNodeSelectString(node, "Alignment", &alignment)) {
        alignment = alignment.toLower();
        if (alignment == "right") {
            setAlignment(Qt::AlignRight | Qt::AlignVCenter);
        } else if (alignment == "center") {
            setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
        } else if (alignment == "left") {
            setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        } else {
            qDebug() << "WLabel::setup(): Alignment =" << alignment <<
                    " unknown, use right, center or left";
        }
    }

    // Adds an ellipsis to truncated text
    QString elide;
    if (context.hasNodeSelectString(node, "Elide", &elide)) {
        elide = elide.toLower();
        if (elide == "right") {
            m_elideMode = Qt::ElideRight;
        } else if (elide == "middle") {
            m_elideMode = Qt::ElideMiddle;
        } else if (elide == "left") {
            m_elideMode = Qt::ElideLeft;
        } else if (elide == "none") {
            m_elideMode = Qt::ElideNone;
        } else {
            qDebug() << "WLabel::setup(): Alide =" << elide <<
                    "unknown, use right, middle, left or none.";
        }
    }
}
开发者ID:sohet,项目名称:mixxx,代码行数:63,代码来源:wlabel.cpp


注:本文中的SkinContext::hasNodeSelectString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。