rpcs3/rpcs3/rpcs3qt/screenshot_item.cpp
Megamouse f115032095 Qt: implement flow layout game grid
This will allow us to properly style the grid and also remove the need to refresh the whole grid on a window resize
2023-05-06 06:31:58 +02:00

33 lines
699 B
C++

#include "screenshot_item.h"
#include "qt_utils.h"
#include <QVBoxLayout>
screenshot_item::screenshot_item(QWidget* parent)
: flow_widget_item(parent)
{
cb_on_first_visibility = [this]()
{
m_thread.reset(QThread::create([this]()
{
const QPixmap pixmap = gui::utils::get_centered_pixmap(icon_path, icon_size, 0, 0, 1.0, Qt::SmoothTransformation);
Q_EMIT signal_icon_update(pixmap);
}));
m_thread->start();
};
label = new QLabel(this);
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(label);
setLayout(layout);
}
screenshot_item::~screenshot_item()
{
if (m_thread && m_thread->isRunning())
{
m_thread->wait();
}
}