File tree Expand file tree Collapse file tree 2 files changed +35
-5
lines changed
Expand file tree Collapse file tree 2 files changed +35
-5
lines changed Original file line number Diff line number Diff line change 11# 201_11 数学补全\快捷键循环补全
2+ ## 如何测试
3+ ### 测试转化box_widget内容为qwidget
4+ 我们使用辅助窗口来方便观察测试效果
5+ 1 . 插入一个scheme块
6+ 2 . 展示辅助窗口
7+ ```
8+ (show-auxiliary-widget #t)
9+ ```
10+ 3 . 运行
11+ ```
12+ (set-auxiliary-widget (make-menu-widget '((tile 1 (link upper-greek-menu))) 0) "test")
13+ ```
14+ 或者更加基础的
15+ ```
16+ (set-auxiliary-widget (make-menu-widget '(symbol "<alpha>") 0) "test")
17+ ```
18+ 4 . 检查:右侧辅助窗口中正常出现数学符号的按钮
19+
20+ ## 2025/07/29 支持转化box_widget内容为qwidget
21+ ### What
22+ 修改了as_qwidget中case menu_button情况下的逻辑,在没有精确匹配到type=xpm_widget或者text_widget的时候默认包装此widget的as_qaction为一个QToolButton作为返回的qwidget。
23+
24+ ### Why
25+ 此修改是为了将box_widget作为qwidget显示。显示数学内容需要box_widget,而目前box_widget的只有as_qaction逻辑是正确的,as_qwidget逻辑是不正确的,得到的结果是一个空的QPushButton。
26+
227## 2025/07/29 给make-menu-symbol添加颜色参数
328### What
429- 给make-menu-symbol添加颜色参数
Original file line number Diff line number Diff line change @@ -873,17 +873,22 @@ qt_ui_element_rep::as_qwidget () {
873873 a->setParent (b);
874874 qwid= b;
875875 }
876- else { // text_widget
876+ else if (qtw-> type == text_widget) {
877877 QPushButton* b = new QPushButton ();
878878 QTMCommand* qtmcmd= new QTMCommand (b, cmd);
879879 QObject::connect (b, SIGNAL (clicked ()), qtmcmd, SLOT (apply ()));
880- if (qtw->type == text_widget) {
881- typedef quartet<string, int , color, bool > T1;
882- b->setText (to_qstring (open_box<T1> (get_payload (qtw)).x1 ));
883- }
880+ typedef quartet<string, int , color, bool > T1;
881+ b->setText (to_qstring (open_box<T1> (get_payload (qtw)).x1 ));
884882 b->setFlat (!(style & WIDGET_STYLE_BUTTON));
885883 qwid= b;
886884 }
885+ else {
886+ QToolButton* b = new QToolButton ();
887+ QTMCommand* qtmcmd= new QTMCommand (b, cmd);
888+ QObject::connect (b, SIGNAL (clicked ()), qtmcmd, SLOT (apply ()));
889+ b->setDefaultAction (qtw->as_qaction ());
890+ qwid= b;
891+ }
887892 qwid->setStyle (qtmstyle ());
888893 qt_apply_tm_style (qwid, style);
889894 qwid->setEnabled (!(style & WIDGET_STYLE_INERT));
You can’t perform that action at this time.
0 commit comments