想点击lineEdit选中全部文本,
使用selectAll()发现无效
参考:https://stackoverflow.com/questions/35653331/qlineedit-selectall-doesnt-work
得到解决
应该是全选被点击的鼠标事件给取消了
所以FocusIn中添加以下代码
//我这里使用eventFilter函数
if(event->type()==QEvent::FocusIn)
{
QTimer::singleShot( 0,[=]() mutable{
lineEdit->selectAll();
});
}