本文整理汇总了C++中Capability::hi方法的典型用法代码示例。如果您正苦于以下问题:C++ Capability::hi方法的具体用法?C++ Capability::hi怎么用?C++ Capability::hi使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Capability
的用法示例。
在下文中一共展示了Capability::hi方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextMenuEvent
void ConsoleChannel::contextMenuEvent(QContextMenuEvent* e)
{
QString s;
QString t;
Capability* c = NULL;
Device* device = _app->doc()->device(m_deviceID);
assert(device);
LogicalChannel* ch = device->deviceClass()->channels()->at(m_channel);
QPopupMenu* menu = new QPopupMenu();
menu->insertItem(ch->name(), KMenuTitle);
menu->setItemEnabled(KMenuTitle, false);
menu->insertSeparator();
QPtrListIterator<Capability> it(*ch->capabilities());
QPopupMenu* valueMenu = NULL;
while (it.current())
{
c = it.current();
// Set the value range and name as menu item's name
s.sprintf("%.3d - %.3d:", c->lo(), c->hi());
s += c->name();
// Create a submenu for ranges that contain more than one value
if (c->hi() - c->lo() > 0)
{
valueMenu = new QPopupMenu(menu);
connect(valueMenu, SIGNAL(activated(int)),
this, SLOT(slotContextMenuActivated(int)));
for (int i = c->lo(); i <= c->hi(); i++)
{
t.sprintf("%.3d", i);
valueMenu->insertItem(t, i);
}
menu->insertItem(s, valueMenu);
}
else
{
示例2: slotPresetComboActivated
void EditSceneValue::slotPresetComboActivated(const QString &text)
{
if (m_updateValue == false)
{
return;
}
m_updateValue = false;
Capability* c = m_channel->searchCapability(text);
ASSERT(c != NULL);
int value = (int) floor((c->lo() + c->hi()) / 2);
m_valueSpin->setValue(value);
m_value = value;
m_updateValue = true;
}