2022-10-02 19:45:46 +00:00
|
|
|
#include "preview_grid_view.h"
|
|
|
|
#include "theme.h"
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
PreviewGridView::PreviewGridView(QWidget* parent)
|
|
|
|
: QListView(parent)
|
2022-10-02 19:45:46 +00:00
|
|
|
{
|
2022-10-02 22:04:46 +00:00
|
|
|
QPalette viewPalette = palette();
|
|
|
|
viewPalette.setColor(QPalette::Window, Qt::transparent);
|
|
|
|
viewPalette.setColor(QPalette::Base, Qt::transparent);
|
|
|
|
setPalette(viewPalette);
|
|
|
|
|
2022-10-05 12:26:39 +00:00
|
|
|
auto borderSize = Theme::previewIconBorderSize;
|
|
|
|
auto margin = Theme::previewIconMargin;
|
|
|
|
auto borderRadius = Theme::previewIconBorderRadius;
|
2022-10-02 22:04:46 +00:00
|
|
|
setStyleSheet(
|
2022-10-18 09:35:04 +00:00
|
|
|
"QListView::item {border:" + QString::number(borderSize) + "px solid transparent; margin:" + QString::number(margin) + "px; background-color: " + Theme::gray.name() + "; border-radius: " + QString::number(borderRadius) + ";}" + "QListView::item:selected {border-color: " + Theme::red.name() + ";}");
|
2022-10-02 22:04:46 +00:00
|
|
|
|
2022-10-02 19:45:46 +00:00
|
|
|
setViewMode(QListView::IconMode);
|
|
|
|
setGridSize(QSize(Theme::partPreviewImageSize, Theme::partPreviewImageSize));
|
|
|
|
setMovement(QListView::Snap);
|
|
|
|
setFlow(QListView::LeftToRight);
|
2022-10-02 22:04:46 +00:00
|
|
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
2022-10-04 09:50:39 +00:00
|
|
|
setResizeMode(QListView::Adjust);
|
|
|
|
}
|