修改了ElementPool的样式

TaoZhang-Branch
yang.yongquan 2023-03-08 19:15:42 +08:00
parent 08e54cfc30
commit 11c9ccc3a9
6 changed files with 42 additions and 28 deletions

View File

@ -120,6 +120,7 @@
<ClCompile Include="src\Editor\ThirdPartyLib\qquick\qquicksvgparser.cpp" />
<ClCompile Include="src\Editor\ThirdPartyLib\SvgHelper.cpp" />
<ClCompile Include="src\Editor\util\PainterPathUtil.cpp" />
<ClCompile Include="src\Editor\util\PaintingUtil.cpp" />
<ClCompile Include="src\Editor\util\SvgFileLoader.cpp" />
<ClCompile Include="src\gl.c" />
<ClCompile Include="src\IconWidget.cpp" />
@ -202,6 +203,7 @@
<ClInclude Include="src\Editor\ThirdPartyLib\qquick\qtquickglobal_p.h" />
<ClInclude Include="src\Editor\ThirdPartyLib\SvgHelper.h" />
<ClInclude Include="src\Editor\util\PainterPathUtil.h" />
<ClInclude Include="src\Editor\util\PaintingUtil.h" />
<ClInclude Include="src\Editor\util\SvgFileLoader.h" />
<ClInclude Include="src\Renderer\IblUtils.h" />
<ClInclude Include="src\Renderer\Painting\BaseStyle.h" />

View File

@ -216,6 +216,9 @@
<ClCompile Include="src\Editor\ElementPoolWidget.cpp">
<Filter>Source Files\Editor</Filter>
</ClCompile>
<ClCompile Include="src\Editor\util\PaintingUtil.cpp">
<Filter>Source Files\Editor\util</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<QtMoc Include="src\Renderer\RendererGLWidget.h">
@ -453,6 +456,9 @@
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Editor\util\PaintingUtil.h">
<Filter>Header Files\Editor\util</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<QtRcc Include="res\MainWindow.qrc">

View File

@ -3,24 +3,27 @@
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
: QWidget(parent)
{
parentSize = QSize(270, 210);
elementManager = nullptr;
iconWidth = 80, iconHeight = 60;
pictureList = new QListWidget(this);
iconWidth = 100, iconHeight = 75;
pictureList = new QListWidget();
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->setWindowFlags(Qt::FramelessWindowHint);
pictureList->setResizeMode(QListWidget::Adjust);
pictureList->setViewMode(QListWidget::IconMode);
pictureList->setMovement(QListWidget::Static);
pictureList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
//pictureList->setFixedSize(600, 800);
pictureList->setWrapping(true);
pictureList->setSpacing(5);
pictureList->setStyleSheet("QListWidget::Item:hover{background-color: #f5f5f5;border-radius:5px; }"
"QListWidget::item:selected{background-color:rgba(234,234,234,1);color:rgb(61,61,61);border:1px solid #778899;border-radius:2px; }"
"QScrollBar:vertical{width:6px}"
"QListWidget{outline:none;border:0px}");
pictureList->setFocusPolicy(Qt::NoFocus);
setVisible(true);
QLayout* layout = new QHBoxLayout();
layout->addWidget(pictureList);
setLayout(layout);
//pictureList->setFixedSize(600, 800);
connect(pictureList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(pictureItemClicked(QListWidgetItem*)));
}
@ -52,12 +55,6 @@ void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
}
}
void ElementPoolWidget::setParentSize(QSize pSize) {
parentSize = pSize;
iconWidth = (parentSize.width() - 30) / 3;
iconHeight = (parentSize.width() - 30) / 4;
}
ElementPoolWidget::~ElementPoolWidget() {
}

View File

@ -4,6 +4,7 @@
#include <GraphicElement.h>
#include <QListWidget>
#include <ElementManager.h>
#include <QLayout>
class ElementPoolWidget : public QWidget
{
@ -12,14 +13,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:

View File

@ -0,0 +1,2 @@
#include "PaintingUtil.h"

View File

@ -0,0 +1,8 @@
#pragma once
#include "../../Renderer/Painting/Painting.h"
class PaintingUtil
{
public:
//static Renderer::Painting transfromToPainting();
};