本文整理汇总了C++中SkinContext::selectInt方法的典型用法代码示例。如果您正苦于以下问题:C++ SkinContext::selectInt方法的具体用法?C++ SkinContext::selectInt怎么用?C++ SkinContext::selectInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinContext
的用法示例。
在下文中一共展示了SkinContext::selectInt方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 WEffectButtonParameter::setup(QDomNode node, const SkinContext& context) {
bool rackOk = false;
int rackNumber = context.selectInt(node, "EffectRack", &rackOk) - 1;
bool chainOk = false;
int chainNumber = context.selectInt(node, "EffectUnit", &chainOk) - 1;
bool effectOk = false;
int effectNumber = context.selectInt(node, "Effect", &effectOk) - 1;
bool parameterOk = false;
int parameterNumber = context.selectInt(node, "EffectButtonParameter", ¶meterOk) - 1;
// Tolerate no <EffectRack>. Use the default one.
if (!rackOk) {
rackNumber = 0;
}
if (!chainOk) {
qDebug() << "EffectButtonParameterName node had invalid EffectUnit number:" << chainNumber;
}
if (!effectOk) {
qDebug() << "EffectButtonParameterName node had invalid Effect number:" << effectNumber;
}
if (!parameterOk) {
qDebug() << "EffectButtonParameterName node had invalid ButtonParameter number:" << parameterNumber;
}
EffectRackPointer pRack = m_pEffectsManager->getEffectRack(rackNumber);
if (pRack) {
EffectChainSlotPointer pChainSlot = pRack->getEffectChainSlot(chainNumber);
if (pChainSlot) {
EffectSlotPointer pEffectSlot = pChainSlot->getEffectSlot(effectNumber);
if (pEffectSlot) {
EffectParameterSlotBasePointer pParameterSlot =
pEffectSlot->getEffectButtonParameterSlot(parameterNumber);
if (pParameterSlot) {
setEffectParameterSlot(pParameterSlot);
} else {
qDebug() << "EffectButtonParameterName node had invalid ButtonParameter number:" << parameterNumber;
}
} else {
qDebug() << "EffectButtonParameterName node had invalid Effect number:" << effectNumber;
}
} else {
qDebug() << "EffectButtonParameterName node had invalid EffectUnit number:" << chainNumber;
}
} else {
qDebug() << "EffectButtonParameterName node had invalid EffectRack number:" << rackNumber;
}
}
示例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 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;
}
}
示例5: setup
void WBattery::setup(const QDomNode& node, const SkinContext& context) {
QDomElement backPath = context.selectElement(node, "BackPath");
if (!backPath.isNull()) {
setPixmap(&m_pPixmapBack,
context.getPixmapSource(backPath),
context.selectScaleMode(backPath, Paintable::TILE));
}
QDomElement unknownPath = context.selectElement(node, "PixmapUnknown");
if (!unknownPath.isNull()) {
setPixmap(&m_pPixmapUnknown,
context.getPixmapSource(unknownPath),
context.selectScaleMode(unknownPath, Paintable::TILE));
}
QDomElement chargedPath = context.selectElement(node, "PixmapCharged");
if (!chargedPath.isNull()) {
setPixmap(&m_pPixmapCharged,
context.getPixmapSource(chargedPath),
context.selectScaleMode(chargedPath, Paintable::TILE));
}
int numberStates = context.selectInt(node, "NumberStates");
if (numberStates < 0) {
numberStates = 0;
}
m_chargingPixmaps.resize(numberStates);
m_dischargingPixmaps.resize(numberStates);
QDomElement pixmapsCharging = context.selectElement(node, "PixmapsCharging");
if (!pixmapsCharging.isNull()) {
// TODO(XXX) inline SVG support via context.getPixmapSource.
QString chargingPath = context.nodeToString(pixmapsCharging);
Paintable::DrawMode mode = context.selectScaleMode(pixmapsCharging,
Paintable::TILE);
for (int i = 0; i < m_chargingPixmaps.size(); ++i) {
PixmapSource source = context.getPixmapSource(chargingPath.arg(i));
setPixmap(&m_chargingPixmaps[i], source, mode);
}
}
QDomElement pixmapsDischarging = context.selectElement(node, "PixmapsDischarging");
if (!pixmapsDischarging.isNull()) {
// TODO(XXX) inline SVG support via context.getPixmapSource.
QString dischargingPath = context.nodeToString(pixmapsDischarging);
Paintable::DrawMode mode = context.selectScaleMode(pixmapsDischarging,
Paintable::TILE);
for (int i = 0; i < m_dischargingPixmaps.size(); ++i) {
PixmapSource source = context.getPixmapSource(dischargingPath.arg(i));
setPixmap(&m_dischargingPixmaps[i], source, mode);
}
}
if (m_pBattery) {
m_pBattery->update();
}
}
示例6: 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.);
}
示例7: setup
void WVuMeter::setup(const QDomNode& node, const SkinContext& context) {
// Set pixmaps
bool bHorizontal = false;
(void)context.hasNodeSelectBool(node, "Horizontal", &bHorizontal);
// Set background pixmap if available
QDomElement backPathNode = context.selectElement(node, "PathBack");
if (!backPathNode.isNull()) {
// 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;
}
}
示例8: 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();
}
}
示例9: setup
void WStatusLight::setup(const 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);
QDomElement statusLightNode;
if (context.hasNodeSelectElement(node, nodeName, &statusLightNode) ||
(i == 0 && context.hasNodeSelectElement(node, "PathBack", &statusLightNode)) ||
(i == 1 && context.hasNodeSelectElement(node, "PathStatusLight", &statusLightNode))) {
setPixmap(i, context.getPixmapSource(statusLightNode),
context.selectScaleMode(statusLightNode, Paintable::FIXED));
} else {
m_pixmaps[i].clear();
}
}
}
示例10: setup
void WDisplay::setup(const QDomNode& node, const SkinContext& context) {
// Set background pixmap if available
QDomElement backPathNode = context.selectElement(node, "BackPath");
if (!backPathNode.isNull()) {
setPixmapBackground(context.getPixmapSource(backPathNode),
context.selectScaleMode(backPathNode, Paintable::TILE));
}
// Number of states
setPositions(context.selectInt(node, "NumberStates"));
// Load knob pixmaps
QDomElement pathNode = context.selectElement(node, "Path");
QString path = context.nodeToString(pathNode);
// The implicit default in <1.12.0 was FIXED so we keep it for
// backwards compatibility.
Paintable::DrawMode pathMode =
context.selectScaleMode(pathNode, Paintable::FIXED);
for (int i = 0; i < m_pixmaps.size(); ++i) {
setPixmap(&m_pixmaps, i, context.getSkinPath(path.arg(i)), pathMode);
}
// See if disabled images is defined, and load them...
QDomElement disabledNode = context.selectElement(node, "DisabledPath");
if (!disabledNode.isNull()) {
QString disabledPath = context.nodeToString(disabledNode);
// The implicit default in <1.12.0 was FIXED so we keep it for
// backwards compatibility.
Paintable::DrawMode disabledMode =
context.selectScaleMode(disabledNode, Paintable::FIXED);
for (int i = 0; i < m_disabledPixmaps.size(); ++i) {
setPixmap(&m_disabledPixmaps, i,
context.getSkinPath(disabledPath.arg(i)), disabledMode);
}
m_bDisabledLoaded = true;
}
}
示例11: setup
void WPushButton::setup(QDomNode node, const SkinContext& context) {
// Number of states
int iNumStates = context.selectInt(node, "NumberStates");
setStates(iNumStates);
// Set background pixmap if available
if (context.hasNode(node, "BackPath")) {
QString mode_str = context.selectAttributeString(
context.selectElement(node, "BackPath"), "scalemode", "TILE");
setPixmapBackground(context.getSkinPath(context.selectString(node, "BackPath")),
Paintable::DrawModeFromString(mode_str));
}
// Load pixmaps for associated states
QDomNode state = context.selectNode(node, "State");
while (!state.isNull()) {
if (state.isElement() && state.nodeName() == "State") {
int iState = context.selectInt(state, "Number");
if (iState < m_iNoStates) {
if (context.hasNode(state, "Pressed")) {
setPixmap(iState, true,
context.getSkinPath(context.selectString(state, "Pressed")));
}
if (context.hasNode(state, "Unpressed")) {
setPixmap(iState, false,
context.getSkinPath(context.selectString(state, "Unpressed")));
}
m_text.replace(iState, context.selectString(state, "Text"));
}
}
state = state.nextSibling();
}
ControlParameterWidgetConnection* leftConnection = NULL;
if (m_leftConnections.isEmpty()) {
if (!m_connections.isEmpty()) {
// If no left connection is set, the this is the left connection
leftConnection = m_connections.at(0);
}
} else {
leftConnection = m_leftConnections.at(0);
}
if (leftConnection) {
bool leftClickForcePush = context.selectBool(node, "LeftClickIsPushButton", false);
m_leftButtonMode = ControlPushButton::PUSH;
if (!leftClickForcePush) {
const ConfigKey& configKey = leftConnection->getKey();
ControlPushButton* p = dynamic_cast<ControlPushButton*>(
ControlObject::getControl(configKey));
if (p) {
m_leftButtonMode = p->getButtonMode();
}
}
if (leftConnection->getEmitOption() &
ControlParameterWidgetConnection::EMIT_DEFAULT) {
switch (m_leftButtonMode) {
case ControlPushButton::PUSH:
case ControlPushButton::LONGPRESSLATCHING:
case ControlPushButton::POWERWINDOW:
leftConnection->setEmitOption(
ControlParameterWidgetConnection::EMIT_ON_PRESS_AND_RELEASE);
break;
default:
leftConnection->setEmitOption(
ControlParameterWidgetConnection::EMIT_ON_PRESS);
break;
}
}
if (leftConnection->getDirectionOption() &
ControlParameterWidgetConnection::DIR_DEFAULT) {
if (m_pDisplayConnection == leftConnection) {
leftConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_FROM_AND_TO_WIDGET);
} else {
leftConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_FROM_WIDGET);
if (m_pDisplayConnection->getDirectionOption() &
ControlParameterWidgetConnection::DIR_DEFAULT) {
m_pDisplayConnection->setDirectionOption(ControlParameterWidgetConnection::DIR_TO_WIDGET);
}
}
}
}
if (!m_rightConnections.isEmpty()) {
ControlParameterWidgetConnection* rightConnection = m_rightConnections.at(0);
bool rightClickForcePush = context.selectBool(node, "RightClickIsPushButton", false);
m_rightButtonMode = ControlPushButton::PUSH;
if (!rightClickForcePush) {
const ConfigKey configKey = rightConnection->getKey();
ControlPushButton* p = dynamic_cast<ControlPushButton*>(
ControlObject::getControl(configKey));
if (p) {
m_rightButtonMode = p->getButtonMode();
if (m_rightButtonMode != ControlPushButton::PUSH) {
qWarning()
<< "WPushButton::setup: Connecting a Pushbutton not in PUSH mode is not implemented\n"
<< "Please set <RightClickIsPushButton>true</RightClickIsPushButton>";
}
}
}
//.........这里部分代码省略.........
示例12: setup
void WBattery::setup(QDomNode node, const SkinContext& context) {
if (context.hasNode(node, "BackPath")) {
QString mode_str = context.selectAttributeString(
context.selectElement(node, "BackPath"), "scalemode", "TILE");
setPixmap(&m_pPixmapBack,
context.getPixmapSource(context.selectNode(node, "BackPath")),
Paintable::DrawModeFromString(mode_str));
}
if (context.hasNode(node, "PixmapUnknown")) {
QString mode_str = context.selectAttributeString(
context.selectElement(node, "PixmapUnknown"), "scalemode", "TILE");
setPixmap(&m_pPixmapUnknown,
context.getPixmapSource(context.selectNode(node, "PixmapUnknown")),
Paintable::DrawModeFromString(mode_str));
}
if (context.hasNode(node, "PixmapCharged")) {
QString mode_str = context.selectAttributeString(
context.selectElement(node, "PixmapCharged"), "scalemode", "TILE");
setPixmap(&m_pPixmapCharged,
context.getPixmapSource(context.selectNode(node, "PixmapCharged")),
Paintable::DrawModeFromString(mode_str));
}
int numberStates = context.selectInt(node, "NumberStates");
if (numberStates < 0) {
numberStates = 0;
}
m_chargingPixmaps.resize(numberStates);
m_dischargingPixmaps.resize(numberStates);
if (context.hasNode(node, "PixmapsCharging")) {
// TODO(XXX) inline SVG support via context.getPixmapSource.
QString chargingPath = context.selectString(node, "PixmapsCharging");
Paintable::DrawMode mode = Paintable::DrawModeFromString(
context.selectAttributeString(
context.selectElement(node, "PixmapsCharging"),
"scalemode", "TILE"));
for (int i = 0; i < m_chargingPixmaps.size(); ++i) {
PixmapSource source(chargingPath.arg(i));
setPixmap(&m_chargingPixmaps[i], source, mode);
}
}
if (context.hasNode(node, "PixmapsDischarging")) {
// TODO(XXX) inline SVG support via context.getPixmapSource.
QString dischargingPath = context.selectString(node, "PixmapsDischarging");
Paintable::DrawMode mode = Paintable::DrawModeFromString(
context.selectAttributeString(
context.selectElement(node, "PixmapsDischarging"),
"scalemode", "TILE"));
for (int i = 0; i < m_dischargingPixmaps.size(); ++i) {
PixmapSource source(dischargingPath.arg(i));
setPixmap(&m_dischargingPixmaps[i], source, mode);
}
}
if (m_pBattery) {
m_pBattery->update();
}
}