Compare commits
2 Commits
56f64f00f0
...
a28e484cb2
Author | SHA1 | Date |
---|---|---|
yang.yongquan | a28e484cb2 | |
yang.yongquan | f578fe6184 |
|
@ -104,6 +104,7 @@
|
|||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ElementPoolWidget.cpp" />
|
||||
<ClCompile Include="src\CaptionButton.cpp" />
|
||||
<ClCompile Include="src\Editor\EditorWidget.cpp" />
|
||||
<ClCompile Include="src\Editor\ElementManager.cpp" />
|
||||
|
@ -187,6 +188,7 @@
|
|||
<QtMoc Include="src\MainWindow.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="src\Editor\ElementManager.h" />
|
||||
<QtMoc Include="src\Editor\ElementPoolWidget.h" />
|
||||
<ClInclude Include="src\Editor\GraphicElement.h" />
|
||||
<ClInclude Include="src\Editor\LayerManager.h" />
|
||||
<ClInclude Include="src\Editor\LayerStyle.h" />
|
||||
|
|
|
@ -207,6 +207,9 @@
|
|||
<ClCompile Include="src\Editor\PixelPath.cpp">
|
||||
<Filter>Source Files\Editor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ElementPoolWidget.cpp">
|
||||
<Filter>Source Files\Editor</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="src\Renderer\RendererGLWidget.h">
|
||||
|
@ -242,6 +245,9 @@
|
|||
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="src\Editor\ElementPoolWidget.h">
|
||||
<Filter>Header Files\Editor</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\data.json" />
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#include "ElementPoolWidget.h"
|
||||
|
||||
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
iconWidth = 30, iconHeight = 40;
|
||||
pictureList = new QListWidget(this);
|
||||
pictureList->setIconSize(QSize(iconWidth, iconHeight));
|
||||
pictureList->setResizeMode(QListView::Adjust);
|
||||
pictureList->setViewMode(QListView::IconMode);
|
||||
pictureList->setMovement(QListView::Static);
|
||||
pictureList->setSpacing(10);
|
||||
|
||||
setVisible(true);
|
||||
|
||||
connect(pictureList, SIGNAL(vitemClicked(QListWidgetItem*)), this, SLOT(pictureItemClicked(QListWidgetItem*)));
|
||||
}
|
||||
|
||||
void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
|
||||
pictureList->clear();
|
||||
for (int index = 0; index < elements.size(); index++) {
|
||||
QString strPath = QString("D:\\BigC\\Project\\ArchitectureColoredPainting\\svg\\test.svg");
|
||||
QPixmap itemPixmap(strPath);
|
||||
QListWidgetItem* pItem = new QListWidgetItem(
|
||||
itemPixmap.scaled(QSize(iconWidth, iconHeight)),
|
||||
elements[index]->name);
|
||||
pItem->setSizeHint(QSize(iconWidth, iconHeight));
|
||||
pictureList->insertItem(index, pItem);
|
||||
}
|
||||
}
|
||||
|
||||
ElementPoolWidget::~ElementPoolWidget() {
|
||||
|
||||
}
|
||||
|
||||
int ElementPoolWidget::pictureItemClicked(QListWidgetItem* item) {
|
||||
return pictureList->currentRow();
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
#pragma once
|
||||
#include <QWidget>
|
||||
#include <vector>
|
||||
#include <GraphicElement.h>
|
||||
#include <QListWidget>
|
||||
class ElementPoolWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
//std::vector<GraphicElement*> elements;
|
||||
QListWidget* pictureList;
|
||||
int iconWidth, iconHeight;
|
||||
public:
|
||||
ElementPoolWidget(QWidget* parent = NULL);
|
||||
void setElementList(std::vector<GraphicElement*> elementList);
|
||||
~ElementPoolWidget();
|
||||
public slots:
|
||||
int pictureItemClicked(QListWidgetItem* item);
|
||||
};
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
#include "CppUnitTest.h"
|
||||
#include "MainWindow.h"
|
||||
//#include "MainWindow.h"
|
||||
#include <QGuiApplication>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
#include <util/SvgFileLoader.h>
|
||||
#include "Renderer/Painting/CubicBezier.h"
|
||||
#include <Renderer/Painting/StraightLine.h>
|
||||
#include <ElementPoolWidget.h>
|
||||
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
|
@ -43,24 +44,24 @@ namespace UnitTest
|
|||
TEST_CLASS(UnitTest)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(TestMethod1)
|
||||
{
|
||||
FRAMELESSHELPER_USE_NAMESPACE
|
||||
FramelessHelper::Core::initialize();
|
||||
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char arg[] = "";
|
||||
char* argv[] = { arg };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
a.exec();
|
||||
}
|
||||
//TEST_METHOD(TestMethod1)
|
||||
//{
|
||||
// FRAMELESSHELPER_USE_NAMESPACE
|
||||
// FramelessHelper::Core::initialize();
|
||||
// //QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
// QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
// char arg[] = "";
|
||||
// char* argv[] = { arg };
|
||||
// int argc = 1;
|
||||
// QApplication a(argc, argv);
|
||||
// FramelessHelper::Core::setApplicationOSThemeAware();
|
||||
// FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||
// FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
// FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
// MainWindow w;
|
||||
// w.show();
|
||||
// a.exec();
|
||||
//}
|
||||
};
|
||||
|
||||
TEST_CLASS(SvgLoaderTest)
|
||||
|
@ -94,5 +95,13 @@ namespace UnitTest
|
|||
|
||||
}
|
||||
};
|
||||
|
||||
TEST_CLASS(ElementPoolTest)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(ElementPool) {
|
||||
qInstallMessageHandler(messageHandler);
|
||||
ElementPoolWidget wi;
|
||||
wi.show();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue