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);
|
2019-03-09 22:10:39 +00:00
|
|
|
void setPartChamferState(QUuid partId, bool chamfered);
|
2018-04-26 02:23:22 +00:00
|
|
|
void setPartColorState(QUuid partId, bool hasColor, QColor color);
|
2019-02-21 22:48:15 +00:00
|
|
|
void setPartCutRotation(QUuid partId, float cutRotation);
|
2019-05-05 12:49:26 +00:00
|
|
|
void setPartCutFace(QUuid partId, CutFace cutFace);
|
2019-05-19 03:21:38 +00:00
|
|
|
void setPartCutFaceLinkedId(QUuid partId, QUuid linkedId);
|
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();
|
2019-03-09 22:10:39 +00:00
|
|
|
void updateChamferButton();
|
2018-04-26 02:23:22 +00:00
|
|
|
void updateColorButton();
|
2019-02-21 22:48:15 +00:00
|
|
|
void updateCutRotationButton();
|
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);
|
2019-02-21 22:48:15 +00:00
|
|
|
void showCutRotationSettingPopup(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;
|
2019-03-09 22:10:39 +00:00
|
|
|
QPushButton *m_chamferButton;
|
2018-04-26 02:23:22 +00:00
|
|
|
QPushButton *m_colorButton;
|
2019-02-24 13:42:23 +00:00
|
|
|
QPushButton *m_cutRotationButton;
|
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
|