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