随笔分类 - Qt
设置Qt应用程序图标
摘要:首先准备个ICO图标。例如:myappico.ico用记事本新建个文件里面就写一行:IDI_ICON1 ICON DISCARDABLE "myappico.ico"保存改名为 myapp.rc并把它和你的图标myappico.ico一起复制到你的QT工程项目的目录。用记事本打开你的QT工程文件(如 "myapp.pro" ),在里面最后新添一行RC_FILE = myapp.rc保存,编译你的工程,嘿嘿。。成功了吧。。。
阅读全文
qdebug使用方法
摘要:首先在头文件中包含#include <QDebug>在需要使用的地方插入:qDebug("intensity:%d",intensity[0][2]); (%d表示整数)输出结果:intensity:195注:%a,%A 读入一个浮点值(仅C99有效) %c 读入一个字符 %d 读入十进制整数 %i 读入十进制,八进制,十六进制整数 %o 读入八进制整数 %x,%X 读入十六进制整数 %s 读入一个字符串,遇空格、制表符或换行符结束。 %f,%F,%e,%E,%g,%G 用来输入实数,可以用小数形式或指数形式输入。 %p 读入一个指针 %u 读入一个无符号十..
阅读全文
How to slove the problem of Garbage Characters of Chinese and Errors of Images in Qt
摘要:Sometimes it is miserable to find that the release version of your software has Garbage Characters and Errors in Images.Here is a good solution which has been tested to be ok.1. In the main() function of your program, add this at the very beginning: QApplication::addLibraryPath("./plugins"
阅读全文
Qt ScrollArea
摘要:We can show a image with automatic scroll bars with the use of QScrollArea.This is a simple application with QScrollArea.#include <QtGui/QApplication>#include <QLabel>#include <QScrollArea>#include "qmlapplicationviewer.h"Q_DECL_EXPORT int main(int argc, char *argv[]){ QA
阅读全文
Qt QPainter
摘要:To paint on a device, usually a widget, we need to overload the function void QWidget::paintEvent(QPainteEvent *event){}We also need to construct the object of QPainter in the function of paintEvent like this: QPainter painter(this);Then we will be able to use QPainter whataver we like.
阅读全文
Qt How to get the width and height of a widget
摘要:QWidget::width();QWidget::height();
阅读全文
Qt QLabel 显示中文
摘要:头文件包含:#include <QTextCodec>在QApplication app(argc,argv);之后加:QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK"));显示中文时调用:QObject::tr("中文")例如:QLabel hello(QObject::tr("你好世界"));
阅读全文
How to release a Qt program
摘要:There are two main factors to start a Qt program:1. In the 'Project' menu, select 'Release';2. Copy the files in 'bin' to the folder of the program.
阅读全文
浙公网安备 33010602011771号