QT弹出模态对话框做法: 1、新建UI文件时,一定要选择基类是QDialog的,我的选择是:Dialog without Buttons(),如下图: 2、然后在使用的时候: MyDialog dlg(this); dlg.exec(); 如果不加this,则会在任务管理器里面产生一个新的EXE。 Read More
posted @ 2016-06-10 22:10 findumars Views(2802) Comments(0) Diggs(0)
QPushButton { background-image: url(:/Resources/green_click.png); image: url(:/Resources/toolsbutton_install.png); border:none; image-position:left; p Read More
posted @ 2016-06-10 22:09 findumars Views(949) Comments(0) Diggs(0)
目前发现有两种方法,如下: 1、使用QPixmap的transformed函数旋转,这个函数默认是以图片中心为旋转点,不能随意设置旋转点,使用如下: QMatrix leftmatrix; leftmatrix.rotate(180); QLabel *pLabel= new QLabel();pL Read More
posted @ 2016-06-10 21:52 findumars Views(7958) Comments(0) Diggs(0)
1、设置行间距 QLabel没有设置行间距的函数,所以这种办法是行不通的。只能采用其它类似的方法来实现,例如设置行高,使用样式代码如下: <p style='line-height:18px'>推荐</p> 2、链接文本 实现点击Label,即可打开网页,且文本没有下划线效果,如下: <a href Read More
posted @ 2016-06-10 21:50 findumars Views(3357) Comments(0) Diggs(0)
在派生类中重载QDialog的void paintEvent(QPaintEvent *)事件,在这个函数中加入以下代码 QPainter painter(this); QLinearGradient grad(0, 0, width(), height()); QGradientStops gs; Read More
posted @ 2016-06-10 21:48 findumars Views(2053) Comments(0) Diggs(0)