muffin窗管无法获取焦点
我的看图在 Cinnamon 的 muffin 窗管测试,重命名 QDialog 无法自动获取 QLineEdit 焦点,但是 LXImage-Qt 可以。
于是我去查他的源码!
https://github.com/lxqt/lximage-qt/blob/master/src/mainwindow.cpp#L1147
Fm::renameFile(file, this);
https://github.com/lxqt/lximage-qt/blob/master/src/mainwindow.h#L46
namespace Fm {class FolderView;
}
https://github.com/lxqt/lximage-qt/blob/master/src/mainwindow.cpp#L47
#include <libfm-qt6/folderview.h>
LXImage-Qt 用了 libfm 库。
https://github.com/lxqt/libfm-qt/blob/a44aaaee7a9d18efa27112a700545c23c162d9e5/src/renamedialog.cpp#L100
ui->fileName->setFocus(); // needed with Qt >= 6.6.1
https://github.com/lxqt/libfm-qt/blob/a44aaaee7a9d18efa27112a700545c23c162d9e5/src/rename-dialog.ui#L130
<widget class="QLineEdit" name="fileName"/>
理论上 QLineEdit->selectAll() 会自动获取焦点,不需要额外设置焦点。
实测 Qt5.15 再次 QLineEdit->setFocus() muffin窗管仍然无法获取焦点。
由于我的看图要照顾多平台依赖最低 Qt5.15,所以暂时实现不了。