Compare commits
No commits in common. "883fac32111d4939d75fc548816df0902690e59d" and "315083cd52179509a663e60778a898e18cabec01" have entirely different histories.
883fac3211
...
315083cd52
|
@ -1,9 +1,6 @@
|
||||||
#include "InfoDisplayWidget.h"
|
#include "InfoDisplayWidget.h"
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QListWidget>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
void InfoDisplayWidget::setLayer(LayerWrapper *layer)
|
void InfoDisplayWidget::setLayer(LayerWrapper *layer)
|
||||||
{
|
{
|
||||||
this->displayLayer = layer;
|
this->displayLayer = layer;
|
||||||
|
@ -75,47 +72,9 @@ void InfoDisplayWidget::generateLayerForm()
|
||||||
layout->addRow("scale-X:", scaleX);
|
layout->addRow("scale-X:", scaleX);
|
||||||
layout->addRow("scale-Y:", scaleY);
|
layout->addRow("scale-Y:", scaleY);
|
||||||
layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
|
layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
|
||||||
|
|
||||||
bool styleEnabled = true;
|
|
||||||
if (styleEnabled) {
|
|
||||||
QListWidget* styleList = new QListWidget(this);
|
|
||||||
QListWidgetItem* item = new QListWidgetItem("样式列表");
|
|
||||||
item->setFlags(Qt::NoItemFlags);
|
|
||||||
styleList->addItem(item);
|
|
||||||
static vector<QString> styleNames = { "样例1", "样例2", "样例3" };
|
|
||||||
auto createStyleItem = [this, styleList](int index) {
|
|
||||||
QListWidgetItem* item = new QListWidgetItem;
|
|
||||||
QWidget* w = new QWidget;
|
|
||||||
item->setSizeHint(QSize(50, 40));
|
|
||||||
QHBoxLayout* layout = new QHBoxLayout;
|
|
||||||
QPushButton* pushButton = new QPushButton(w);
|
|
||||||
QLabel* name = new QLabel(w);
|
|
||||||
name->setText(styleNames[index]);
|
|
||||||
pushButton->setText("×");
|
|
||||||
pushButton->setFixedSize(QSize(20, 20));
|
|
||||||
connect(pushButton, &QPushButton::clicked, [styleList,item,this]() {
|
|
||||||
styleList->removeItemWidget(item);
|
|
||||||
delete item;
|
|
||||||
// delete data in layer
|
|
||||||
emit requireRefreshPreview();
|
|
||||||
});
|
|
||||||
layout->addWidget(name);
|
|
||||||
layout->addWidget(pushButton);
|
|
||||||
w->setLayout(layout);
|
|
||||||
styleList->addItem(item);
|
|
||||||
styleList->setItemWidget(item, w);
|
|
||||||
};
|
|
||||||
for (int i = 0; i < styleNames.size(); i++)
|
|
||||||
createStyleItem(i);
|
|
||||||
|
|
||||||
|
|
||||||
layout->addRow(styleList);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InfoDisplayWidget::generateElementForm()
|
void InfoDisplayWidget::generateElementForm()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue