- add preview/live update to TaskSectionView & TaskComplexSection - add view direction selector to uis - use SectionNormal as Direction. Make Direction read-only - simplify section line end point calculation - section group command in toolbar - make section and complex section icons consistent - fix compsolid cutting tool - terminology: single/piecewise to offset/aligned
106 lines
3.7 KiB
C++
106 lines
3.7 KiB
C++
/***************************************************************************
|
|
* Copyright (c) 2022 WandererFan <wandererfan@gmail.com> *
|
|
* *
|
|
* This file is part of the FreeCAD CAx development system. *
|
|
* *
|
|
* This library is free software; you can redistribute it and/or *
|
|
* modify it under the terms of the GNU Library General Public *
|
|
* License as published by the Free Software Foundation; either *
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
* *
|
|
* This library is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this library; see the file COPYING.LIB. If not, *
|
|
* write to the Free Software Foundation, Inc., 59 Temple Place, *
|
|
* Suite 330, Boston, MA 02111-1307, USA *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifndef COMPASSWIDGET_H
|
|
#define COMPASSWIDGET_H
|
|
|
|
#include <QDoubleSpinBox>
|
|
#include <QKeyEvent>
|
|
#include <QWidget>
|
|
#include <QSize>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QLabel;
|
|
class QHBoxLayout;
|
|
class QPushButton;
|
|
class QVBoxLayout;
|
|
QT_END_NAMESPACE
|
|
|
|
namespace TechDrawGui {
|
|
|
|
class CompassDialWidget;
|
|
|
|
class CompassWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
Q_PROPERTY( double angle READ dialAngle WRITE setDialAngle NOTIFY angleChanged)
|
|
|
|
public:
|
|
CompassWidget(QWidget* parent = 0);
|
|
~CompassWidget() = default;
|
|
|
|
QSize sizeHint() const override;
|
|
QSize minimumSizeHint() const override;
|
|
bool eventFilter(QObject *target, QEvent *event) override;
|
|
void retranslateUi();
|
|
double dialAngle() const { return m_angle; }
|
|
void setDialAngle(double newAngle);
|
|
void setAdvanceIncrement(double newIncrement);
|
|
double advanceIncrement() const { return m_advanceIncrement; }
|
|
|
|
Q_SIGNALS:
|
|
void angleChanged(double angle);
|
|
void angleSet(double angle);
|
|
|
|
public Q_SLOTS:
|
|
void slotChangeAngle(double angle) { setDialAngle(angle); }
|
|
void slotSpinBoxUpdate(double newAngle);
|
|
void slotSpinBoxEnter(double newAngle);
|
|
void slotUseSpinboxValue();
|
|
void resetAngle() { setDialAngle(0.0); } //conventional angles
|
|
void setToEast() { setDialAngle(0.0); }
|
|
void setToNorth() { setDialAngle(90.0); }
|
|
void setToWest() { setDialAngle(180.0); }
|
|
void setToSouth() { setDialAngle(270.0); }
|
|
void slotCWAdvance();
|
|
void slotCCWAdvance();
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent* event) override;
|
|
void buildWidget();
|
|
double changeAngleConvention(double CWY) const;
|
|
|
|
private:
|
|
QRect m_rect;
|
|
int m_minimumWidth;
|
|
int m_minimumHeight;
|
|
int m_defaultMargin;
|
|
double m_angle;
|
|
double m_advanceIncrement;
|
|
|
|
QVBoxLayout* compassLayout;
|
|
QHBoxLayout* compassDialLayout;
|
|
QHBoxLayout* compassControlLayout;
|
|
|
|
CompassDialWidget* compassDial;
|
|
// DoubleSpinBoxNoEnter* dsbAngle;
|
|
QDoubleSpinBox* dsbAngle;
|
|
QLabel* compassControlLabel;
|
|
QPushButton* pbUseCompassSetting;
|
|
QPushButton* pbCWAdvance;
|
|
QPushButton* pbCCWAdvance;
|
|
};
|
|
|
|
} //namespace TechDrawGui
|
|
#endif // COMPASSWIDGET_H
|
|
|