Merge branch 'bugfixes' of https://github.com/OpenBoard-org/OpenBoard into bugfixes

preferencesAboutTextFull
Clément Fauconnier 7 years ago
commit 967d54d134
  1. 32
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 11
      src/domain/UBGraphicsGroupContainerItem.cpp
  3. 29
      src/domain/UBGraphicsItemDelegate.cpp
  4. 1
      src/domain/UBGraphicsItemDelegate.h

@ -975,6 +975,24 @@ UBGraphicsGroupContainerItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroup()
if(mStrokesList.contains(id))
shouldSkipSubElements = true;
QString ubLocked = mXmlReader.attributes().value(mNamespaceUri, "locked").toString();
if (!ubLocked.isEmpty())
{
bool isLocked = ubLocked.contains(xmlTrue);
group->setData(UBGraphicsItemData::ItemLocked, QVariant(isLocked));
}
QStringRef ubLayer = mXmlReader.attributes().value(mNamespaceUri, "layer");
if (!ubLayer.isNull())
{
bool ok;
int layerAsInt = ubLayer.toString().toInt(&ok);
if (ok)
group->setData(UBGraphicsItemData::ItemLayerType, QVariant(layerAsInt));
}
mXmlReader.readNext();
while (!mXmlReader.atEnd())
{
@ -1031,13 +1049,9 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::readGroupRoot()
}
else if (mXmlReader.isStartElement()) {
if (mXmlReader.name() == tGroup) {
QString ubLocked = mXmlReader.attributes().value(UBSettings::uniboardDocumentNamespaceUri, "locked").toString();
UBGraphicsGroupContainerItem *curGroup = readGroup();
if (!ubLocked.isEmpty())
{
bool isLocked = ubLocked.contains(xmlTrue);
curGroup->Delegate()->setLocked(isLocked);
}
if (curGroup) {
mScene->addGroup(curGroup);
}
@ -1400,6 +1414,10 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(UBDocumentProxy* proxy,
if(curElement.hasAttribute("locked")){
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri,"locked",curElement.attribute("locked"));
}
if(curElement.hasAttribute("layer")){
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri,"layer",curElement.attribute("layer"));
}
QDomElement curSubElement = curElement.firstChildElement();
while (!curSubElement.isNull()) {
if (curSubElement.hasAttribute(aId)) {
@ -1444,6 +1462,8 @@ void UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistGroupToDom(QGraphicsItem *gro
curGroupElement.setAttribute("locked", xmlTrue);
else
curGroupElement.setAttribute("locked", xmlFalse);
curGroupElement.setAttribute("layer", group->data(UBGraphicsItemData::ItemLayerType).toString());
}
curParent->appendChild(curGroupElement);
foreach (QGraphicsItem *item, groupItem->childItems()) {

@ -84,13 +84,24 @@ void UBGraphicsGroupContainerItem::addToGroup(QGraphicsItem *item)
if (!UBGraphicsItem::isLocked(this) && UBGraphicsItem::isLocked(item)) {
Delegate()->setLocked(true);
}
/*
if (data(UBGraphicsItemData::itemLayerType).toInt() != UBItemLayerType::Control
&& item->data(UBGraphicsItemData::itemLayerType).toInt() == UBItemLayerType::Control)
setData(UBGraphicsItemData::itemLayerType, UBItemLayerType::Control);
*/
//setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
}
else {
Delegate()->setUBFlag(GF_FLIPPABLE_ALL_AXIS, UBGraphicsItem::isFlippable(item));
Delegate()->setUBFlag(GF_REVOLVABLE, UBGraphicsItem::isRotatable(item));
Delegate()->setLocked(UBGraphicsItem::isLocked(item));
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
//setData(UBGraphicsItemData::itemLayerType, item->data(UBGraphicsItemData::itemLayerType));
}
qDebug() << item->data(UBGraphicsItemData::itemLayerType);
// COMBINE
bool ok;
QTransform itemTransform = item->itemTransform(this, &ok);

@ -565,25 +565,20 @@ void UBGraphicsItemDelegate::increaseZlevelBottom()
void UBGraphicsItemDelegate::lock(bool locked)
{
if (locked)
{
mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(true));
}
else
{
mDelegated->setData(UBGraphicsItemData::ItemLocked, QVariant(false));
}
setLockedRecurs(locked, mDelegated);
mDelegated->update();
positionHandles();
mFrame->positionHandles();
}
void UBGraphicsItemDelegate::showHideRecurs(const QVariant &pShow, QGraphicsItem *pItem)
void UBGraphicsItemDelegate::setLockedRecurs(const QVariant &pLock, QGraphicsItem *pItem)
{
pItem->setData(UBGraphicsItemData::ItemLayerType, pShow);
foreach (QGraphicsItem *insideItem, pItem->childItems()) {
showHideRecurs(pShow, insideItem);
pItem->setData(UBGraphicsItemData::ItemLocked, pLock);
foreach (QGraphicsItem *insideItem, pItem->childItems())
{
setLockedRecurs(pLock, insideItem);
}
}
@ -596,6 +591,14 @@ void UBGraphicsItemDelegate::showHide(bool show)
emit showOnDisplayChanged(show);
}
void UBGraphicsItemDelegate::showHideRecurs(const QVariant &pShow, QGraphicsItem *pItem)
{
pItem->setData(UBGraphicsItemData::ItemLayerType, pShow);
foreach (QGraphicsItem *insideItem, pItem->childItems()) {
showHideRecurs(pShow, insideItem);
}
}
/**
* @brief Set delegate as background for the scene, replacing any existing background.
*/

@ -326,6 +326,7 @@ class UBGraphicsItemDelegate : public QObject
virtual void updateMenuActionState();
void showHideRecurs(const QVariant &pShow, QGraphicsItem *pItem);
void setLockedRecurs(const QVariant &pLock, QGraphicsItem *pItem);
QList<DelegateButton*> buttons() {return mButtons;}
QGraphicsItem* mDelegated;

Loading…
Cancel
Save