2025-10-29 00:16:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QToolBox>
|
|
|
|
|
#include <QListWidget>
|
|
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QLabel>
|
|
|
|
|
#include <QPushButton>
|
|
|
|
|
#include <QMimeData>
|
|
|
|
|
#include <QDrag>
|
|
|
|
|
#include <QMouseEvent>
|
2025-11-01 10:08:02 +00:00
|
|
|
#include <QEvent>
|
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
|
#include <QPainter>
|
|
|
|
|
#include <QApplication>
|
2025-11-01 16:02:20 +00:00
|
|
|
#include <QMap>
|
2025-11-01 13:30:06 +00:00
|
|
|
|
|
|
|
|
#include "workspace/ModelInfo.h"
|
2025-11-01 16:02:20 +00:00
|
|
|
#include "ui/ModelBrowser/PresetModelListWidget.h"
|
2025-10-30 00:15:44 +00:00
|
|
|
|
|
|
|
|
namespace Ui { class PresetModelPanel; }
|
2025-10-29 00:16:25 +00:00
|
|
|
|
|
|
|
|
class DockWidget;
|
|
|
|
|
|
2025-11-01 10:08:02 +00:00
|
|
|
|
2025-10-29 00:16:25 +00:00
|
|
|
/**
|
|
|
|
|
* @brief Preset model panel class
|
|
|
|
|
*
|
2025-11-01 16:02:20 +00:00
|
|
|
* Provides preset 3D models for users to drag into the 3D scene.
|
|
|
|
|
* Dynamically creates UI based on configuration files, supporting any number of categories.
|
2025-10-29 00:16:25 +00:00
|
|
|
*/
|
|
|
|
|
class PresetModelPanel : public QWidget {
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit PresetModelPanel(QWidget *parent = nullptr);
|
|
|
|
|
~PresetModelPanel() override;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Attach to dock widget
|
|
|
|
|
* @param dockWidget Dock widget pointer
|
|
|
|
|
*/
|
|
|
|
|
void AttachDock(DockWidget* dockWidget);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
/**
|
|
|
|
|
* @brief Initialize user interface
|
|
|
|
|
*/
|
|
|
|
|
void InitUI();
|
|
|
|
|
|
2025-11-01 16:02:20 +00:00
|
|
|
/**
|
|
|
|
|
* @brief Create dynamic UI based on configuration
|
|
|
|
|
*/
|
|
|
|
|
void CreateDynamicUI();
|
|
|
|
|
|
2025-10-29 00:16:25 +00:00
|
|
|
/**
|
2025-10-30 00:15:44 +00:00
|
|
|
* @brief Load models from configuration file
|
2025-10-29 00:16:25 +00:00
|
|
|
*/
|
2025-10-30 00:15:44 +00:00
|
|
|
void LoadModelsFromConfig();
|
2025-10-29 00:16:25 +00:00
|
|
|
|
|
|
|
|
/**
|
2025-11-01 16:02:20 +00:00
|
|
|
* @brief Clear all dynamic UI elements
|
2025-10-29 00:16:25 +00:00
|
|
|
*/
|
2025-11-01 16:02:20 +00:00
|
|
|
void ClearDynamicUI();
|
2025-10-29 00:16:25 +00:00
|
|
|
|
|
|
|
|
private:
|
2025-10-30 00:15:44 +00:00
|
|
|
Ui::PresetModelPanel *ui;
|
2025-11-01 10:08:02 +00:00
|
|
|
|
2025-11-01 16:02:20 +00:00
|
|
|
// Dynamic UI management
|
|
|
|
|
QMap<QString, PresetModelListWidget*> categoryWidgets_;
|
|
|
|
|
QMap<QString, QWidget*> categoryPages_;
|
|
|
|
|
|
2025-11-01 10:08:02 +00:00
|
|
|
// Drag and drop support
|
2025-10-29 00:16:25 +00:00
|
|
|
QPoint dragStartPosition_;
|
2025-11-01 10:08:02 +00:00
|
|
|
QListWidget* dragSourceWidget_;
|
|
|
|
|
};
|