随笔分类 - Qt
1
摘要:#include "studentclassinfomaintain.h"
#include "ui_studentclassinfomaintain.h"
#include "serverstyle.h" StudentClassInfoMaintain::StudentClassInfoMaintain(QWidget *parent) : QMainWindow(parent), ui(new Ui::StudentClassInfoMaintain)
{ ui->setupUi(this); init(); create
阅读全文
摘要:点击打开链接【QWebview】的必要设置WebView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);WebView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);//重要用的是QT4.6 免费版难道不支持播放Flash了? TNND 没调试出来 显示Flash的位置只是出现个小图标【QAxWidget】这种方法可行 利用组件 调用AxShockwaveFlash的成员函数 QAxWidget *flash
阅读全文
摘要:点击打开链接A question that pops up every now and again and this time I'll document my attempt to do this. To do this I use the Qt framework. More specifically, I used QtcpSocket for the connection.In this example program I will use a client-server approach to this problem. I will build a server that
阅读全文
摘要:点击打开链接Thanks alot all of you, especially Thiago,I finally got it working. The trick was to read the data after theQTcpSocket connection was closed rather than reading it whenreadyRead() was emitted.Here is my server code:QByteArray block;QDataStream out(&block, QIODevice::WriteOnly);out.setVersi
阅读全文
摘要:点击打开链接Hi All, I have two simple applications which are network based. The 'server'
takes a screenshot of its computer. When a 'client' connects, it will
receive the captured image. These are basically the fortune
server/client examples modified to transmit images instead of text. Her
阅读全文
摘要:Custom Inherits QAbstractItemView must implement functions:
public:
QModelIndex indexAt(const QPoint &point) const;*
void scrollTo(const QModelIndex &index,ScrollHint hint=EnsureVisible);*
QRect visualRect(const QModelIndex &index)const;* protected:
int horizontalOffset() const;*
bool is
阅读全文
摘要:通过Delegate创建QCheckBox来实现的Check列,只有在该列进入编辑模式时才能够Check/Uncheck。这显然不是我们想要的,网上翻来翻去,在一个国外论坛中看到了无需Delegate的实现方法,只需重写Model即可:class MyModel : public QSqlQueryModel { Q_OBJECTpublic: MyModel(QObject *parent = 0); Qt::ItemFlags flags(const QModelIndex &index) const; QVariant data(const QModelIndex...
阅读全文
摘要:http://stackoverflow.com/questions/3268073/qobject-cannot-create-children-for-a-parent-that-is-in-a-different-threadThe run() member function is executed in a different thread, rather than the thread where QNetworkRequestManager object was created.This kind of different-thread problems happen all th
阅读全文
摘要:http://hi.baidu.com/lincon_lin/blog/item/2de4d358ba97db232934f0f0.htmlGraphics View提供了一个界面,它既可以管理大数量的定制2D graphical items,又可与它们交互,有一个view widget可以把这些项绘制出来,并支持旋转与缩放。这个柜架也包含一个事件传播结构,对于在scene中的这些items,它具有双精度的交互能力。Items能处理键盘事件,鼠标的按,移动、释放、双击事件,也可以跟踪鼠标移动。Graphics View使用BSP树来提供对item的快速查找,使用这种技术,它可以实时地绘制大规模
阅读全文
摘要:1.请问可以在Qthread里面 操作 ui控件吗?不可以。 文档原文: In GUI applications, the main thread is also called the GUI thread because it's the only thread that is allowed to perform GUI-related operations所以只能通过信号和槽机制进行传递2.QT4增加了一个非常有用的类QSettingsQSettings是qt4.0提供的一个读取配置文件的类,在windows平台,它提供了ini文件读些,注册表读写的功能。而且使用也非常简单。大家
阅读全文
摘要:点击打开链接// In this function, we can get the height and width of the current widgetvoid Widget::resizeEvent(QResizeEvent *){// Use a bitmap as a mask. A bitmap only has two kind of colors: white(value is 0)// or black(other values). When we use it to set mask, we can see the window at the position// wh
阅读全文
摘要:点击打开链接昨晚想实现在两个不同的label同步切换图片,即点击其中一个label,切换其背景图片的同时另一个label的背景图片也切换成一样的,点击另一个亦然。刚开始只是考虑到切换了,却没有考虑到同步,所以没搞定。显然容易想到的是信号槽机制,建立连接这两个label的信号槽,传递QPixmap的参数,槽函数在接收到signal的同时设置另一个label的背景为传来的QPixmap参数。下面说下我的具体实现过程:假设现在要实现同步切换背景图片的两个label是label_1,label_2。定义signals:void clicked_label1(QPixmap pixmap);void c
阅读全文
摘要:点击打开链接折腾了几天,终于实现了图片的淡出淡入的效果。 其实也应该是说实现了图片的淡入效果,因为淡出效果我暂时还用不到,但原理还是一样的。 网上关于图片的淡出淡入效果的讨论蛮多的,但是用QT实现就很少了。实现这种效果有两种途径:一是读取图片的RGB值,然后渐进达到淡出淡入的效果,这种方法我没有尝试,感觉还是比较复杂。二是设置加载图片载体的透明度,从完全透明到完全显示,控制这个过程可以用过定时器(QTimer)来实现。 我是用QLabel加载图片的,主要运用到QTimer和QGraphicOpacityEffect这两个控制类。下面我说一下实现这种效果的步骤:<1> 把label的
阅读全文
摘要:Qt学习笔记,QWidget和QMainWindow新认识学习Qt这么久了,今天才发现,原来QWidget不是我想象的那种东西。居然给她设置背景是那么的不方便的。在这里得到的方式如下://在Qt3中,使用QWidget::setBackgroundPixmap可以很容易地为窗口添加背景图片,例如: widget->setBackgroundPixmap(pixmap); //到了Qt4中,则推荐使用调色板(palette)来代替以上方法,同样十分简单,例如: QPalette palette;
palette.setBrush(widget->backgroundRole(), Q
阅读全文
摘要:点击打开链接#ifndefQQUSERITEM_H就发生下列错误#defineQQUSERITEM_H#include<QTreeWidgetItem>classQQUserItem:publicQTreeWidgetItem{Q_OBJECTpublic:explicitQQUserItem(QQUserItem*parent=0);signals:publicslots:};#endif//QQUSERITEM_Hdebug\moc_QQUserItem.cpp:41:8: error: 'staticMetaObject' is not a member of
阅读全文
摘要:Qt学习笔记,设置QTabWidget的TabBar的属性 ui->tabWidget->setStyleSheet("QTabBar::tab { height: 25px; width:25px;color: white; padding: 0px;}" "QTabBar::tab:selected { background: lightgray; } ");
阅读全文
摘要:Qt学习笔记,再次分析EVA源码之后得出的结论-QListView,QListViewItem(Qt3);Q3ListView,Q3ListViewItem(Qt4)今天再次分析了Eva的源码,也看了qt3中QListView和QListViewItem手册,在Eva中实现item paint的方式如下:void EvaListViewItem::paintCell( QPainter * painter, const QColorGroup & colourGroup, int column, int width, int align )
{ if( ! isVisible() )
阅读全文
摘要:点击打开链接有关libeva的使用说明 - 登录和登出操作首先,需要简单说一下腾讯QQ2005beta1的登录过程。第一步。向服务器索要登录令牌, 对应的libeva的封装类为RequestLoginTokenPacket第二步。得到登录令牌后, 则尝试登录一个腾讯服务器。 登录包的对应封装为 LoginPacket第三步。如果服务器返回的是, 登录回应包的封装为 LoginReplyPacket 3。1 QQ_LOGIN_REPLY_OK(0x00): 则说明登录成功 3。2 QQ_LOGIN_REPLY_REDIRECT(0x01):说明服务器要求你更改新的服务器重新登录 3。3 QQ_L
阅读全文
摘要:点击打开链接Eva开发文档1 ---------- libeva 类描述=============================借鉴了 openq 和 lumaqq 的很多东西。在包解析的思路上,基本遵循了 lumaqq 的方案, 类命名上,也基本按照 lumaqq 的类命名方式。 目前 libeva 还没有完全完工, 但是基本的框架是有了,为了方便大家扩展这个库,加入更多的功能,我现在写出一个 libeva 类的基本描述。对于开发者而言,希望尽量按照目前的风格编写代码。 当然有什么建议,只管提好了。libeva 类描述libeva 类说明libeva 是腾讯即使通讯协议的一个封装库, 包括
阅读全文
1
浙公网安备 33010602011771号