因为项目的需要以及主管的要求,准备将工程移植到Qt中,这样就可以比较容易的实现跨平台了。因为之前工程是在windows下开发的,第一个平台又是mobile所以除了底层框架之外其他的都是使用的windows的API以及编程模式,现在要移植到Qt中,第一个要面临的问题就是如何将windows的消息机制很
分类:
其他好文 时间:
2016-02-08 21:20:04
阅读次数:
337
void QWidget::repaint ( int x, int y, int w, int h, bool erase = TRUE ) [槽] 通过立即调用paintEvent()来直接重新绘制窗口部件,如果erase为真,Qt在paintEvent()调用之前擦除区域(x,y,w,h)。
分类:
其他好文 时间:
2016-02-08 21:15:28
阅读次数:
271
转 QtWidgets作为一个独立的模块 例如编译时错误 error: QMainWindow: No such file or directory error: QToolButton: No such file or directory error: QWidget: No such file
分类:
其他好文 时间:
2016-02-05 01:27:29
阅读次数:
204
程序中数据导出是经常有的需求,今天学习把文本导出到pdf文件。主要是用QPrinter,QPainter [cpp] view plain copy TextEditToPdf::TextEditToPdf(QWidget *parent, Qt::WFlags flags) : QDialog(p
分类:
其他好文 时间:
2016-02-01 20:35:11
阅读次数:
850
既然是控件,就应该有界面,默认生成的控件类只是一个继承了QWidget的类,如下:[cpp]view plaincopy#ifndefLOGLATEDIT_H#defineLOGLATEDIT_H#includeclassLogLatEdit:publicQWidget{Q_OBJECTpublic...
分类:
其他好文 时间:
2016-01-06 16:01:02
阅读次数:
481
voidPreviewWnd::paintEvent(QPaintEvent*ev){//从QWidget派生的窗口,如果要使用stylesheet,必须要重载paintEvent,并在函数中写如下代码QStyleOptionopt;opt.init(this);QPainterp(this);style()->drawPrimitive(QStyle::PE_Widget,&opt,&p,this);}
分类:
其他好文 时间:
2015-12-30 13:51:34
阅读次数:
129
头文件定义:------------------------------------------------------------------class TDragProxy:public QObject{ Q_OBJECTpublic: TDragProxy(QWidget* parent);....
分类:
其他好文 时间:
2015-12-25 18:41:18
阅读次数:
191
Qt中的QTabWiget 类提供了一个便签控件,但是这个控件默认初始化的颜色是白色,和原窗口的颜色不同,看起来非常的违和,所以我们希望将其的背景颜色设为当前窗口的背景颜色。我们所要做的就是先将应用程序窗口的背景颜色取出来,然后再赋给QTabWiget 类的每个标签,比如说我们有tab1和tab2两...
分类:
其他好文 时间:
2015-12-18 22:36:13
阅读次数:
171
QDetectPlot::QDetectPlot(QWidget *parent) : QCustomPlot(parent){ QVector x(101), y(101); // initialize with entries 0..100 for (int i=0; iset...
分类:
其他好文 时间:
2015-12-17 10:42:00
阅读次数:
185
but = QtWidgets.QToolButton(Dialog2) but.setText('**') but.setAutoRaise(True) layout.addWidget(but) Dialog2.setWindowFlags(QtCore.Qt.Frame...