修改了ElementPool的样式
parent
08e54cfc30
commit
11c9ccc3a9
|
@ -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" />
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -3,25 +3,28 @@
|
|||
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->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);
|
||||
|
||||
QLayout* layout = new QHBoxLayout();
|
||||
layout->addWidget(pictureList);
|
||||
setLayout(layout);
|
||||
//pictureList->setFixedSize(600, 800);
|
||||
|
||||
setVisible(true);
|
||||
|
||||
connect(pictureList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(pictureItemClicked(QListWidgetItem*)));
|
||||
}
|
||||
|
||||
|
@ -32,7 +35,7 @@ void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
|
|||
//
|
||||
//QString strPath = QString("C:\\Users\\86177\\Pictures\\Screenshots\\test.png");
|
||||
//QPixmap itemPixmap(strPath);
|
||||
//QPixmap itemPixmap(QSize(200,200));
|
||||
//QPixmap itemPixmap(QSize(200, 200));
|
||||
//itemPixmap.fill(Qt::red);
|
||||
QPixmap itemPixmap = elements[index]->getPaintObject().getDetail();
|
||||
qDebug() << this->parentWidget()->size();
|
||||
|
@ -43,21 +46,15 @@ void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
|
|||
//p->setFixedSize(1920, 1080);
|
||||
//lb->show();
|
||||
//p->show();
|
||||
|
||||
|
||||
QListWidgetItem* pItem = new QListWidgetItem(
|
||||
itemPixmap.scaled(QSize(iconWidth-15, iconHeight-15)),
|
||||
itemPixmap.scaled(QSize(iconWidth - 15, iconHeight - 15)),
|
||||
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() {
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <GraphicElement.h>
|
||||
#include <QListWidget>
|
||||
#include <ElementManager.h>
|
||||
#include <QLayout>
|
||||
|
||||
class ElementPoolWidget : public QWidget
|
||||
{
|
||||
|
@ -12,19 +13,17 @@ 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:
|
||||
void elementSelected(GraphicElement* element);
|
||||
|
||||
|
||||
public slots:
|
||||
int pictureItemClicked(QListWidgetItem* item);
|
||||
void refresh();
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#include "PaintingUtil.h"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
#include "../../Renderer/Painting/Painting.h"
|
||||
class PaintingUtil
|
||||
{
|
||||
public:
|
||||
//static Renderer::Painting transfromToPainting();
|
||||
};
|
||||
|
Loading…
Reference in New Issue