本文整理汇总了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);
}
示例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);
}
示例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.";
}
}
}