自定义内存分配池

This commit is contained in:
2026-07-29 18:08:57 +08:00
parent 5a3511bb58
commit d943d82554
122 changed files with 3602 additions and 1215 deletions
+7 -7
View File
@@ -18,8 +18,8 @@ public:
Background background;
Content content;
Button() {
paintAbles.append(&background);
paintAbles.append(&content);
paintAbles.push_back(&background);
paintAbles.push_back(&content);
}
[[nodiscard]] QSize sizeHint() const override {
auto ret = content.sizeHint();
@@ -34,7 +34,7 @@ inline Button* create_icon(const QString& path, const QColor& background, const
auto ret = new Button();
ret->content.set_icon(path, QColor(Qt::color0));
ret->background.set_color(background);
ret->background.mouse_handlers.append(f);
ret->background.mouse_handlers.push_back(f);
return ret;
};
struct Switch_Button : Base {
@@ -44,9 +44,9 @@ public:
Content content1;
Content content2;
Switch_Button() {
paintAbles.append(&background);
paintAbles.append(&content1);
paintAbles.append(&content2);
paintAbles.push_back(&background);
paintAbles.push_back(&content1);
paintAbles.push_back(&content2);
content1.show = true;
content2.show = false;
}
@@ -65,7 +65,7 @@ inline Switch_Button* create_switch_icon(const QColor& background, const QString
ret->content1.set_icon(path, QColor(Qt::color0));
ret->content2.set_icon(path2, QColor(Qt::color0));
ret->background.set_color(background);
ret->background.mouse_handlers.append([ret, f, f2](QEvent::Type t, QMouseEvent* e) {
ret->background.mouse_handlers.push_back([ret, f, f2](QEvent::Type t, QMouseEvent* e) {
if (t == QEvent::MouseButtonPress) {
if (ret->content1.show) {
f(t, e);