StupidBeauty
Read times:379Posted at:Mon May 2 22:49:29 2011
- no title specified

Wt3.1.9文档翻译:WLineEdit类参考,WLineEdit Class Reference

这个部件提供一个单行的输入框

要想对文字的改变进行响应的话,就把一个信号槽连接到 changed() 信号上。在以下情况下会发射这个信号:用户改变咯输入框中的内容,并且接下来让这个输入框失去焦点。

要对用户的编辑动作进行响应,则将一个信号槽连接到keyWentUp()信号上

在任何时候,都可以使用text()方法来获取当前的内容。

你可以使用setMaxLength()来指定输入框的最大长度。如果你想要提供更细致的输入检验功能的话,那么你可以使用 setValidator(WValidator *) 方法来设置一个检验器 。通常 ,在调用 validate() ,检验器同时提供客户端的检验 (仅是视觉上的反馈)和服务器端的检验。

使用示例

Wt::WContainerWidget *w = new Wt::WContainerWidget();

Wt::WLabel *label = new Wt::WLabel("Age:", w);

Wt::WLineEdit *edit = new Wt::WLineEdit("13", w);

 edit->setValidator(new Wt::WIntValidator(0, 200));

 label->setBuddy(edit);

这个部件对应于HTML <input type="text">或者<input type="password">标记。

WLineEdit是一个内联部件。

CSS

可以使用.Wt-edit-emptyText来设置emptyText 样式,其它样式可以使用内联或者外部CSS 来设置

参见:

WTextArea

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4