dust3d/src/partwidget.h

82 lines
2.7 KiB
C
Raw Normal View History

#ifndef DUST3D_PART_WIDGET_H
#define DUST3D_PART_WIDGET_H
#include <QLabel>
#include <QPushButton>
#include <QMouseEvent>
#include "document.h"
#include "modelwidget.h"
class PartWidget : public QWidget
{
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);
void setPartRoundState(QUuid partId, bool rounded);
void setPartColorState(QUuid partId, bool hasColor, QColor color);
void setPartWrapState(QUuid partId, bool wrapped);
void setPartMaterialId(QUuid partId, QUuid materialId);
void movePartUp(QUuid partId);
void movePartDown(QUuid partId);
void movePartToTop(QUuid partId);
void movePartToBottom(QUuid partId);
void checkPart(QUuid partId);
void groupOperationAdded();
void enableBackgroundBlur();
void disableBackgroundBlur();
public:
PartWidget(const Document *document, QUuid partId);
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();
void updateRoundButton();
void updateColorButton();
void updateWrapButton();
void updateCheckedState(bool checked);
void updateUnnormalState(bool unnormal);
static QSize preferredSize();
ModelWidget *previewWidget();
protected:
void mouseDoubleClickEvent(QMouseEvent *event) override;
public slots:
2018-04-17 16:14:31 +00:00
void showDeformSettingPopup(const QPoint &pos);
void showColorSettingPopup(const QPoint &pos);
private: // need initialize
const Document *m_document;
QUuid m_partId;
bool m_unnormal;
private:
ModelWidget *m_previewWidget;
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;
QPushButton *m_roundButton;
QPushButton *m_colorButton;
QPushButton *m_wrapButton;
QWidget *m_backgroundWidget;
2018-04-08 01:30:55 +00:00
private:
2018-04-17 16:14:31 +00:00
void initToolButton(QPushButton *button);
void initToolButtonWithoutFont(QPushButton *button);
2018-04-08 01:30:55 +00:00
void initButton(QPushButton *button);
void updateButton(QPushButton *button, QChar icon, bool highlighted);
void updateAllButtons();
};
#endif