initial port for Cevo game in C++ (libs)

This commit is contained in:
Geoffray Levasseur committed 2026-10-22 17:20:45 +02:00
commit 8436242032
375 files changed
+46282

No files matched your search

+56
View File
@@ -0,0 +1,56 @@
#pragma once
#include <QFrame>
#include <QLabel>
#include <QPixmap>
#include <QTimer>
#include <QWidget>
#include <functional>
namespace Dpi {
class Canvas;
// TTimer equivalent: QTimer already matches the VCL API closely.
using Timer = QTimer;
// TPanel equivalent.
class Panel : public QFrame {
Q_OBJECT
public:
explicit Panel(QWidget *parent = nullptr);
};
// TPaintBox equivalent: a plain widget exposing an OnPaint callback bound to
// a Dpi::Canvas, since custom drawing in Qt happens through QPainter in
// paintEvent rather than through a persistent handle-based canvas.
class PaintBox : public QWidget {
Q_OBJECT
public:
explicit PaintBox(QWidget *parent = nullptr);
std::function<void(Canvas &)> onPaint;
protected:
void paintEvent(QPaintEvent *event) override;
};
// TImage equivalent.
class Image : public QLabel {
Q_OBJECT
public:
explicit Image(QWidget *parent = nullptr);
bool stretch() const { return m_stretch; }
void setStretch(bool value);
void setPicture(const QPixmap &pixmap);
private:
void updatePixmap();
bool m_stretch = false;
QPixmap m_source;
};
} // namespace Dpi