自定义内存分配池

This commit is contained in:
2026-07-29 18:08:57 +08:00
parent 18edce4838
commit 84c4082e82
18 changed files with 325 additions and 188 deletions
+8 -5
View File
@@ -1,7 +1,8 @@
#ifndef Progress_Bar_H
#define Progress_Bar_H
#include <utility>
#include <vector>
#include <atomic>
#include "../Global.h"
struct Tick{
@@ -12,24 +13,26 @@ struct Tick{
QString that = (text[0] == '+' || text[0] == '-' || text[0] == '<' || text[0] == '>') ? text.mid(1) : text;
value = that.toDouble();
}
Tick(QString text, QColor color, double value) : text(std::move(text)), color(std::move(color)){
value = value;
Tick(QString text, QColor color, double value) : text(std::move(text)), color(std::move(color)), value(value){
}
};
class Progress_Bar : public QWidget {
public:
explicit Progress_Bar(const QVector<Tick>& tick_list, QWidget *parent = nullptr);
explicit Progress_Bar(const std::vector<Tick>& tick_list, QWidget *parent = nullptr);
double tick_space_w = 1;
double value = 0;
int timer;
std::function<void(void)> set_value = nullptr;
std::atomic_bool queued_value_update{false};
std::atomic<double> queued_value{0.0};
double get_draw_width(double value);
void setValue(double value);
protected:
void paintEvent(QPaintEvent *event) override;
void timerEvent(QTimerEvent *event) override;
QVector<Tick> tick_list;
std::vector<Tick> tick_list;
};
#endif