Exemple #1
0
void SchedScene::clickItem(size_t id)
{
    if (!selected_.is_initialized())
    {
        selectItem(id);
    }
    else if (*selected_ == id)
    {
        deselectItem();
    }
    else
    {
        swapItems(*selected_, id);
        deselectItem();
    }
}
BoxTextGraphicsItem::BoxTextGraphicsItem(QGraphicsItem *parent)
    : BoxGraphicsItem(parent)
{
    m_gi = new TextGraphicsItem(shapeItem());
    m_gi->setTextInteractionFlags(Qt::TextEditable);
    m_gi->setDefaultTextColor(QColor(69, 70, 68));
    m_gi->setFocus();

    connect(m_gi, SIGNAL(focusGain()),
            this, SLOT(deselectItem()));
    connect(m_gi, SIGNAL(textChanged()),
            this, SLOT(adaptHeight()));
}