FPC and Qt
Introduction
There are a number of Qt bindings available:
Qt3
Another QtC based binding by Andreas
The first one aims on linux/unix users while the second one is for win32.
Qt/Embedded
The FPC arm port and this Qt/E binding allow graphical programming on devices such as the Zaurus
Qt4
More recently a small Qt4 Binding is available. It does not depend on the obsolete QtC library. The Qt4 binding page will provide more information on how the binding works and how to use it.
How it works
FPC still can't use C++ classes natively so these interface units use the same scheme as e.g. the official C interface to Qt does: there are wrapper procedures written which export an procedural interface. This procedural interface is wrapped by an object pascal interface again to make usage easier.
This might sound like an huge overhead but these wrapper are mainly necessary to hide name mangling differences so there shouldn't be a noticable speed decrease in real world applications.
Example
This piece of code is taken from the second package mentioned above.
var
app: QApplicationH;
btn: QPushButtonH;
begin
// create static ( interfaced handled ) QApplicationH
app := NewQApplicationH(ArgCount, ArgValues).get;
// due to a bug in fpc 1.9.5 the WideString helper methods with default parameter are disabled
//btn := NewQPushButtonH('Quit', nil).get;
btn := NewQPushButtonH(qs('Quit').get, nil, nil).get;
btn.setGeometry(100, 100, 300, 300);
btn.show;
// override the virtual eventFilter method of btn
btn.OverrideHook.eventFilter := @TTest.MyEventFilter;
// and install the btn as it's own eventFilter
btn.installEventFilter(btn);
// connect Qt signal to Qt slot
QObjectH.connect(btn, SIGNAL('clicked()'), app, SLOT('quit()'));
...
If you know how Qt is used in C++, you can see that there is not much difference.
FPC and Qt的更多相关文章
- QT内省机制、自定义Model、数据库
本文将介绍自定义Model过程中数据库数据源的获取方法,我使用过以下三种方式获取数据库数据源: 创建 存储对应数据库所有字段的 结构体,将结构体置于容器中返回,然后根据索引值(QModelIndex) ...
- Ubuntu 下安装QT
Ubuntu 下安装QT 本文使用的环境 QT Library: qt-everywhere-opensource-src-4.7.4.tar.gz QT Creator: qt-creator-li ...
- Qt安装配置
Qt Creator: 下载: Qt 5.5.1 for Windows 32-bit(MinGW 4.9.2, 1.0 GB):http://download.qt.io/official_rele ...
- Qt信号与槽自动关联机制
参考链接1:http://blog.csdn.net/skyhawk452/article/details/6121407 参考链接2:http://blog.csdn.net/memory_exce ...
- 保持Qt GUI响应的几种方法
最开始使用Qt时就遇到过QT Gui失去响应的问题,我是用多线程的方式解决的,然而通常来说,多线程是会降低程序的运行速度. 之后,在使用QSqlQuery::execBatch()函数时,Qt Gui ...
- Qt 中使用Singleton模式需小心
在qt中,使用Singleton模式时一定要小心.因为Singleton模式中使用的是静态对象,静态对象是直到程序结束才被释放的,然而,一旦把该静态对象纳入了Qt的父子对象体系,就会导致不明确的行为. ...
- Qt——组件位置随窗口变化
当我们用Qt Designer设计界面时,有时会面临这样一个问题:需要在窗口指定位置放置组件,并且当窗口位置大小改变时,该组件相对其父对象的位置是不变的,如下面两幅图所示 ,首先看上面这幅图,注意bu ...
- (转) Qt 出现“undefined reference to `vtable for”原因总结
由于Qt本身实现的机制所限,我们在使用Qt制作某些软件程序的时候,会遇到各种各样这样那样的问题,而且很多是很难,或者根本找不到原因的,即使解决了问题,如果有人问你为什么,你只能回答--不知道. 今天我 ...
- qt中ui的 使用介绍
1.什么是ui?ui通常是用Qt 设计师设计出来的界面文件的后缀.通常情况下ui是一个指向这个界面类的指针.ui-> 一般就是用来访问这个界面类里面的控件.例如你的ui文件里有一个叫okButt ...
随机推荐
- Android-Binder原理浅析
Android-Binder原理浅析 学习自 <Android开发艺术探索> 写在前头 在上一章,我们简单的了解了一下Binder并且通过 AIDL完成了一个IPC的DEMO.你可能会好奇 ...
- Android 常见SD卡操作
目录 Android 常见SD卡操作 Android 常见SD卡操作 参考 https://blog.csdn.net/mad1989/article/details/37568667. [0.] E ...
- 1038 一元三次方程求解 2001年NOIP全国联赛提高组
题目描述 Description 有形如:ax3+bx2+cx+d=0 这样的一个一元三次方程.给出该方程中各项的系数(a,b,c,d 均为实数),并约定该方程存在三个不同实根(根的范围在-100 ...
- [POJ1655]Balancing Act
思路:DP求树的重心.对于每个结点$i$,$d_i=\displaystyle{\sum_{j\in s(i)}}d_j+1$.删去这个点能得到的最大子树大小即为$\max(\max\limits_{ ...
- BZOJ3009 : 集合
取一棵生成森林,根据题目限制可得,与一个点相连的多余的边数是$O(\sqrt{m})$级别的. 对于树边,每个点维护3棵权值线段树,依次保存它的儿子里各个集合的边. 再开3*3个分块数组,记录多余边以 ...
- Timer-triggered memory-to-memory DMA transfer demonstrator
http://www.efton.sk/STM32/bt.c // Timer-triggered memory-to-memory DMA transfer demonstrator for STM ...
- C# MD5 32位加密 UTF-8编码
项目开发过程中需要用到MD5加密,最开始的使用使用加密方法: public static string GetMD5(string str) { byte[] b ...
- 根据twitter的snowflake算法生成唯一ID
C#版本 /// <summary> /// 根据twitter的snowflake算法生成唯一ID /// snowflake算法 64 位 /// 0---0000000000 000 ...
- 【Go命令教程】命令汇总
[Go命令教程]1. 标准命令详解 [Go命令教程]2. go build [Go命令教程]3. go install [Go命令教程]4. go get [Go命令教程]5. go clean [G ...
- cocos2dx学习之路
http://blog.csdn.net/qq_30501909/article/details/50720227