Compare commits
No commits in common. "7d4a191f02d0ec485ec20e35a2dbdee21a7dc737" and "477517d919135a23a0130488c2edd8f1dfd4ebc2" have entirely different histories.
7d4a191f02
...
477517d919
|
@ -70,9 +70,6 @@
|
||||||
<QtUic Include="MainWindow.ui">
|
<QtUic Include="MainWindow.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
<QtUic Include="EditorWidget.ui">
|
|
||||||
<Filter>Form Files</Filter>
|
|
||||||
</QtUic>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\Editor\EditorWidgetItem.cpp">
|
<ClCompile Include="src\Editor\EditorWidgetItem.cpp">
|
||||||
|
|
|
@ -3,22 +3,14 @@
|
||||||
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
parentSize = QSize(270, 210);
|
iconWidth = 150, iconHeight = 100;
|
||||||
elementManager = nullptr;
|
|
||||||
iconWidth = 80, iconHeight = 60;
|
|
||||||
pictureList = new QListWidget(this);
|
pictureList = new QListWidget(this);
|
||||||
pictureList->setIconSize(QSize(iconWidth, iconHeight));
|
pictureList->setIconSize(QSize(iconWidth, iconHeight));
|
||||||
pictureList->setResizeMode(QListView::Adjust);
|
pictureList->setResizeMode(QListView::Adjust);
|
||||||
pictureList->setViewMode(QListView::IconMode);
|
pictureList->setViewMode(QListView::IconMode);
|
||||||
pictureList->setMovement(QListView::Static);
|
pictureList->setMovement(QListView::Static);
|
||||||
pictureList->setSpacing(5);
|
pictureList->setSpacing(10);
|
||||||
pictureList->setStyleSheet("QListWidget::Item:hover{background-color:rgba(47,46,46,0);border-radius:5px; }"
|
pictureList->setFixedSize(600, 800);
|
||||||
"QListWidget::item:selected{background-color:rgba(47,46,46,0);color:rgb(61,61,61);border:1px solid #000;border-radius:2px; }"
|
|
||||||
"QScrollBar:vertical{width:6px}");
|
|
||||||
|
|
||||||
pictureList->setFocusPolicy(Qt::NoFocus);
|
|
||||||
pictureList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
|
||||||
//pictureList->setFixedSize(600, 800);
|
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
|
@ -45,19 +37,13 @@ void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
|
||||||
//p->show();
|
//p->show();
|
||||||
|
|
||||||
QListWidgetItem* pItem = new QListWidgetItem(
|
QListWidgetItem* pItem = new QListWidgetItem(
|
||||||
itemPixmap.scaled(QSize(iconWidth-15, iconHeight-15)),
|
itemPixmap.scaled(QSize(iconWidth-20, iconHeight-20)),
|
||||||
elements[index]->name);
|
elements[index]->name);
|
||||||
pItem->setSizeHint(QSize(iconWidth, iconHeight));
|
pItem->setSizeHint(QSize(iconWidth, iconHeight));
|
||||||
pictureList->insertItem(index, pItem);
|
pictureList->insertItem(index, pItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementPoolWidget::setParentSize(QSize pSize) {
|
|
||||||
parentSize = pSize;
|
|
||||||
iconWidth = (parentSize.width() - 30) / 3;
|
|
||||||
iconHeight = (parentSize.width() - 30) / 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
ElementPoolWidget::~ElementPoolWidget() {
|
ElementPoolWidget::~ElementPoolWidget() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -73,8 +59,3 @@ void ElementPoolWidget::setElementManager(ElementManager* element)
|
||||||
this->elementManager = element;
|
this->elementManager = element;
|
||||||
this->setElementList(this->elementManager->elements);
|
this->setElementList(this->elementManager->elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementPoolWidget::refresh() {
|
|
||||||
this->setElementList(this->elementManager->elements);
|
|
||||||
// update();
|
|
||||||
}
|
|
|
@ -12,14 +12,12 @@ private:
|
||||||
std::vector<GraphicElement*> elements;
|
std::vector<GraphicElement*> elements;
|
||||||
QListWidget* pictureList;
|
QListWidget* pictureList;
|
||||||
int iconWidth, iconHeight;
|
int iconWidth, iconHeight;
|
||||||
QSize parentSize;
|
|
||||||
ElementManager* elementManager;
|
ElementManager* elementManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ElementPoolWidget(QWidget* parent = nullptr);
|
ElementPoolWidget(QWidget* parent = nullptr);
|
||||||
void setElementList(std::vector<GraphicElement*> elementList);
|
void setElementList(std::vector<GraphicElement*> elementList);
|
||||||
void setElementManager(ElementManager* element);
|
void setElementManager(ElementManager* element);
|
||||||
void setParentSize(QSize pSize);
|
|
||||||
~ElementPoolWidget();
|
~ElementPoolWidget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -27,6 +25,5 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
int pictureItemClicked(QListWidgetItem* item);
|
int pictureItemClicked(QListWidgetItem* item);
|
||||||
void refresh();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue