QT4中QLabel控件实现网址超链接

来源:互联网 发布:金苹果淘宝培训学院 编辑:程序博客网 时间:2024/04/30 18:48

文章原创,转载请注明出处

 

试了一下在QT中真是非常方便地就实现了,只要几条语句

QLabel*openfilelabel=newQLabel(this);

    openfilelabel->setOpenExternalLinks(true);//这句很关键啊,否则就只能通过linkActivated信号,连接到自定义槽函数中打开了

openfilelabel->setText(tr("<ahref=\"http://www.csdn.net/\">打开CSDN"));

openfilelabel.show();

就搞定了微笑

原创粉丝点击