QT 禁止QLineEdit输入空格、空值

QRegExp rx("[^\\s]+$");
    QRegExpValidator *validator = new QRegExpValidator(rx, this);
    ui->lineedit->setValidator(validator);

正则表达式参考链接:https://blog.csdn.net/Hyc_cheng/article/details/112132963
posted @ 2023-10-18 15:14  雾枫  阅读(498)  评论(0编辑  收藏  举报