some work on the grid layout and items

This commit is contained in:
Crylia
2024-06-08 19:00:34 +02:00
parent b1cfa155f9
commit 09987eed01
13 changed files with 290 additions and 36 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include <QWidget>
#include <QLabel>
#include <QLayout>
#include <QStyleOption>
#include <QPainter>
#include <QMimeDatabase>
#include <QApplication>
#include <filesystem>
class GridItem : public QWidget {
Q_OBJECT
private:
QString m_name;
QIcon m_icon;
int m_size;
std::filesystem::path m_path;
QSize widgetSize;
QMimeDatabase mime_database;
QString formatText(const QString& text);
QIcon getIconForFileType(const std::filesystem::path path) const;
public:
GridItem(const std::filesystem::path path, QWidget* parent = nullptr);
~GridItem( );
QLabel* m_nameLabel;
QLabel* m_iconLabel;
void setIconSize(const QSize& size);
protected:
void paintEvent(QPaintEvent* event)override;
};