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


C++ QLCInputChannel::setName方法代码示例

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


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

示例1: name

void QLCInputChannel_Test::name()
{
	QLCInputChannel ch;
	QVERIFY(ch.name() == QString::null);
	ch.setName("Foobar");
	QVERIFY(ch.name() == "Foobar");
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例2: slotAddClicked

void InputProfileEditor::slotAddClicked()
{
    QLCInputChannel* channel = new QLCInputChannel();
    InputChannelEditor ice(this, m_profile, channel);
add:
    if (ice.exec() == QDialog::Accepted)
    {
        channel->setType(ice.type());
        channel->setName(ice.name());

        if (m_profile->channel(ice.channel()) == NULL)
        {
            m_profile->insertChannel(ice.channel(), channel);
            updateChannelItem(new QTreeWidgetItem(m_tree), channel);
        }
        else
        {
            QMessageBox::warning(this,
                                 tr("Channel already exists"),
                                 tr("Channel %1 already exists")
                                 .arg(ice.channel() + 1));
            goto add;
        }
    }
    else
    {
        delete channel;
    }
}
开发者ID:lelazary,项目名称:qlcplus,代码行数:29,代码来源:inputprofileeditor.cpp

示例3: copy

void QLCInputChannel_Test::copy()
{
	QLCInputChannel ch;
	ch.setType(QLCInputChannel::Slider);
	ch.setName("Foobar");

	QLCInputChannel copy(ch);
	QVERIFY(copy.type() == QLCInputChannel::Slider);
	QVERIFY(copy.name() == "Foobar");

	QLCInputChannel another = ch;
	QVERIFY(another.type() == QLCInputChannel::Slider);
	QVERIFY(another.name() == "Foobar");
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例4: slotInputValueChanged

void InputProfileEditor::slotInputValueChanged(quint32 universe,
                                               quint32 channel,
                                               uchar value,
                                               const QString& key)
{
    QTreeWidgetItem* latestItem = NULL;

    Q_UNUSED(universe);

    /* Get a list of items that represent the given channel. Basically
       the list should always contain just one item. */
    QList <QTreeWidgetItem*> list;
    if (channel == UINT_MAX && key.isEmpty() == false)
        list = m_tree->findItems(key, Qt::MatchExactly, KColumnName);
    else
        list = m_tree->findItems(QString("%1").arg(channel + 1), Qt::MatchExactly,
                             KColumnNumber);
    if (list.size() != 0)
        latestItem = list.first();

    if (list.size() == 0 && m_wizardActive == true)
    {
        /* No channel items found. Create a new channel to the
           profile and display it also in the tree widget */
        QLCInputChannel* ch = new QLCInputChannel();
        if(key.isEmpty())
            ch->setName(tr("Button %1").arg(channel + 1));
        else
            ch->setName(key);
        ch->setType(QLCInputChannel::Button);
        m_profile->insertChannel(channel, ch);

        latestItem = new QTreeWidgetItem(m_tree);
        updateChannelItem(latestItem, ch);
    }
    else if (m_wizardActive == true)
    {
        /* Existing channel & item found. Modify their contents. */
        latestItem = list.first();
        QVariant var = latestItem->data(KColumnValues, Qt::UserRole);
        QStringList values(var.toStringList());

        if (values.size() > 3)
        {
            /* No need to collect any more values, since this channel has
               been judged to be a slider when count == 3 (see below). */
        }
        else if (values.contains(QString("%1").arg(value)) == false)
        {
            values << QString("%1").arg(value);
            values.sort();
            latestItem->setData(KColumnValues, Qt::UserRole, values);
        }

        /* Change the channel type only the one time when its value
           count goes over 2. I.e. when a channel can have more than
           two distinct values, it can no longer be a button. */
        if (values.size() == 3)
        {
            QLCInputChannel* ch = m_profile->channel(channel);
            Q_ASSERT(ch != NULL);

            if (ch->type() == QLCInputChannel::Button)
            {
                ch->setType(QLCInputChannel::Slider);
                if(key.isEmpty())
                    ch->setName(tr("Slider %1").arg(channel + 1));
                else
                    ch->setName(key);
                updateChannelItem(latestItem, ch);
            }
        }
    }

    if (latestItem != NULL)
    {
        if (m_latestItem != NULL)
            m_latestItem->setIcon(KColumnNumber, QIcon());
        m_latestItem = latestItem;
        m_latestItem->setIcon(KColumnNumber, QIcon(":/input.png"));
        m_tree->scrollToItem(m_latestItem);
        m_timer->start(250);
    }
}
开发者ID:lelazary,项目名称:qlcplus,代码行数:84,代码来源:inputprofileeditor.cpp

示例5: slotEditClicked

void InputProfileEditor::slotEditClicked()
{
    QLCInputChannel* channel;
    quint32 chnum;
    QTreeWidgetItem* item;

    if (m_tree->selectedItems().count() == 1)
    {
        /* Just one item selected. Edit that. */
        item = m_tree->currentItem();
        if (item == NULL)
            return;

        /* Find the channel object associated to the selected item */
        chnum = item->text(KColumnNumber).toUInt() - 1;
        channel = m_profile->channel(chnum);
        Q_ASSERT(channel != NULL);

        /* Edit the channel and update its item if necessary */
        InputChannelEditor ice(this, m_profile, channel);
edit:
        if (ice.exec() == QDialog::Accepted)
        {
            QLCInputChannel* another;
            another = m_profile->channel(ice.channel());

            if (another == NULL || another == channel)
            {
                if (ice.channel() != QLCChannel::invalid())
                    m_profile->remapChannel(channel, ice.channel());
                if (ice.name().isEmpty() == false)
                    channel->setName(ice.name());
                if (ice.type() != QLCInputChannel::NoType)
                    channel->setType(ice.type());

                updateChannelItem(item, channel);
            }
            else
            {
                QMessageBox::warning(this,
                                     tr("Channel already exists"),
                                     tr("Channel %1 already exists")
                                     .arg(ice.channel() + 1));
                goto edit;
            }
        }
    }
    else if (m_tree->selectedItems().count() > 1)
    {
        /* Multiple channels selected. Apply changes to all of them */
        InputChannelEditor ice(this, NULL, NULL);
        if (ice.exec() == QDialog::Accepted)
        {
            QListIterator <QTreeWidgetItem*>
            it(m_tree->selectedItems());
            while (it.hasNext() == true)
            {
                item = it.next();
                Q_ASSERT(item != NULL);

                chnum = item->text(KColumnNumber).toUInt() - 1;
                channel = m_profile->channel(chnum);
                Q_ASSERT(channel != NULL);

                /* Set only name and type and only if they
                   have been modified. */
                if (ice.name().isEmpty() == false)
                    channel->setName(ice.name());
                if (ice.type() != QLCInputChannel::NoType)
                    channel->setType(ice.type());

                updateChannelItem(item, channel);
            }
        }
    }
}
开发者ID:lelazary,项目名称:qlcplus,代码行数:76,代码来源:inputprofileeditor.cpp


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