mirror of
https://github.com/leozide/leocad
synced 2025-01-14 08:01:45 +01:00
Updated key frame widget look.
This commit is contained in:
parent
4785caac2a
commit
8a17958d0b
3 changed files with 40 additions and 2 deletions
|
@ -2,6 +2,34 @@
|
|||
#include "lc_keyframewidget.h"
|
||||
|
||||
lcKeyFrameWidget::lcKeyFrameWidget(QWidget* Parent)
|
||||
: QCheckBox(Parent)
|
||||
: QAbstractButton(Parent)
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
setCheckable(true);
|
||||
}
|
||||
|
||||
void lcKeyFrameWidget::paintEvent(QPaintEvent* PaintEvent)
|
||||
{
|
||||
Q_UNUSED(PaintEvent);
|
||||
|
||||
QPainter Painter(this);
|
||||
|
||||
QRect Rect = rect();
|
||||
Painter.fillRect(Rect, palette().brush(QPalette::Window));
|
||||
|
||||
Painter.setPen(hasFocus() ? palette().color(QPalette::Highlight) : palette().color(QPalette::Shadow));
|
||||
Painter.setBrush(palette().color(QPalette::Text));
|
||||
|
||||
Rect = isChecked() ? QRect(1, 1, 13, 13) : QRect(4, 4, 7, 7);
|
||||
QPoint Center = Rect.center();
|
||||
|
||||
QPoint Points[4] =
|
||||
{
|
||||
QPoint(Rect.left(), Center.y()),
|
||||
QPoint(Center.x(), Rect.bottom()),
|
||||
QPoint(Rect.right(), Center.y()),
|
||||
QPoint(Center.x(), Rect.top())
|
||||
};
|
||||
|
||||
Painter.drawPolygon(Points, 4);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
class lcKeyFrameWidget : public QCheckBox
|
||||
class lcKeyFrameWidget : public QAbstractButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
lcKeyFrameWidget(QWidget* Parent);
|
||||
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
return QSize(15, 15);
|
||||
}
|
||||
|
||||
void paintEvent(QPaintEvent* PaintEvent) override;
|
||||
};
|
||||
|
|
|
@ -187,6 +187,9 @@ void lcObjectProperty<T>::RemoveTime(lcStep Start, lcStep Time)
|
|||
template<typename T>
|
||||
bool lcObjectProperty<T>::HasKeyFrame(lcStep Time) const
|
||||
{
|
||||
if (mKeys.size() <= 1)
|
||||
return false;
|
||||
|
||||
for (typename std::vector<lcObjectPropertyKey<T>>::const_iterator KeyIt = mKeys.begin(); KeyIt != mKeys.end(); KeyIt++)
|
||||
{
|
||||
if (KeyIt->Step == Time)
|
||||
|
|
Loading…
Reference in a new issue