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