mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-09 13:34:14 +02:00
3a50cd9b0e
Now that they carry a uuid, the folio's drawing furniture gets rows of its own: shape, independent_text and image, plus drawing_item_view, which finds any of them by uuid without knowing its kind first and says which folio it is on. Rows follow edits, not just loads. The script API's query() and every other reader go through newQuery() without a rebuild, so an item's row is queued on each change (moves, restyles, text edits, uuid renewal) and the queue is flushed by newQuery() and updateDB() -- a queued write is a set insertion, which matters for a drag that moves hundreds of items per mouse step. A pasted copy joins its folio still carrying its source's uuid and is only renewed afterwards, so a flush in between must not let the copy overwrite its source's row. Each row remembers the item that wrote it; another item with the same uuid waits until uuidChanged() says it has its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
60 lines
1.7 KiB
C++
60 lines
1.7 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef INDEPENDENT_TEXT_ITEM_H
|
|
#define INDEPENDENT_TEXT_ITEM_H
|
|
|
|
#include "diagramtextitem.h"
|
|
|
|
#include <QUuid>
|
|
|
|
/**
|
|
This class represents an independent text field on a particular diagram.
|
|
It may be moved, edited, and rotated.
|
|
*/
|
|
class IndependentTextItem : public DiagramTextItem
|
|
{
|
|
Q_OBJECT
|
|
|
|
// constructors, destructor
|
|
signals:
|
|
void uuidChanged();
|
|
|
|
public:
|
|
IndependentTextItem();
|
|
IndependentTextItem(const QString &);
|
|
~IndependentTextItem() override;
|
|
|
|
// attributes
|
|
public:
|
|
enum { Type = UserType + 1005 };
|
|
int type() const override { return Type; }
|
|
|
|
void fromXml(const QDomElement &) override;
|
|
QDomElement toXml(QDomDocument &) const override;
|
|
QUuid uuid() const {return m_uuid;}
|
|
void setUuid(const QUuid &uuid) {m_uuid = uuid; emit uuidChanged();}
|
|
void newUuid() {setUuid(QUuid::createUuid());} //create new uuid for this item
|
|
|
|
protected:
|
|
void focusOutEvent(QFocusEvent *event) override;
|
|
|
|
private:
|
|
QUuid m_uuid = QUuid::createUuid();
|
|
};
|
|
#endif
|