tycho: use Qt's integers instead of cstdint ones because reasons
parent
186020c8c2
commit
1fcb3fd609
|
@ -34,7 +34,7 @@ public slots:
|
|||
signals:
|
||||
void dirtyChanged(bool dirty);
|
||||
void deselected();
|
||||
void selected(std::uint16_t index);
|
||||
void selected(quint16 index);
|
||||
};
|
||||
|
||||
class IProjectView : public QWidget
|
||||
|
|
|
@ -30,9 +30,8 @@ void MapModel::select(QModelIndex const &index)
|
|||
QVariant MapModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
switch(role) {
|
||||
case Qt::DecorationRole: {
|
||||
case Qt::DecorationRole:
|
||||
return QVariant::fromValue(::getIcon(propIcon(index.row())));
|
||||
}
|
||||
default:
|
||||
return IMapModel::data(index, role);
|
||||
}
|
||||
|
|
|
@ -2,58 +2,47 @@
|
|||
|
||||
extern "C" {
|
||||
struct int2 {
|
||||
std::int16_t x, y;
|
||||
qint16 x, y;
|
||||
};
|
||||
|
||||
void paint_arc(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
std::int16_t w,
|
||||
std::int16_t h,
|
||||
std::int16_t t,
|
||||
std::int16_t p)
|
||||
qint16 x,
|
||||
qint16 y,
|
||||
qint16 w,
|
||||
qint16 h,
|
||||
qint16 t,
|
||||
qint16 p)
|
||||
{
|
||||
paint->drawArc(x, y, w, h, t, p);
|
||||
}
|
||||
|
||||
void paint_chord(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
std::int16_t w,
|
||||
std::int16_t h,
|
||||
std::int16_t t,
|
||||
std::int16_t p)
|
||||
qint16 x,
|
||||
qint16 y,
|
||||
qint16 w,
|
||||
qint16 h,
|
||||
qint16 t,
|
||||
qint16 p)
|
||||
{
|
||||
paint->drawChord(x, y, w, h, t, p);
|
||||
}
|
||||
|
||||
void paint_ellipse(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
std::int16_t w,
|
||||
std::int16_t h)
|
||||
void paint_ellipse(QPainter *paint, qint16 x, qint16 y, qint16 w, qint16 h)
|
||||
{
|
||||
paint->drawEllipse(x, y, w, h);
|
||||
}
|
||||
|
||||
void paint_image(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
char const *fname)
|
||||
void paint_image(QPainter *paint, qint16 x, qint16 y, char const *fname)
|
||||
{
|
||||
paint->drawImage(x, y, QImage(QString(fname)));
|
||||
}
|
||||
|
||||
void paint_line(QPainter *paint,
|
||||
std::int16_t x1,
|
||||
std::int16_t y1,
|
||||
std::int16_t x2,
|
||||
std::int16_t y2)
|
||||
void paint_line(QPainter *paint, qint16 x1, qint16 y1, qint16 x2, qint16 y2)
|
||||
{
|
||||
paint->drawLine(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void paint_point(QPainter *paint, std::int16_t x, std::int16_t y)
|
||||
void paint_point(QPainter *paint, qint16 x, qint16 y)
|
||||
{
|
||||
paint->drawPoint(x, y);
|
||||
}
|
||||
|
@ -69,39 +58,28 @@ extern "C" {
|
|||
paint->drawPolygon(poly);
|
||||
}
|
||||
|
||||
void paint_rect(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
std::int16_t w,
|
||||
std::int16_t h)
|
||||
void paint_rect(QPainter *paint, qint16 x, qint16 y, qint16 w, qint16 h)
|
||||
{
|
||||
paint->drawRect(x, y, w, h);
|
||||
}
|
||||
|
||||
void paint_squircle(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
std::int16_t w,
|
||||
std::int16_t h,
|
||||
std::int16_t r1,
|
||||
std::int16_t r2)
|
||||
qint16 x,
|
||||
qint16 y,
|
||||
qint16 w,
|
||||
qint16 h,
|
||||
qint16 r1,
|
||||
qint16 r2)
|
||||
{
|
||||
paint->drawRoundedRect(x, y, w, h, r1, r2);
|
||||
}
|
||||
|
||||
void paint_text(QPainter *paint,
|
||||
std::int16_t x,
|
||||
std::int16_t y,
|
||||
char const *text)
|
||||
void paint_text(QPainter *paint, qint16 x, qint16 y, char const *text)
|
||||
{
|
||||
paint->drawText(x, y, QString(text));
|
||||
}
|
||||
|
||||
void paint_fg(QPainter *paint,
|
||||
std::uint8_t r,
|
||||
std::uint8_t g,
|
||||
std::uint8_t b,
|
||||
std::uint8_t a)
|
||||
void paint_fg(QPainter *paint, quint8 r, quint8 g, quint8 b, quint8 a)
|
||||
{
|
||||
QColor color{r, g, b, a};
|
||||
paint->setPen(color);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
@ -28,7 +27,7 @@
|
|||
|
||||
class Project;
|
||||
|
||||
using byte = std::uint8_t;
|
||||
using byte = quint8;
|
||||
|
||||
class MapModel final : public IMapModel
|
||||
{
|
||||
|
@ -143,12 +142,12 @@ void dbgPrint([[maybe_unused]] char const *fmt, [[maybe_unused]] VA &&...va)
|
|||
#define dbgPrintFunc() dbgPrint("%s", __func__)
|
||||
|
||||
constexpr
|
||||
std::uint32_t fourCC(byte a, byte b, byte c, byte d)
|
||||
quint32 fourCC(byte a, byte b, byte c, byte d)
|
||||
{
|
||||
return (static_cast<std::uint32_t>(a) << 24) |
|
||||
(static_cast<std::uint32_t>(b) << 16) |
|
||||
(static_cast<std::uint32_t>(c) << 8) |
|
||||
static_cast<std::uint32_t>(d);
|
||||
return (static_cast<quint32>(a) << 24) |
|
||||
(static_cast<quint32>(b) << 16) |
|
||||
(static_cast<quint32>(c) << 8) |
|
||||
static_cast<quint32>(d);
|
||||
}
|
||||
|
||||
QIcon getIcon(QString const &name);
|
||||
|
|
Loading…
Reference in New Issue