2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_PART_WIDGET_H
|
|
|
|
#define DUST3D_PART_WIDGET_H
|
2018-04-07 08:44:39 +00:00
|
|
|
#include <QLabel>
|
|
|
|
#include <QPushButton>
|
2018-04-18 01:49:23 +00:00
|
|
|
#include <QMouseEvent>
|
2018-10-25 00:19:38 +00:00
|
|
|
#include "document.h"
|
2018-09-18 06:22:29 +00:00
|
|
|
#include "modelwidget.h"
|
2018-04-07 08:44:39 +00:00
|
|
|
|
2018-10-25 00:19:38 +00:00
|
|
|
class PartWidget : public QWidget
|
2018-04-07 08:44:39 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
2018-04-08 01:30:55 +00:00
|
|
|
signals:
|
|
|
|
void setPartLockState(QUuid partId, bool locked);
|
|
|
|
void setPartVisibleState(QUuid partId, bool visible);
|
|
|
|
void setPartSubdivState(QUuid partId, bool subdived);
|
2018-04-11 09:19:27 +00:00
|
|
|
void setPartDisableState(QUuid partId, bool disabled);
|
2018-04-15 12:11:51 +00:00
|
|
|
void setPartXmirrorState(QUuid partId, bool mirrored);
|
|
|
|
void setPartZmirrorState(QUuid partId, bool mirrored);
|
2018-04-17 16:14:31 +00:00
|
|
|
void setPartDeformThickness(QUuid partId, float thickness);
|
|
|
|
void setPartDeformWidth(QUuid partId, float width);
|
2018-04-26 02:23:22 +00:00
|
|
|
void setPartRoundState(QUuid partId, bool rounded);
|
|
|
|
void setPartColorState(QUuid partId, bool hasColor, QColor color);
|
2018-08-31 04:54:32 +00:00
|
|
|
void setPartWrapState(QUuid partId, bool wrapped);
|
2018-10-09 02:19:12 +00:00
|
|
|
void setPartMaterialId(QUuid partId, QUuid materialId);
|
2018-06-16 06:41:52 +00:00
|
|
|
void movePartUp(QUuid partId);
|
|
|
|
void movePartDown(QUuid partId);
|
|
|
|
void movePartToTop(QUuid partId);
|
|
|
|
void movePartToBottom(QUuid partId);
|
2018-04-18 01:49:23 +00:00
|
|
|
void checkPart(QUuid partId);
|
2018-04-18 02:37:50 +00:00
|
|
|
void groupOperationAdded();
|
2018-04-26 02:23:22 +00:00
|
|
|
void enableBackgroundBlur();
|
|
|
|
void disableBackgroundBlur();
|
2018-04-07 08:44:39 +00:00
|
|
|
public:
|
2018-10-25 00:19:38 +00:00
|
|
|
PartWidget(const Document *document, QUuid partId);
|
2018-04-07 08:44:39 +00:00
|
|
|
void reload();
|
2018-04-08 01:30:55 +00:00
|
|
|
void updatePreview();
|
|
|
|
void updateLockButton();
|
|
|
|
void updateVisibleButton();
|
|
|
|
void updateSubdivButton();
|
2018-04-11 09:19:27 +00:00
|
|
|
void updateDisableButton();
|
2018-04-15 12:11:51 +00:00
|
|
|
void updateXmirrorButton();
|
|
|
|
void updateZmirrorButton();
|
2018-04-17 16:14:31 +00:00
|
|
|
void updateDeformButton();
|
2018-04-26 02:23:22 +00:00
|
|
|
void updateRoundButton();
|
|
|
|
void updateColorButton();
|
2018-08-31 04:54:32 +00:00
|
|
|
void updateWrapButton();
|
2018-04-23 00:10:01 +00:00
|
|
|
void updateCheckedState(bool checked);
|
2018-11-14 13:21:45 +00:00
|
|
|
void updateUnnormalState(bool unnormal);
|
2018-08-27 08:50:40 +00:00
|
|
|
static QSize preferredSize();
|
2018-09-18 06:22:29 +00:00
|
|
|
ModelWidget *previewWidget();
|
2018-04-18 01:49:23 +00:00
|
|
|
protected:
|
2018-09-21 07:10:18 +00:00
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
2018-04-17 13:13:32 +00:00
|
|
|
public slots:
|
2018-04-17 16:14:31 +00:00
|
|
|
void showDeformSettingPopup(const QPoint &pos);
|
2018-04-26 02:23:22 +00:00
|
|
|
void showColorSettingPopup(const QPoint &pos);
|
2018-05-10 09:16:22 +00:00
|
|
|
private: // need initialize
|
2018-10-25 00:19:38 +00:00
|
|
|
const Document *m_document;
|
2018-04-07 08:44:39 +00:00
|
|
|
QUuid m_partId;
|
2018-11-14 13:21:45 +00:00
|
|
|
bool m_unnormal;
|
2018-05-10 09:16:22 +00:00
|
|
|
private:
|
2018-09-18 06:22:29 +00:00
|
|
|
ModelWidget *m_previewWidget;
|
2018-04-07 08:44:39 +00:00
|
|
|
QPushButton *m_visibleButton;
|
2018-04-07 12:30:26 +00:00
|
|
|
QPushButton *m_lockButton;
|
|
|
|
QPushButton *m_subdivButton;
|
2018-04-11 09:19:27 +00:00
|
|
|
QPushButton *m_disableButton;
|
2018-04-15 12:11:51 +00:00
|
|
|
QPushButton *m_xMirrorButton;
|
|
|
|
QPushButton *m_zMirrorButton;
|
2018-04-17 16:14:31 +00:00
|
|
|
QPushButton *m_deformButton;
|
2018-04-23 00:10:01 +00:00
|
|
|
QPushButton *m_roundButton;
|
2018-04-26 02:23:22 +00:00
|
|
|
QPushButton *m_colorButton;
|
2018-08-31 04:54:32 +00:00
|
|
|
QPushButton *m_wrapButton;
|
2018-04-23 00:10:01 +00:00
|
|
|
QWidget *m_backgroundWidget;
|
2018-04-08 01:30:55 +00:00
|
|
|
private:
|
2018-04-17 16:14:31 +00:00
|
|
|
void initToolButton(QPushButton *button);
|
2018-04-26 02:23:22 +00:00
|
|
|
void initToolButtonWithoutFont(QPushButton *button);
|
2018-04-08 01:30:55 +00:00
|
|
|
void initButton(QPushButton *button);
|
|
|
|
void updateButton(QPushButton *button, QChar icon, bool highlighted);
|
2018-05-10 09:16:22 +00:00
|
|
|
void updateAllButtons();
|
2018-04-07 08:44:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|