first commit

This commit is contained in:
2026-02-21 17:11:31 +09:00
commit 18b4338361
4001 changed files with 365464 additions and 0 deletions

View File

@@ -0,0 +1,84 @@
#include "fm_speed_widget.h"
#include <QPainter.h>
#include <QDebug>
FMSpeedWidget::FMSpeedWidget(QWidget *parent) : QWidget(parent)
{
currentSpeed = -1;
numberPixmap = QPixmap(":/image/num_15x25.png");
barPixmapOn = QPixmap(":/image/speed_on.png");
barPixmapOff = QPixmap(":/image/speed_off.png");
}
void FMSpeedWidget::updateSpeed(int speed)
{
currentSpeed = speed;
update();
}
void FMSpeedWidget::paintEvent(QPaintEvent *pe)
{
Q_UNUSED(pe);
QPainter painter(this);
int x = (rect().width()-barPixmapOn.size().width()) / 2;
int y = (rect().height()-barPixmapOn.size().height()) / 2;
painter.drawPixmap(x,y,currentSpeed >= 0 ? barPixmapOn : barPixmapOff);
const int numWidth = 15;
const int numHeight = 25;
int x0 = (rect().width()- (numWidth*3) ) / 2;
int x1 = x0 + numWidth;
int x2 = x1 + numWidth;
y = 21;
int sx[4] = {0,};
if(currentSpeed < 0)
{
sx[0] = sx[1] = sx[2] = numWidth * 10; // -
}
else {
char cidx[4] = {0,};
sprintf(cidx,"%03d",currentSpeed);
sx[0] = (int)(cidx[0] - '0') * numWidth;
sx[1] = (int)(cidx[1] - '0') * numWidth;
sx[2] = (int)(cidx[2] - '0') * numWidth;
}
//inline void QPainter::drawPixmap(int x, int y, const QPixmap &pm,
// int sx, int sy, int sw, int sh)
painter.drawPixmap(x0,y,numberPixmap,sx[0],0,numWidth,numHeight);
painter.drawPixmap(x1,y,numberPixmap,sx[1],0,numWidth,numHeight);
painter.drawPixmap(x2,y,numberPixmap,sx[2],0,numWidth,numHeight);
//QPoint offset = QPoint(rect().width()-barPixmapOn.size().width())
//painter.drawPixmap(0,0,barPixmapOn.size().width(),barPixmapOn.size().height(), barPixmapOn);
// QStyleOption o;
// o.initFrom(this);
// QPainter p(this);
// style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
// QPixmap indicatorPixmap;
// painter->fillRect(option.rect,background);
// QRect iconRect = option.rect;
// // 좌표 CONTROL 과 동일하게 처리 되어야 함
// iconRect.setLeft(iconRect.left() + 7);
// iconRect.setTop(iconRect.top() + 5);
// if (item->checked) {
// indicatorPixmap = QPixmap(":/image/checkbox_checked.png");
// }
// else {
// indicatorPixmap = QPixmap(":/image/checkbox_unchecked.png");
// }
//QApplication::style()->drawItemPixmap(painter, iconRect, 0, indicatorPixmap );
}