Compare commits
No commits in common. "6a4a724f006a181e6c87dedfb181a643363d9af0" and "a28e484cb22c07e851d999aafdcdcdc504d74378" have entirely different histories.
6a4a724f00
...
a28e484cb2
|
@ -3,29 +3,26 @@
|
||||||
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
ElementPoolWidget::ElementPoolWidget(QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
iconWidth = 150, iconHeight = 100;
|
iconWidth = 30, iconHeight = 40;
|
||||||
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(10);
|
pictureList->setSpacing(10);
|
||||||
pictureList->setFixedSize(600, 800);
|
|
||||||
|
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
|
||||||
connect(pictureList, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(pictureItemClicked(QListWidgetItem*)));
|
connect(pictureList, SIGNAL(vitemClicked(QListWidgetItem*)), this, SLOT(pictureItemClicked(QListWidgetItem*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
|
void ElementPoolWidget::setElementList(std::vector<GraphicElement*> elements) {
|
||||||
pictureList->clear();
|
pictureList->clear();
|
||||||
for (int index = 0; index < elements.size(); index++) {
|
for (int index = 0; index < elements.size(); index++) {
|
||||||
//
|
QString strPath = QString("D:\\BigC\\Project\\ArchitectureColoredPainting\\svg\\test.svg");
|
||||||
//QString strPath = QString("C:\\Users\\86177\\Pictures\\Screenshots\\test.png");
|
QPixmap itemPixmap(strPath);
|
||||||
//QPixmap itemPixmap(strPath);
|
|
||||||
QPixmap itemPixmap = elements[index]->getPaintObject().getPixmap();
|
|
||||||
QListWidgetItem* pItem = new QListWidgetItem(
|
QListWidgetItem* pItem = new QListWidgetItem(
|
||||||
itemPixmap.scaled(QSize(iconWidth-20, iconHeight-20)),
|
itemPixmap.scaled(QSize(iconWidth, iconHeight)),
|
||||||
elements[index]->name);
|
elements[index]->name);
|
||||||
pItem->setSizeHint(QSize(iconWidth, iconHeight));
|
pItem->setSizeHint(QSize(iconWidth, iconHeight));
|
||||||
pictureList->insertItem(index, pItem);
|
pictureList->insertItem(index, pItem);
|
||||||
|
@ -37,6 +34,5 @@ ElementPoolWidget::~ElementPoolWidget() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ElementPoolWidget::pictureItemClicked(QListWidgetItem* item) {
|
int ElementPoolWidget::pictureItemClicked(QListWidgetItem* item) {
|
||||||
//qDebug() << pictureList->currentRow();
|
|
||||||
return pictureList->currentRow();
|
return pictureList->currentRow();
|
||||||
}
|
}
|
|
@ -97,26 +97,11 @@ namespace UnitTest
|
||||||
};
|
};
|
||||||
TEST_CLASS(ElementPoolTest)
|
TEST_CLASS(ElementPoolTest)
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
char* argv[1];
|
|
||||||
int argc;
|
|
||||||
public:
|
public:
|
||||||
ElementPoolTest() :argv{ (char*)"" }, argc(1) {}
|
|
||||||
|
|
||||||
TEST_METHOD_INITIALIZE(initialize)
|
|
||||||
{
|
|
||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
|
||||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
|
||||||
}
|
|
||||||
TEST_METHOD(ElementPool) {
|
TEST_METHOD(ElementPool) {
|
||||||
QApplication a(argc, argv);
|
|
||||||
qInstallMessageHandler(messageHandler);
|
qInstallMessageHandler(messageHandler);
|
||||||
ElementPoolWidget wi;
|
ElementPoolWidget wi;
|
||||||
//wi.setElementList({"1", "2", "3"});
|
|
||||||
wi.setFixedSize(QSize(600, 800));
|
|
||||||
wi.show();
|
wi.show();
|
||||||
a.exec();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue