From 1f256e67cc6256f3634d11352bc660c1c31b2f3c Mon Sep 17 00:00:00 2001
From: Pos <pierpaolo.mancini@mail.polimi.it>
Date: Wed, 9 Dec 2020 19:31:30 +0100
Subject: [PATCH] Completed image viewer module item system
---
Core/xmlobject.cpp | 10 ++
Core/xmlobject.h | 1 +
Modules/ImageViewer/customgraphicsscene.cpp | 1 +
Modules/ImageViewer/imagevieweritem.cpp | 70 +++++++---
Modules/ImageViewer/imagevieweritem.h | 9 +-
Modules/ImageViewer/imageviewermodule.cpp | 89 +++++++++++--
Modules/ImageViewer/imageviewermodule.h | 6 +-
Modules/ImageViewer/imageviewersettings.cpp | 136 ++++++++++++++------
Modules/ImageViewer/imageviewersettings.h | 8 +-
Modules/ImageViewer/imageviewersettings.ui | 39 ++++--
SkywardHub.pro.user | 2 +-
11 files changed, 289 insertions(+), 82 deletions(-)
diff --git a/Core/xmlobject.cpp b/Core/xmlobject.cpp
index 25100ad6..503a261e 100644
--- a/Core/xmlobject.cpp
+++ b/Core/xmlobject.cpp
@@ -285,6 +285,16 @@ XmlObject XmlObject::childAt(int index) const
return childList.at(index);
}
+XmlObject XmlObject::searchChild(const QString &name) const
+{
+ for(int i= 0; i < childCount(); i++){
+ if(childList[i].getObjectName() == name){
+ return childList[i];
+ }
+ }
+ return XmlObject();
+}
+
XmlObject * XmlObject::getChild(int index)
{
return &childList[index];
diff --git a/Core/xmlobject.h b/Core/xmlobject.h
index 885dd7a0..73505c8d 100644
--- a/Core/xmlobject.h
+++ b/Core/xmlobject.h
@@ -44,6 +44,7 @@ public:
int childCount() const;
XmlObject childAt(int index) const;
+ XmlObject searchChild(const QString &name) const;
/*
* getChild Returns the child at index position as a modifiable reference.
* index must be a valid index position in the list
diff --git a/Modules/ImageViewer/customgraphicsscene.cpp b/Modules/ImageViewer/customgraphicsscene.cpp
index e7ce2887..3520d1f7 100644
--- a/Modules/ImageViewer/customgraphicsscene.cpp
+++ b/Modules/ImageViewer/customgraphicsscene.cpp
@@ -53,6 +53,7 @@ void CustomGraphicsScene::removeImageViewItem(int id)
void CustomGraphicsScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
+ Q_UNUSED(event);
isDragActive = false;
emit dragStopped();
}
diff --git a/Modules/ImageViewer/imagevieweritem.cpp b/Modules/ImageViewer/imagevieweritem.cpp
index 5189f3d5..e6e7dfc0 100644
--- a/Modules/ImageViewer/imagevieweritem.cpp
+++ b/Modules/ImageViewer/imagevieweritem.cpp
@@ -21,12 +21,30 @@ ImageViewerItem::ImageViewerItem(const ImageViewerItem &other) : ImageViewerItem
QString ImageViewerItem::getText() const
{
- return text;
+ XmlObject text = xml.searchChild("text");
+ if(text.isEmpty())
+ return defaultText;
+ return text.getTextValue();
+}
+
+
+XmlObject *ImageViewerItem::findOrAddXmlObject(const QString &xmlChildName)
+{
+ QList<XmlObject*> childs = xml.deepSearchObjects(xmlChildName);
+ if(childs.isEmpty()){
+ XmlObject c(xmlChildName);
+ int childIndex = xml.addChild(c);
+ return xml.getChild(childIndex);
+ }
+ else{
+ return childs[0];
+ }
}
void ImageViewerItem::setText(const QString &value)
{
- text = value;
+ XmlObject *text = findOrAddXmlObject("text");
+ text->setTextValue(value);
}
void ImageViewerItem::setCenter(const QPointF ¢er)
@@ -111,6 +129,17 @@ void ImageViewerItem::stopDrag()
isDragActive = false;
}
+void ImageViewerItem::onModuleMessageReceived(const ModuleMessage &msg)
+{
+ setText(msg.payload());
+}
+
+QString ImageViewerItem::getTopic() const
+{
+ XmlObject topic = xml.searchChild("topic");
+ return topic.getTextValue();
+}
+
void ImageViewerItem::copy(const ImageViewerItem &other)
{
setId(other.getId());
@@ -127,24 +156,23 @@ void ImageViewerItem::setTopLeftCornerPosition(const QPointF &value)
void ImageViewerItem::initialize()
{
xml.setObjectName("svg");
- QSize s = getSize();
-// QString size = "0 0 "+ QString::number(s.width()) +" " + QString::number(s.height());
-// xml.addAttribute("viewBox", size );
+ QSize s = defaultSize;
xml.addAttribute("height", QString::number(s.height()));
xml.addAttribute("width", QString::number(s.width()));
- XmlObject rect("rect");
- QString style = "fill:none;"
- "stroke-width:4;"
- "stroke:"+ getCurrentBorderColor() +";";
+ XmlObject rect("rect");
rect.addAttribute("height", QString::number(s.height()));
- rect.addAttribute("width", QString::number(s.width()));
- rect.addAttribute("style", style);
+ rect.addAttribute("width", QString::number(s.width()));
+ rect.addAttribute("fill", "none");
+ rect.addAttribute("stroke", getCurrentBorderColor());
+ rect.addAttribute("stroke-width", "2");
XmlObject text("text");
- text.addAttribute("x",1);
- text.addAttribute("y",10);
- text.setTextValue(getText());
+ text.addAttribute("x",5);
+ text.addAttribute("y",20);
+ text.addAttribute("fill", "#000000");
+ text.addAttribute("font-size", "20");
+ text.setTextValue(defaultText);
xml.addChild(text);
xml.addChild(rect);
@@ -158,6 +186,13 @@ void ImageViewerItem::setXml(const XmlObject &value)
if(xml.getIntAttribute("height", height) && xml.getIntAttribute("width", width)){
setSize(width, height);
}
+
+
+ QList<XmlObject*> childs = xml.deepSearchObjects("text");
+ if(!childs.isEmpty()){
+ XmlObject *text = childs[0];
+ setText(text->getTextValue());
+ }
}
QString ImageViewerItem::getCurrentBorderColor() const
@@ -179,12 +214,15 @@ void ImageViewerItem::setClicked(bool value)
QSize ImageViewerItem::getSize() const
{
- return size;
+ int height, width;
+ if(xml.getIntAttribute("height", height) && xml.getIntAttribute("width", width)){
+ return QSize(width, height);
+ }
+ return defaultSize;
}
void ImageViewerItem::setSize(const QSize &value)
{
- size = value;
xml.addAttribute("height", value.height());
xml.addAttribute("width", value.width());
diff --git a/Modules/ImageViewer/imagevieweritem.h b/Modules/ImageViewer/imagevieweritem.h
index f470fcae..6ae4f9e3 100644
--- a/Modules/ImageViewer/imagevieweritem.h
+++ b/Modules/ImageViewer/imagevieweritem.h
@@ -5,6 +5,7 @@
#include <QPoint>
#include <QSize>
#include "Core/xmlobject.h"
+#include "Core/modulemessage.h"
class ImageViewerItem
{
@@ -19,9 +20,11 @@ public:
bool isPointInsideMyArea(const QPointF &point);
void startDrag(const QPointF &initialPosition);
void stopDrag();
+ void onModuleMessageReceived(const ModuleMessage &msg);
// getters/setters
+ QString getTopic() const;
QPointF getTopLeftCornerPosition() const;
QSize getSize() const;
void setSize(const QSize &value);
@@ -44,14 +47,16 @@ protected:
void setTopLeftCornerPosition(const QPointF &value);
void initialize();
+ XmlObject *findOrAddXmlObject(const QString &xmlChildName);
+
private:
int id = -1;
- QString text = "";
QPointF topLeftCornerPosition;
- QSize size = QSize(10, 10);
const QString defaultBorderColor = "#000000";
const QString clickedBorderColor = "#32a83a";
+ const QSize defaultSize = QSize(250, 150);
+ const QString defaultText = "New item";
bool clicked = false;
QPointF dragOffset;
diff --git a/Modules/ImageViewer/imageviewermodule.cpp b/Modules/ImageViewer/imageviewermodule.cpp
index b0103f31..9a1e7e93 100644
--- a/Modules/ImageViewer/imageviewermodule.cpp
+++ b/Modules/ImageViewer/imageviewermodule.cpp
@@ -22,6 +22,8 @@ ImageViewerModule::ImageViewerModule(QWidget *parent) : DefaultModule(parent), u
connect(&scene, &CustomGraphicsScene::dragStopped, this, &ImageViewerModule::onDragStopped);
connect(&scene, &CustomGraphicsScene::doubleCLick, this, &ImageViewerModule::onDoubleClick);
connect(&settingsPanel, &ImageViewerSettings::setupSettingsToSelected, this, &ImageViewerModule::onSettingsSetupRequested);
+ connect(&settingsPanel, &ImageViewerSettings::setupSettingsToAll, this, &ImageViewerModule::onSettingsSetupToAllRequested);
+ connect(&settingsPanel, &ImageViewerSettings::deleteItemRequested, this, &ImageViewerModule::onItemDeleteRequested);
}
ImageViewerModule::~ImageViewerModule()
@@ -220,15 +222,15 @@ void ImageViewerModule::onTopicChanged(const QString &labelName, const QString &
});
}
-void ImageViewerModule::onReceiveMsg(const ModuleMessage &msg)
-{
- if(labelsSubscriptions.contains(msg.topic())){
- QString labelName = labelsSubscriptions[msg.topic()];
- if(labels.contains(labelName)){
- setLabelText(labels[labelName], msg.payload());
- }
- }
-}
+//void ImageViewerModule::onReceiveMsg(const ModuleMessage &msg)
+//{
+// if(labelsSubscriptions.contains(msg.topic())){
+// QString labelName = labelsSubscriptions[msg.topic()];
+// if(labels.contains(labelName)){
+// setLabelText(labels[labelName], msg.payload());
+// }
+// }
+//}
void ImageViewerModule::setLabelText(QGraphicsTextItem *label, const QString &txt)
{
@@ -278,11 +280,12 @@ void ImageViewerModule::onImageFilePathChanged(const QString &newFilePath)
}
+
// NEW IMPLEMENTATION ______________________________________________
void ImageViewerModule::onAddNewItemRequested()
{
- addNewItem(QPointF(100, 100));
+ addNewItem(QPointF(200, 100));
}
void ImageViewerModule::onMouseMoved(const QPointF &point)
@@ -353,7 +356,6 @@ ImageViewerItem *ImageViewerModule::createNewItem(const QPointF &point)
{
ImageViewerItem* newItem = new ImageViewerItem();
newItem->setId(pickUnusedItemId());
- newItem->setSize(240, 80);
newItem->setCenter(point);
return newItem;
}
@@ -374,7 +376,72 @@ void ImageViewerModule::onSettingsSetupRequested(int id)
{
if(imageViewerItems.contains(id)){
ImageViewerItem* item = imageViewerItems[id];
+ QString previousTopic = item->getTopic();
+ item->setXml(settingsPanel.getDefaultSettings());
+ scene.updateImageViewItem(item);
+
+ if(item->getTopic() != previousTopic){
+ onItemTopicChanged(item);
+ }
+ }
+}
+
+void ImageViewerModule::onSettingsSetupToAllRequested()
+{
+ for(int key : imageViewerItems.keys()){
+ ImageViewerItem* item = imageViewerItems[key];
+ QString previousText = item->getText();
+ QString previousTopic = item->getTopic();
item->setXml(settingsPanel.getDefaultSettings());
+ item->setText(previousText);
scene.updateImageViewItem(item);
+
+ if(item->getTopic() != previousTopic){
+ onItemTopicChanged(item);
+ }
}
}
+
+void ImageViewerModule::onItemTopicChanged(ImageViewerItem *item)
+{
+ if(topicMap.contains(item->getId())){
+ QString oldTopic = topicMap[item->getId()];
+ getCore()->getModuleMessagesBroker()->unsubscribe(oldTopic,this);
+ topicMap.remove(item->getId());
+ }
+
+ QString newTopic = item->getTopic();
+ if(newTopic != ""){
+ topicMap[item->getId()] = newTopic;
+ getCore()->getModuleMessagesBroker()->subscribe(newTopic,this, [this](const ModuleMessage &msg){
+ this->onReceiveMsg(msg);
+ });
+ }
+}
+
+void ImageViewerModule::onReceiveMsg(const ModuleMessage &msg)
+{
+ QList<int> keys = topicMap.keys();
+ for(int key : keys){
+ if(msg.topic() == topicMap[key] && imageViewerItems.contains(key)){
+ ImageViewerItem *item = imageViewerItems[key];
+ item->onModuleMessageReceived(msg);
+ scene.updateImageViewItem(item);
+ }
+ }
+}
+
+void ImageViewerModule::onItemDeleteRequested(int itemId)
+{
+ if(imageViewerItems.contains(itemId)){
+ delete imageViewerItems[itemId];
+ imageViewerItems.remove(itemId);
+ }
+
+ if(topicMap.contains(itemId)){
+ topicMap.remove(itemId);
+ }
+
+ scene.removeImageViewItem(itemId);
+}
+
diff --git a/Modules/ImageViewer/imageviewermodule.h b/Modules/ImageViewer/imageviewermodule.h
index ee73698a..a002aa4c 100644
--- a/Modules/ImageViewer/imageviewermodule.h
+++ b/Modules/ImageViewer/imageviewermodule.h
@@ -39,10 +39,12 @@ public slots:
void onLabelDeleted(const QString &labelName);
void onXChanged(const QString &labelName, int x);
void onYChanged(const QString &labelName, int y);
- void onTopicChanged(const QString &labelName, const QString &newTopic);
+ void onTopicChanged(const QString &oldTopic, const QString &newTopic);
+ void onItemTopicChanged(ImageViewerItem *item);
void onReceiveMsg(const ModuleMessage &msg);
void fitImage();
void onImageFilePathChanged(const QString &newFilePath);
+ void onItemDeleteRequested(int itemId);
protected:
void unsubscribeLabels(const QString &label);
@@ -63,6 +65,7 @@ protected:
void addItem(ImageViewerItem *item);
void showInSettings(ImageViewerItem *item);
void onSettingsSetupRequested(int id);
+ void onSettingsSetupToAllRequested();
private:
Ui::ImageViewerModule *ui;
@@ -76,6 +79,7 @@ private:
bool isLeftMousePressed = false;
QMap<int, ImageViewerItem*> imageViewerItems;
+ QMap<int, QString> topicMap; // Item id -> Topic
int lastUsedId = 0;
bool firstResizeDone = false;
ImageViewerSettings settingsPanel;
diff --git a/Modules/ImageViewer/imageviewersettings.cpp b/Modules/ImageViewer/imageviewersettings.cpp
index 00d89b07..bb14139d 100644
--- a/Modules/ImageViewer/imageviewersettings.cpp
+++ b/Modules/ImageViewer/imageviewersettings.cpp
@@ -30,15 +30,15 @@ void ImageViewerSettings::initAndConnectUI()
// Initialize values
- QList<XmlObject*> childs = defaultSettings.deepSearchObjects("text");
- if(!childs.isEmpty()){
- XmlObject* text = childs[0];
- int x, y;
- if(text->getIntAttribute("x", x) && text->getIntAttribute("y", y)){
- ui->doubleSpinBox_text_position_x->setValue(x);
- ui->doubleSpinBox_text_position_y->setValue(y);
- }
- }
+// QList<XmlObject*> childs = defaultSettings.deepSearchObjects("text");
+// if(!childs.isEmpty()){
+// XmlObject* text = childs[0];
+// int x, y;
+// if(text->getIntAttribute("x", x) && text->getIntAttribute("y", y)){
+// ui->doubleSpinBox_text_position_x->setValue(x);
+// ui->doubleSpinBox_text_position_y->setValue(y);
+// }
+// }
connect(ui->plainTextEdit_preview, &QPlainTextEdit::textChanged, [this](){onPreviewTextChanged();});
@@ -56,7 +56,7 @@ void ImageViewerSettings::initAndConnectUI()
connect(ui->lineEdit_text_color, &QLineEdit::textChanged, this, &ImageViewerSettings::onPropertyChanged);
connect(ui->lineEdit_fillColor, &QLineEdit::textChanged, this, &ImageViewerSettings::onPropertyChanged);
connect(ui->lineEdit_border_color, &QLineEdit::textChanged, this, &ImageViewerSettings::onPropertyChanged);
- connect(ui->fontComboBox_font, &QFontComboBox::currentFontChanged, this, &ImageViewerSettings::onPropertyChanged);
+ connect(ui->lineEdit_topic, &QLineEdit::textChanged, this, &ImageViewerSettings::onPropertyChanged);
connect(ui->pushButton_applyToAll, &QPushButton::clicked, this, &ImageViewerSettings::onApplyToAllClicked);
connect(ui->pushButton_applyToSelected, &QPushButton::clicked, this, &ImageViewerSettings::onApplyToSelectedClicked);
@@ -64,6 +64,8 @@ void ImageViewerSettings::initAndConnectUI()
connect(ui->pushButton_pickTextColor, &QPushButton::clicked, this, [this](){onPickColorRequested(ui->lineEdit_text_color);});
connect(ui->pushButton_pickFillColor, &QPushButton::clicked, this, [this](){onPickColorRequested(ui->lineEdit_fillColor);});
+ connect(ui->pushButton_delete, &QPushButton::clicked, this, &ImageViewerSettings::onDeleteClicked);
+
updatePreview();
}
@@ -86,7 +88,7 @@ void ImageViewerSettings::defaultSettingsSetup()
void ImageViewerSettings::onApplyToAllClicked()
{
-
+ emit setupSettingsToAll();
}
void ImageViewerSettings::onApplyToSelectedClicked()
@@ -110,7 +112,10 @@ XmlObject *ImageViewerSettings::findOrAddXmlObject(const QString &xmlChildName)
void ImageViewerSettings::onPreviewTextChanged()
{
+ lockUpdate = true;
defaultSettings.fromXml(ui->plainTextEdit_preview->toPlainText());
+ updateUI(defaultSettings);
+ lockUpdate = false;
updatePreview(false);
}
@@ -124,60 +129,119 @@ void ImageViewerSettings::onPickColorRequested(QLineEdit *lineEdit)
void ImageViewerSettings::onPropertyChanged()
{
- // Get the data from the view
int width = ui->spinBox_width->value();
int height = ui->spinBox_height->value();
- int strokeWidth = ui->spinBox_border_size->value();
- int fontSize = ui->spinBox_fontSize->value();
- QString textX = QString::number(ui->doubleSpinBox_text_position_x->value());
- QString textY = QString::number(ui->doubleSpinBox_text_position_y->value());
- QString borderColor = ui->lineEdit_border_color->text().trimmed();
QString fill = "none";
- QString textValue = ui->lineEdit_text->text().trimmed();
- QString textColor = ui->lineEdit_text_color->text().trimmed();
- QString fontFamily = ui->fontComboBox_font->currentFont().toString();
if(ui->checkBox_fill->isChecked()){
fill = ui->lineEdit_fillColor->text().trimmed();
}
- // Set the xml with the new data
-// QString size = "0 0 "+ QString::number(width) +" " + QString::number(height);
-// defaultSettings.addAttribute("viewBox", size );
-
- defaultSettings.addAttribute("height", QString::number(height));
- defaultSettings.addAttribute("width", QString::number(width));
+ defaultSettings.addAttribute("height", height);
+ defaultSettings.addAttribute("width", width);
XmlObject* text = findOrAddXmlObject("text");
- text->addAttribute("x",textX);
- text->addAttribute("y",textY);
- text->addAttribute("fill",textColor);
- text->addAttribute("font-size", fontSize);
- text->addAttribute("font-family", fontFamily);
- text->setTextValue(textValue);
+ text->addAttribute("x",QString::number(ui->doubleSpinBox_text_position_x->value()));
+ text->addAttribute("y",QString::number(ui->doubleSpinBox_text_position_y->value()));
+ text->addAttribute("fill",ui->lineEdit_text_color->text().trimmed());
+ text->addAttribute("font-size", ui->spinBox_fontSize->value());
+ text->setTextValue(ui->lineEdit_text->text().trimmed());
XmlObject* border = findOrAddXmlObject("rect");
border->addAttribute("width", width);
border->addAttribute("height", height);
border->addAttribute("fill", fill);
- border->addAttribute("stroke", borderColor);
- border->addAttribute("stroke-width", strokeWidth);
+ border->addAttribute("stroke", ui->lineEdit_border_color->text().trimmed());
+ border->addAttribute("stroke-width", ui->spinBox_border_size->value());
+
+ XmlObject* topic = findOrAddXmlObject("topic");
+ topic->setTextValue(ui->lineEdit_topic->text().trimmed());
updatePreview();
}
-void ImageViewerSettings::setTarget(int value, const XmlObject setup)
+void ImageViewerSettings::updateUI(XmlObject &xml)
+{
+ bool ok;
+
+ int width = xml.getAttribute("width").toInt(&ok);
+ if(ok){
+ ui->spinBox_width->setValue(width);
+ }
+ int height = xml.getAttribute("height").toInt(&ok);
+ if(ok){
+ ui->spinBox_height->setValue(height);
+ }
+
+ QList<XmlObject*> childs = xml.deepSearchObjects("text");
+ if(!childs.isEmpty()){
+ XmlObject *text = childs[0];
+ double val = text->getAttribute("x").toDouble(&ok);
+ if(ok){
+ ui->doubleSpinBox_text_position_x->setValue(val);
+ }
+ val = text->getAttribute("y").toDouble(&ok);
+ if(ok){
+ ui->doubleSpinBox_text_position_y->setValue(val);
+ }
+
+ ui->lineEdit_text_color->setText(text->getAttribute("fill"));
+ ui->lineEdit_text->setText(text->getTextValue());
+
+ int fontSize = text->getAttribute("font-size").toInt(&ok);
+ if(ok){
+ ui->spinBox_fontSize->setValue(fontSize);
+ }
+ }
+
+ childs = xml.deepSearchObjects("rect");
+ if(!childs.isEmpty()){
+ XmlObject *border = childs[0];
+ int stroke = border->getAttribute("stroke-width").toInt(&ok);
+ if(ok){
+ ui->spinBox_border_size->setValue(stroke);
+ }
+
+ ui->lineEdit_border_color->setText(border->getAttribute("stroke"));
+ ui->lineEdit_fillColor->setText(border->getAttribute("fill"));
+ }
+}
+
+void ImageViewerSettings::resizeEvent(QResizeEvent *event)
+{
+ Q_UNUSED(event);
+ fitPreview();
+}
+
+void ImageViewerSettings::fitPreview()
+{
+ ui->graphicsView_preview->fitInView(&preview, Qt::KeepAspectRatio);
+}
+
+void ImageViewerSettings::onDeleteClicked()
+{
+ this->close();
+ emit deleteItemRequested(target);
+}
+
+
+void ImageViewerSettings::setTarget(int value, XmlObject setup)
{
target = value;
+ updateUI(setup);
defaultSettings = setup;
+ updatePreview();
}
void ImageViewerSettings::updatePreview(bool updatePlainText)
{
+ if(lockUpdate)
+ return;
+
QPixmap previewPixmap;
QString xml = defaultSettings.toXml();
previewPixmap.loadFromData(xml.toUtf8());
preview.setPixmap(previewPixmap);
- ui->graphicsView_preview->fitInView(&preview, Qt::KeepAspectRatio);
+ fitPreview();
if(updatePlainText){
ui->plainTextEdit_preview->clear();
ui->plainTextEdit_preview->appendPlainText(xml);
diff --git a/Modules/ImageViewer/imageviewersettings.h b/Modules/ImageViewer/imageviewersettings.h
index c1ca8ab3..e2a33e13 100644
--- a/Modules/ImageViewer/imageviewersettings.h
+++ b/Modules/ImageViewer/imageviewersettings.h
@@ -21,11 +21,12 @@ public:
XmlObject getDefaultSettings() const;
- void setTarget(int value, const XmlObject setup);
+ void setTarget(int value, XmlObject setup);
signals:
void setupSettingsToAll();
void setupSettingsToSelected(int id);
+ void deleteItemRequested(int id);
protected:
void initAndConnectUI();
@@ -34,6 +35,10 @@ protected:
void onApplyToAllClicked();
void onApplyToSelectedClicked();
XmlObject* findOrAddXmlObject(const QString &xmlChild);
+ void updateUI(XmlObject &xml);
+ void resizeEvent(QResizeEvent *event) override;
+ void fitPreview();
+ void onDeleteClicked();
protected slots:
void onPreviewTextChanged();
@@ -48,6 +53,7 @@ private:
XmlObject defaultSettings;
QGraphicsScene scene;
QGraphicsPixmapItem preview;
+ bool lockUpdate = false;
};
#endif // IMAGEVIEWERSETTINGS_H
diff --git a/Modules/ImageViewer/imageviewersettings.ui b/Modules/ImageViewer/imageviewersettings.ui
index 3db88a66..579c1232 100644
--- a/Modules/ImageViewer/imageviewersettings.ui
+++ b/Modules/ImageViewer/imageviewersettings.ui
@@ -13,7 +13,7 @@
<property name="windowTitle">
<string>ImageViewer Settings</string>
</property>
- <layout class="QVBoxLayout" name="verticalLayout" stretch="2,1,0">
+ <layout class="QVBoxLayout" name="verticalLayout" stretch="2,0,1,0">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
@@ -29,6 +29,20 @@
</layout>
</widget>
</item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Connect this label to the following Topic: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit_topic"/>
+ </item>
+ </layout>
+ </item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
@@ -39,8 +53,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>773</width>
- <height>192</height>
+ <width>758</width>
+ <height>190</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@@ -128,7 +142,7 @@
</widget>
</item>
<item row="2" column="3">
- <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0,0,0,0,0">
<item>
<widget class="QLineEdit" name="lineEdit_text"/>
</item>
@@ -159,16 +173,6 @@
</property>
</widget>
</item>
- <item>
- <widget class="QLabel" name="label_13">
- <property name="text">
- <string>Font</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QFontComboBox" name="fontComboBox_font"/>
- </item>
</layout>
</item>
<item row="2" column="1">
@@ -374,6 +378,13 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QPushButton" name="pushButton_delete">
+ <property name="text">
+ <string>Delete</string>
+ </property>
+ </widget>
+ </item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
diff --git a/SkywardHub.pro.user b/SkywardHub.pro.user
index 77b0b0c3..3992eed5 100644
--- a/SkywardHub.pro.user
+++ b/SkywardHub.pro.user
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.13.0, 2020-12-08T16:00:17. -->
+<!-- Written by QtCreator 4.13.0, 2020-12-08T18:22:37. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
--
GitLab