void PropertiesEditorDialog::valueChanged(QtProperty *property, const QVariant &value) { if (!m_property_to_id.contains(property)) { return; } if (!m_canvas) { return; } QList<CanvasItem *> list = m_canvas->selectedItems(); m_canvas->beginUndoMacro(tr("Change Property")); if (list.empty()) { // Set the property directly on the canvas: m_canvas->setProperty(m_property_to_id[property].toLatin1().constData(), value); } else { // Otherwise, set it on the first item in the selection: CanvasItem *item = list.front(); item->setProperty(m_property_to_id[property].toLatin1().constData(), value); } }