finish touch ui

This commit is contained in:
2025-10-22 00:01:57 +08:00
parent 5347562b36
commit 6ef41ab501
4 changed files with 22 additions and 6 deletions

View File

@@ -55,8 +55,7 @@ private:
QSize get_matrix_size(); QSize get_matrix_size();
private: private:
friend class Impl; friend class Impl;
// QSize matrix_size = {3, 4}; QSize matrix_size = {3, 4};
QSize matrix_size;
}; };
} // namespace plot_widget::internal } // namespace plot_widget::internal

View File

@@ -3,6 +3,7 @@
// //
#include <qsize.h> #include <qsize.h>
#include <qsizepolicy.h>
#include <random> #include <random>
#include "component.hh" #include "component.hh"
@@ -38,7 +39,7 @@ static auto ComConfigComponent(ThemeManager& manager, auto&& callback) {
slogen_context->set_silent("BanG Bream! It's MyGo!!!"); slogen_context->set_silent("BanG Bream! It's MyGo!!!");
auto select_com_context = std::make_shared<MutableValue<QStringList>>(); auto select_com_context = std::make_shared<MutableValue<QStringList>>();
select_com_context->set_silent(QStringList {}); select_com_context->set_silent(QStringList {"COM1", "COM2", "COM3", "COM4", "COM5"});
auto select_baud_context = std::make_shared<MutableValue<QStringList>>(); auto select_baud_context = std::make_shared<MutableValue<QStringList>>();
select_baud_context->set_silent(QStringList {"9600", "115200"}); select_baud_context->set_silent(QStringList {"9600", "115200"});
@@ -57,6 +58,10 @@ static auto ComConfigComponent(ThemeManager& manager, auto&& callback) {
slpro::LeadingIcon {material::icon::kArrowDropDown, material::regular::font}, slpro::LeadingIcon {material::icon::kArrowDropDown, material::regular::font},
slpro::IndexChanged {[&](auto& self){ qDebug() << self.currentIndex();}}, slpro::IndexChanged {[&](auto& self){ qDebug() << self.currentIndex();}},
slpro::LeadingText {"COM"}, slpro::LeadingText {"COM"},
MutableForward {
slpro::SelectItems {},
select_com_context,
}
}, },
lnpro::Item<MatSelect> { lnpro::Item<MatSelect> {
slpro::ThemeManager {manager }, slpro::ThemeManager {manager },
@@ -145,6 +150,9 @@ static auto ComConfigComponent(ThemeManager& manager, auto&& callback) {
static auto DisplayComponent(ThemeManager& manager, int index = 0) noexcept { static auto DisplayComponent(ThemeManager& manager, int index = 0) noexcept {
const auto row = new Row{ const auto row = new Row{
lnpro::Item<HeatMapPlot> { lnpro::Item<HeatMapPlot> {
plot_widget::pro::SizePolicy {
QSizePolicy::Expanding,
},
pwpro::MatrixSize { pwpro::MatrixSize {
QSize{3, 4} QSize{3, 4}
}, },
@@ -190,9 +198,14 @@ auto ViewComponent(ViewComponentState& state) noexcept -> raw_pointer<QWidget> {
}), }),
}, },
lnpro::Item<Row> {
lnpro::Item {
DisplayComponent(state.manager),
},
lnpro::Item { lnpro::Item {
DisplayComponent(state.manager), DisplayComponent(state.manager),
}, },
}, },
},
}; };
} }

View File

@@ -1,4 +1,5 @@
#include "component.hh" #include "component.hh"
#include "modern-qt/utility/material-icon.hh"
#include <qstandardpaths.h> #include <qstandardpaths.h>
#include <modern-qt/core/application.hh> #include <modern-qt/core/application.hh>
#include <modern-qt/layout/linear.hh> #include <modern-qt/layout/linear.hh>
@@ -32,7 +33,7 @@ auto main(int argc, char *argv[]) -> int {
}, },
.buttons_context = { .buttons_context = {
{"0", material::icon::kHome}, {"0", material::icon::kTouchSensor},
{"1", material::icon::kStar}, {"1", material::icon::kStar},
{"2", material::icon::kFavorite}, {"2", material::icon::kFavorite},
{"3", material::icon::kExtension}, {"3", material::icon::kExtension},

View File

@@ -161,6 +161,9 @@ namespace material {
// link // link
constexpr auto kAddLink = "add_link"; constexpr auto kAddLink = "add_link";
constexpr auto kLinkOff = "link_off"; constexpr auto kLinkOff = "link_off";
// sensor icon
constexpr auto kTouchSensor = "touch_app";
} }
} }
} }