![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Qt
文章平均质量分 69
午小夜
这个作者很懒,什么都没留下…
展开
-
Qt Style Sheet自定义QSlider
QSlider::groove:horizontal { border:1px solid gray;height:8px;background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1,stop:1 #c4c4c4);}QSlider::handle:horizontal {width:40px;原创 2014-04-24 14:08:27 · 702 阅读 · 0 评论 -
[转]Qt在Windows下添加语音输出功…
reprinted fromhttp://hi.baidu.com/xchinux/blog/item/a665b545da8ea22dcffca3b0.html先在机器上安装Microsoft Speech SDK5.1,然后在控制面板中设置文字->语音默认语音为简体中文,在Qt代码中如下写:(pro中加CONFIG +=qaxcontainer)#ifndef WIDGET_H原创 2014-04-24 14:09:29 · 1483 阅读 · 0 评论 -
[转] qt播放flash
Shiroki@www.cuteqt.com刚看见个用activex插件的方式播放的方法, 挺好。memo一下#include #include int main(int argc, char*argv[]) {QApplication a(argc, argv);QAxWidget *flash = newQAxWidget(0,0); flash->resize(10原创 2014-04-24 14:09:31 · 297 阅读 · 0 评论 -
X11/Linux下发布Qt程序(Deploying …
轉載請註明本文轉自 http://blog.sina.com.cn/s/blog_7a9ade2c0100vcfh.html 在X11平臺下發佈qt程序,首先準備好程序中需要使用的資源,庫和插件。。。比如你的可運行程序取名叫作panel,那把你的panel,那些libQt*.so.4和libQt*.so.4.6.0(链接和共享库都要)放在同一目錄下(也可以不同,只要小小修改下shell文件原创 2014-04-24 14:09:33 · 495 阅读 · 0 评论 -
linux qt环境变量设置
终端输入:sudogedit /etc/profile //或者:sudovim /etc/profile在文件的末尾加上以下语句 :QTDIR=path_to_your_Qt_SDKPATH=$QTDIR/qt/bin:$PATHPATH=$QTDIR/bin:$PATHMANPATH=$QTDIR/man:$MANPATHLD_LIBRARY_PATH=原创 2014-04-24 14:09:35 · 311 阅读 · 0 评论 -
Qt Model & View的角色設定.(文本…
經常我們有這樣的需求:比如文本居中顯示,背景色,文本顔色的設置...等等這些樣式設定.之前寫過一個繼承自QDirModel的類(見下文).我們需要改動的地方就是QVariant QDirModel::data(const QModelIndex & index,int role = Qt::DisplayRole) const [virtual]這個函數.察看Qt Assistan原创 2014-04-24 14:09:39 · 356 阅读 · 0 评论 -
Qt rand隨機色
int r,g,b;QString color,stR,stG,stB;qsrand(QTime(0,0,0).msecsTo(QTime::currentTime()));r = rand() % 256;g = rand() % 256;b = rand() % 256;bool ok = true;stR.setNum(r,16);if(stR.toInt(&ok,16)s原创 2014-04-24 14:09:41 · 945 阅读 · 0 评论 -
[转] qt特效按鈕QPushButton
Reprinted from http://wiki.qtcentre.org/index.php?title=AeroButton//Declaration#include #include class AeroButton : public QPushButton { Q_OBJECT public: AeroButton(QWidget *原创 2014-04-24 14:09:44 · 400 阅读 · 0 评论 -
[转] Qt configure參數
配置参数选项:前面是*号的表示默认参数. +号表示该功能要求被评估,评估成功后才能被接受.-release ...........调试关闭.没有调试库,自己的项目只能发布,不能调试(没有调试库的缘故),如果你硬要编译debug版本的话,会提示找不到xxxxxd.dll* -debug .............只有调试库,没有释放库,也就是说以后自己的项目只能调试,如果你硬要编译d原创 2014-04-24 14:09:46 · 306 阅读 · 0 评论 -
qt StyleSheet设置滚动条样式表
以textEdit為例。textEdit->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{""border:0px solidgrey;""width: 35px;""}"" QScrollBar::handle:vertical {"" background: #8080FF;"" border:原创 2014-04-24 14:09:48 · 4458 阅读 · 1 评论 -
QSettings添加注册表项(Windows开…
QString path =QCoreApplication::applicationDirPath();QDir::setCurrent(path);path.replace("/","\\");path.append("\\Nanya.exe");QSettings *reg = newQSettings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Mi原创 2014-04-24 14:09:50 · 611 阅读 · 0 评论 -
前景图片alpha通道值的设置
//---画背景QPixmap pixmapBg(":bg.jpg");QPainter painter(this);painter.drawPixmap(0, 0, pixmapBg);QPixmap pixmapTop(":top.jpg");int alpha = 125;//---前景图片透明度处理QPixmap temp(pixmapTop.size());temp.f原创 2014-04-24 14:09:52 · 714 阅读 · 0 评论 -
【经验分享】Qt關於driver not loa…
耐心看完全文,絕對會有收穫的!问题描述:自己写好的一个工程,拿到Linux Ubuntu操作系统下运行不起来,提示QMYSQLdriver not loaded.驱动无法加载!我是刚转到Ubuntu下的 ,Qt SDK也是安装比较新的2009.04版(Qt 4.5.3).安装了MySQL的dev包.(makesure that you've installed the mysqlcli原创 2014-04-24 14:09:54 · 372 阅读 · 0 评论 -
QtWebKit播放flash的設置
m_webView = newQWebView(this);m_webView->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff);m_webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);con原创 2014-04-24 14:09:26 · 370 阅读 · 0 评论 -
QHeaderView的樣式設定(以QTableWi…
QTableWidget* table =new QTableWidget(3,4,this);table->horizontalHeader()->setResizeMode(QHeaderView::Stretch);table->setFixedSize(640,480);//verticalHeadertable->verticalHeader()->setStyleSheet原创 2014-04-24 14:09:24 · 758 阅读 · 0 评论 -
[转]Qt中pro文件的写法
reprinted from http://hi.baidu.com/xinxi123/blog/item/3948df1ba3ef56f0ae5133cf.html在QT中,有一个工具qmake可以生成一个makefile文件,它是由.pro文件生成而来的,.pro文件的写法如下:1. 注释从“#”开始,到这一行结束。2.指定源文件SOURCES = *.cpp对于原创 2014-04-24 14:09:22 · 283 阅读 · 0 评论 -
QImage实现图片间渐变切换
//declaration#ifndefWIDGET_H#defineWIDGET_H#include#include#includeclass Widget :public QLabel{ Q_OBJECTprivate: boolm_bFlag;//true:1->2;false:2->1; int per; //the原创 2014-04-24 14:08:36 · 442 阅读 · 0 评论 -
[摘]gdb查看QString类型变量
reprinted from:http://hi.baidu.com/yy73/blog/item/3aa83cad810a860c4a36d623.html# A Printing routine for QString in GDBGDBsupports the command print toprint out the content of variables. This原创 2014-04-24 14:08:43 · 1211 阅读 · 0 评论 -
Qt屏幕截屏
includeintmain(int argc,char *argv[]){ QApplication app(argc,argv); QPixmappixmap=QPixmap::grabWindow(QApplication::desktop()->winId());//截屏 pixmap.save("screen.png","png");原创 2014-04-24 14:08:48 · 330 阅读 · 0 评论 -
[转] Qt,Qt-Embedded, Qtopia你…
Qt,Qt-Embedded, Qtopia你分清了吗???Qt的授权是分为两条线,商业版和开源版。如果使用商业版的Qt,那么开发出的程序可以是私有的和商业的;如果使用的是开源版的Qt,由于其使用的是GPL协议,那么可发出的程序也必须是GPL的。不过自从qt4.5.0版本,诺基亚公司使用了LGPL协议,那么写出的程序就可以据为己有了!Qt的版本是按照不同的图形系统来划分的,目前原创 2014-04-24 14:08:50 · 243 阅读 · 0 评论 -
Qt contextMenu的创建和使用
Qt中的部件的弹出菜单(ContextMenu),依据ContextMenuPolicy的值的不同,有四种形式:一、默认菜单此时,ContextMenuPolicy的值为Qt::DefaultContextMenu,这是默认值,其将显示部件定义的默认菜单二、无菜单此时,ContextMenuPolicy的值为Qt::NoContextMenu三、由Action定义菜单此时,Cont原创 2014-04-24 14:08:54 · 1232 阅读 · 0 评论 -
[转] Qt中动态链接库的使用
reprintedfrom:http://www.qtcn.org/bbs/read.php?tid=14719工程A中,使用了这样一个类,专门用来让算所得税;Tax.hclass Tax{float incomeTax(int income);};Tax.cppTax::incomeTax(int income){float res=(income-1600)*0.5原创 2014-04-24 14:09:05 · 364 阅读 · 0 评论 -
[转] Qt属性setProperty & propert…
reprinted from:http://spaces.msn.com/members/nzt/Blog/cns!1pmB0kdXbVha3bZHlaGN-REA!273.entry1.属性有什么用?由于c++类具备封装特性,不推荐对类成员变量(classvariables)进行直接存取。现代编译器引用属性(property)的概念,对成员变量进行安全的存取。比如在win平台下vc7有类原创 2014-04-24 14:09:09 · 440 阅读 · 0 评论 -
Qt漸變色 QGradient
★BlackWhitebackground:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0,stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255,255)); ★Czechbackground:qconicalgradient(cx:0.5, cy:0.5, angle:0, sto原创 2014-04-24 14:09:11 · 406 阅读 · 0 评论 -
Qt给Window应用程序添加桌面图标
首先准备个ICO图标。例如:myappico.ico用记事本新建个文件,里面就写一行:IDI_ICON1 ICON DISCARDABLE"myappico.ico" 保存改名为myapp.rc并把它和你的图标myappico.ico一起复制到你的QT工程项目的目录。 用记事本打开你的QT工程文件(如 "myapp.pro" ),在里面最后新添一行RC_FILE = myapp原创 2014-04-24 14:09:13 · 406 阅读 · 0 评论 -
Qt关于dll的生成和使用(Qt C++ li…
Step 1 : 生成dll和.a (shared library)★ 新建工程:C++ library)" TITLE="Qt关于dll的生成和使用(Qt C++ library)" />C++ library)" TITLE="Qt关于dll的生成和使用(Qt C++ library)" />C++ library)" TITLE="Qt关于dll的生成和使用(Qt C+原创 2014-04-24 14:09:16 · 403 阅读 · 0 评论 -
QRegExp正则表达式
"^\d+$" //非负整数(正整数+ 0) "^[0-9]*[1-9][0-9]*$" //正整数 "^((-\d+)|(0+))$" //非正整数(负整数 + 0) "^-[0-9]*[1-9][0-9]*$" //负整数 "^-?\d+$" //整数 "^\d+(\.\d+)?$" //非负浮点数(正浮点数 + 0) "^(([0-9]+\.[0-9]*[1-9原创 2014-04-24 14:09:18 · 414 阅读 · 0 评论 -
QUdpSocket傳輸圖片QImage(QPixmap…
#ifndef SENDER_H#define SENDER_H#include #include #include #include #include #include #include class Sender : public QWidget{Q_OBJECTprivate:QLabel* m_label;QPushButton* m_browse;QUdp原创 2014-04-24 14:09:20 · 386 阅读 · 0 评论 -
Qt异常处理
/#ifndef WIDGET_H#define WIDGET_H#include #include class Widget : public QWidget{Q_OBJECTprivate:int a;QLineEdit* le;QLabel* label;public:Widget(QWidget *parent = 0);~Widget();private原创 2014-04-24 14:09:56 · 1962 阅读 · 0 评论