本文整理汇总了C++中SkinContext::hasNode方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinContext::hasNode方法的具体用法?C++ SkinContext::hasNode怎么用?C++ SkinContext::hasNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinContext
的用法示例。
在下文中一共展示了SkinContext::hasNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setup
void WVuMeter::setup(QDomNode node, const SkinContext& context) {
// Set pixmaps
bool bHorizontal = context.hasNode(node, "Horizontal") &&
context.selectString(node, "Horizontal") == "true";
// Set background pixmap if available
if (context.hasNode(node, "PathBack")) {
setPixmapBackground(context.getSkinPath(context.selectString(node, "PathBack")));
}
setPixmaps(context.getSkinPath(context.selectString(node, "PathVu")), bHorizontal);
m_iPeakHoldSize = context.selectInt(node, "PeakHoldSize");
if (m_iPeakHoldSize < 0 || m_iPeakHoldSize > 100)
m_iPeakHoldSize = DEFAULT_HOLDSIZE;
m_iPeakFallStep = context.selectInt(node, "PeakFallStep");
if (m_iPeakFallStep < 1 || m_iPeakFallStep > 1000)
m_iPeakFallStep = DEFAULT_FALLSTEP;
m_iPeakHoldTime = context.selectInt(node, "PeakHoldTime");
if (m_iPeakHoldTime < 1 || m_iPeakHoldTime > 3000)
m_iPeakHoldTime = DEFAULT_HOLDTIME;
m_iPeakFallTime = context.selectInt(node, "PeakFallTime");
if (m_iPeakFallTime < 1 || m_iPeakFallTime > 1000)
m_iPeakFallTime = DEFAULT_FALLTIME;
}
示例2: setup
void WSliderComposed::setup(QDomNode node, const SkinContext& context) {
// Setup pixmaps
unsetPixmaps();
if (context.hasNode(node, "Slider")) {
PixmapSource sourceSlider = context.getPixmapSource(context.selectNode(node, "Slider"));
setSliderPixmap(sourceSlider);
}
PixmapSource sourceHandle = context.getPixmapSource(context.selectNode(node, "Handle"));
bool h = context.selectBool(node, "Horizontal", false);
setHandlePixmap(h, sourceHandle);
if (context.hasNode(node, "EventWhileDrag")) {
if (context.selectString(node, "EventWhileDrag").contains("no")) {
m_bEventWhileDrag = false;
}
}
if (!m_connections.isEmpty()) {
ControlParameterWidgetConnection* defaultConnection = m_connections.at(0);
if (defaultConnection) {
if (defaultConnection->getEmitOption() &
ControlParameterWidgetConnection::EMIT_DEFAULT) {
// ON_PRESS means here value change on mouse move during press
defaultConnection->setEmitOption(
ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE);
}
}
}
}
示例3: setup
void WStatusLight::setup(QDomNode node, const SkinContext& context) {
// Number of states. Add one to account for the background.
setNoPos(context.selectInt(node, "NumberPos") + 1);
// Set pixmaps
for (int i = 0; i < m_pixmaps.size(); ++i) {
// Accept either PathStatusLight or PathStatusLight1 for value 1,
QString nodeName = QString("PathStatusLight%1").arg(i);
if (context.hasNode(node, nodeName)) {
QString mode = context.selectAttributeString(
context.selectElement(node, nodeName), "sizemode", "FIXED");
setPixmap(i, context.getSkinPath(context.selectString(node, nodeName)),
SizeModeFromString(mode));
} else if (i == 0 && context.hasNode(node, "PathBack")) {
QString mode = context.selectAttributeString(
context.selectElement(node, "PathBack"), "sizemode", "FIXED");
setPixmap(i, context.getSkinPath(context.selectString(node, "PathBack")),
SizeModeFromString(mode));
} else if (i == 1 && context.hasNode(node, "PathStatusLight")) {
QString mode = context.selectAttributeString(
context.selectElement(node, "PathStatusLight"), "sizemode", "FIXED");
setPixmap(i, context.getSkinPath(context.selectString(node, "PathStatusLight")),
SizeModeFromString(mode));
} else {
m_pixmaps[i].clear();
}
}
}
示例4: setup
void WLabel::setup(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)
if (context.hasNode(node, "BgColor")) {
m_qBgColor.setNamedColor(context.selectString(node, "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.hasNode(node, "Text"))
m_qsText = context.selectString(node, "Text");
setText(m_qsText);
// Font size
if (context.hasNode(node, "FontSize")) {
int fontsize = 9;
fontsize = context.selectString(node, "FontSize").toInt();
setFont( QFont("Helvetica",fontsize,QFont::Normal) );
}
// Alignment
if (context.hasNode(node, "Alignment")) {
if (context.selectString(node, "Alignment") == "right") {
setAlignment(Qt::AlignRight | Qt::AlignVCenter);
} else if (context.selectString(node, "Alignment") == "center") {
setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
} else if (context.selectString(node, "Alignment") == "left") {
setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
}
}
}
示例5: setup
void WDisplay::setup(QDomNode node, const SkinContext& context) {
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
setPixmapBackground(context.getSkinPath(
context.selectString(node, "BackPath")));
}
// Number of states
setPositions(context.selectInt(node, "NumberStates"));
// Load knob pixmaps
QString path = context.selectString(node, "Path");
for (int i = 0; i < m_pixmaps.size(); ++i) {
setPixmap(&m_pixmaps, i, context.getSkinPath(path.arg(i)));
}
// See if disabled images is defined, and load them...
if (context.hasNode(node, "DisabledPath")) {
QString disabledPath = context.selectString(node, "DisabledPath");
for (int i = 0; i < m_disabledPixmaps.size(); ++i) {
setPixmap(&m_disabledPixmaps, i,
context.getSkinPath(disabledPath.arg(i)));
}
m_bDisabledLoaded = true;
}
}
示例6: setTimeFormat
void WTime::setTimeFormat(QDomNode node, const SkinContext& context) {
// if a custom format is defined, all other formatting flags are ignored
if (!context.hasNode(node, "CustomFormat")) {
// check if seconds should be shown
QString secondsFormat = context.selectString(node, "ShowSeconds");
if(secondsFormat == "true" || secondsFormat == "yes") {
m_sTimeFormat = "h:mm:ss";
m_iInterval = s_iSecondInterval;
} else {
m_sTimeFormat = "h:mm";
m_iInterval = s_iMinuteInterval;
}
// check if 24 hour format or 12 hour format is selected
QString clockFormat = context.selectString(node, "ClockFormat");
if (clockFormat == "24" || clockFormat == "24hrs") {
} else if (clockFormat == "12" ||
clockFormat == "12hrs" ||
clockFormat == "12ap") {
m_sTimeFormat += " ap";
} else if (clockFormat == "12AP") {
m_sTimeFormat += " AP";
} else {
qDebug() << "WTime: Unknown clock format: " << clockFormat;
}
} else {
// set the time format to the custom format
m_sTimeFormat = context.selectString(node, "CustomFormat");
}
}
示例7: setup
void WWidgetGroup::setup(QDomNode node, const SkinContext& context) {
setContentsMargins(0, 0, 0, 0);
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
}
QLayout* pLayout = NULL;
if (context.hasNode(node, "Layout")) {
QString layout = context.selectString(node, "Layout");
if (layout == "vertical") {
pLayout = new QVBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
} else if (layout == "horizontal") {
pLayout = new QHBoxLayout();
pLayout->setSpacing(0);
pLayout->setContentsMargins(0, 0, 0, 0);
pLayout->setAlignment(Qt::AlignCenter);
}
}
if (pLayout && context.hasNode(node, "SizeConstraint")) {
QMap<QString, QLayout::SizeConstraint> constraints;
constraints["SetDefaultConstraint"] = QLayout::SetDefaultConstraint;
constraints["SetFixedSize"] = QLayout::SetFixedSize;
constraints["SetMinimumSize"] = QLayout::SetMinimumSize;
constraints["SetMaximumSize"] = QLayout::SetMaximumSize;
constraints["SetMinAndMaxSize"] = QLayout::SetMinAndMaxSize;
constraints["SetNoConstraint"] = QLayout::SetNoConstraint;
QString sizeConstraintStr = context.selectString(node, "SizeConstraint");
if (constraints.contains(sizeConstraintStr)) {
pLayout->setSizeConstraint(constraints[sizeConstraintStr]);
} else {
qDebug() << "Could not parse SizeConstraint:" << sizeConstraintStr;
}
}
if (pLayout) {
setLayout(pLayout);
}
}
示例8: setup
void WNumber::setup(QDomNode node, const SkinContext& context) {
WLabel::setup(node, context);
// Number of digits after the decimal.
if (context.hasNode(node, "NumberOfDigits")) {
m_iNoDigits = context.selectInt(node, "NumberOfDigits");
}
setValue(0.);
}
示例9: setup
void WSearchLineEdit::setup(QDomNode node, const SkinContext& context) {
// Background color
QColor bgc(255,255,255);
if (context.hasNode(node, "BgColor")) {
bgc.setNamedColor(context.selectString(node, "BgColor"));
setAutoFillBackground(true);
}
QPalette pal = palette();
pal.setBrush(backgroundRole(), WSkinColor::getCorrectColor(bgc));
// Foreground color
m_fgc = QColor(0,0,0);
if (context.hasNode(node, "FgColor")) {
m_fgc.setNamedColor(context.selectString(node, "FgColor"));
}
bgc = WSkinColor::getCorrectColor(bgc);
m_fgc = QColor(255 - bgc.red(), 255 - bgc.green(), 255 - bgc.blue());
pal.setBrush(foregroundRole(), m_fgc);
setPalette(pal);
}
示例10: setup
void WSplitter::setup(QDomNode node, const SkinContext& context) {
// Default orientation is horizontal.
if (context.hasNode(node, "Orientation")) {
QString layout = context.selectString(node, "Orientation");
if (layout == "vertical") {
setOrientation(Qt::Vertical);
} else if (layout == "horizontal") {
setOrientation(Qt::Horizontal);
}
}
}
示例11: setup
void WKnobComposed::setup(QDomNode node, const SkinContext& context) {
clear();
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")));
}
// Set background pixmap if available
if (context.hasNode(node, "Knob")) {
setPixmapKnob(context.getSkinPath(context.selectString(node, "Knob")));
}
if (context.hasNode(node, "MinAngle")) {
m_dMinAngle = context.selectDouble(node, "MinAngle");
}
if (context.hasNode(node, "MaxAngle")) {
m_dMaxAngle = context.selectDouble(node, "MaxAngle");
}
}
示例12: setup
void WVuMeter::setup(QDomNode node, const SkinContext& context) {
// Set pixmaps
bool bHorizontal = context.hasNode(node, "Horizontal") &&
context.selectString(node, "Horizontal") == "true";
// Set background pixmap if available
if (context.hasNode(node, "PathBack")) {
QDomElement backPathNode = context.selectElement(node, "PathBack");
// The implicit default in <1.12.0 was FIXED so we keep it for backwards
// compatibility.
setPixmapBackground(context.getPixmapSource(backPathNode),
context.selectScaleMode(backPathNode, Paintable::FIXED));
}
QDomElement vuNode = context.selectElement(node, "PathVu");
// The implicit default in <1.12.0 was FIXED so we keep it for backwards
// compatibility.
setPixmaps(context.getPixmapSource(vuNode), bHorizontal,
context.selectScaleMode(vuNode, Paintable::FIXED));
m_iPeakHoldSize = context.selectInt(node, "PeakHoldSize");
if (m_iPeakHoldSize < 0 || m_iPeakHoldSize > 100)
m_iPeakHoldSize = DEFAULT_HOLDSIZE;
m_iPeakFallStep = context.selectInt(node, "PeakFallStep");
if (m_iPeakFallStep < 1 || m_iPeakFallStep > 1000)
m_iPeakFallStep = DEFAULT_FALLSTEP;
m_iPeakHoldTime = context.selectInt(node, "PeakHoldTime");
if (m_iPeakHoldTime < 1 || m_iPeakHoldTime > 3000)
m_iPeakHoldTime = DEFAULT_HOLDTIME;
m_iPeakFallTime = context.selectInt(node, "PeakFallTime");
if (m_iPeakFallTime < 1 || m_iPeakFallTime > 1000)
m_iPeakFallTime = DEFAULT_FALLTIME;
}
示例13: setup
void WKnobComposed::setup(QDomNode node, const SkinContext& context) {
clear();
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
QString mode_str = context.selectAttributeString(
context.selectElement(node, "BackPath"), "scalemode", "TILE");
setPixmapBackground(context.getPixmapPath(context.selectNode(node, "BackPath")),
Paintable::DrawModeFromString(mode_str));
}
// Set background pixmap if available
if (context.hasNode(node, "Knob")) {
setPixmapKnob(context.getPixmapPath(context.selectNode(node, "Knob")));
}
if (context.hasNode(node, "MinAngle")) {
m_dMinAngle = context.selectDouble(node, "MinAngle");
}
if (context.hasNode(node, "MaxAngle")) {
m_dMaxAngle = context.selectDouble(node, "MaxAngle");
}
}
示例14: setup
void WComboBox::setup(QDomNode node, const SkinContext& context) {
// Load pixmaps for associated states
QDomNode state = context.selectNode(node, "State");
while (!state.isNull()) {
if (state.isElement() && state.nodeName() == "State") {
if (!context.hasNode(state, "Number")) {
qDebug() << "WComboBox ignoring <State> without <Number> node.";
continue;
}
int iState = context.selectInt(state, "Number");
QString text = context.selectString(state, "Text");
QString icon = context.selectString(state, "Icon");
addItem(QIcon(icon), text, QVariant(iState));
}
state = state.nextSibling();
}
}
示例15: setTimeFormat
void WTime::setTimeFormat(QDomNode node, const SkinContext& context) {
// if a custom format is defined, all other formatting flags are ignored
if (!context.hasNode(node, "CustomFormat")) {
// check if seconds should be shown
QString secondsFormat = context.selectString(node, "ShowSeconds");
// long format is equivalent to showing seconds
QLocale::FormatType format;
if(secondsFormat == "true" || secondsFormat == "yes") {
format = QLocale::LongFormat;
m_iInterval = s_iSecondInterval;
} else {
format = QLocale::ShortFormat;
m_iInterval = s_iMinuteInterval;
}
m_sTimeFormat = QLocale().timeFormat(format);
} else {
// set the time format to the custom format
m_sTimeFormat = context.selectString(node, "CustomFormat");
}
}