方法: 使用 QComboxBox::addItem(QIcon, QString);示例: 点击(此处)折叠或打开 QComboBox *combo_status = new QComboBox(this); QIcon onlineIcon (":/icon/online.png"); QIco Read More
posted @ 2016-06-10 23:20 findumars Views(1829) Comments(0) Diggs(0)
引言 用Qt程序在手机上显示一幅图片对编程人员来说是再基础不过的一件事情了。那么先让大家看两段代码: //dangerous should not be used, cannot display earth.png, //but if we change earth.png to a smaller Read More
posted @ 2016-06-10 23:18 findumars Views(1595) Comments(0) Diggs(0)
Qt有两种定时器,一种是QObject类的定时器,另一种是QTimer类的定时器。 (1)QObject类的定时器 QObject类提供了一个基本的定时器,通过函数startTimer()来启动,通过killTimer()来结束,通过QTimerEvent来处理定时器事件。 (1)QObject类的 Read More
posted @ 2016-06-10 23:15 findumars Views(5465) Comments(0) Diggs(0)
Qt的布局方式主要有四种: QGridLayout 栅格布局 QFormLayout 表格布局 QHBoxLayout 水平布局 QVBoxLayout 垂直布局 然而,只通过以上四种布局的组合似乎不太好用, 因此需要搭配分割器QSplitter, 在QSplitter中实现局部布局,最后再放进主布 Read More
posted @ 2016-06-10 23:14 findumars Views(6343) Comments(1) Diggs(0)
今天在使用addStretch,布局的时候,发现addStretch竟然是可以平均分配的,有意思。比如: 您会发现,buttonLayout的布局将空白没有widget的地方分成了9份,然后按照您所规定的地方分配弹簧,于是布局起来就方便多了,以前没有发现这个,一直还为布局头疼呢,现在有点门路了。 v Read More
posted @ 2016-06-10 23:13 findumars Views(2749) Comments(0) Diggs(0)