03 2013 档案

摘要:今天按照C++ Gui qt4编程书上介绍的动态加载对话框的时候,自己走进了一个误区:代码:QUiLoader ul;QFile file("a.ui");QWidget * wd = ul.load(&file);if(wd) wd->show();出现如下错误:Designer: An error has occurred while reading the UI file at line 1, column 0: Premature end of document.最后发现自己只是将a.ui文件放到了编译目录,而没有放到可执行文件所在的目录(QtCrea 阅读全文
posted @ 2013-03-22 11:50 justwake 阅读(1452) 评论(0) 推荐(0)
摘要:Qt下调用windows api方法很简单,包含"windows.h"就好!#include <QApplication>#include "windows.h"#include "stdio.h"#include <QDebug>int main(int argc, char *argv[]){ QApplication a(argc, argv); MEMORYSTATUS mem;//定义一个内存状态变量 DWORD MemTotal,MemFree,VMemTotal,VMemFree;//存储内存状态 阅读全文
posted @ 2013-03-14 13:27 justwake 阅读(11663) 评论(0) 推荐(0)
摘要:设置字体大小使用QFont 的setPontSizeQLabel *lb = new QLabel(tr("examp"));QFont ft;ft.setPointSize(14);lb->setFont(ft);设置颜色使用QPaletteQLabel *lb = new QLabel(tr("examp"));QPalette pa;pa.setColor(QPalette::WindowText,Qt::red);lb->setPalette(pa); 阅读全文
posted @ 2013-03-07 17:11 justwake 阅读(27980) 评论(0) 推荐(0)
摘要:首先看下QFontDatabase类的说明:The QFontDatabase class provides information about the fonts available in the underlying window system. More...也就是说QFont使用的是系统字体,而不能是自定义字体!所以为了使用自定义字体,必须将自定义字体安装(copy)到系统字体文件夹中(如C:\windows\fonts)./* * 名称:modifyFont * 参数:const QString * 功能:更改本程序所使用的字体 * 返回:bool */bool Monitor::m 阅读全文
posted @ 2013-03-02 12:22 justwake 阅读(2395) 评论(3) 推荐(0)