博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FPC and Qt
阅读量:4980 次
发布时间:2019-06-12

本文共 1793 字,大约阅读时间需要 5 分钟。

Introduction

There are a number of Qt bindings available:

Qt3

The first one aims on linux/unix users while the second one is for win32.

Qt/Embedded

The FPC arm port and this  allow graphical programming on devices such as the Zaurus

Qt4

More recently a small  is available. It does not depend on the obsolete QtC library. The  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.

转载于:https://www.cnblogs.com/h2zZhou/p/10179430.html

你可能感兴趣的文章
自己做手做“分享到”小工具
查看>>
link快捷方式
查看>>
20145235 学号 《Java程序设计》第2周学习总结
查看>>
python数据结构之冒泡排序
查看>>
python Day02
查看>>
PAT 1009. 说反话 (20)
查看>>
解析IP地址与MAC地址
查看>>
在win7下,easyphp安装过程中MSVCR110.DLL没有被指定在WINDOWS上运行,或者它包含错误...
查看>>
Win8下各种加密算法
查看>>
有关类方法调用的概括
查看>>
(转载)驱动之路-platform按键驱动
查看>>
nd.array.where
查看>>
Recipe 19.2. Building a List from Any Iterable
查看>>
oracle数据库DB_NAME、DBID、DB_UNIQUE_NAME等的区别
查看>>
搜集:css中的filter属性语法说明
查看>>
BufferedWriter知識點復習
查看>>
asp.net错误处理封装
查看>>
用SQL语句操作·数据
查看>>
java 动手动脑
查看>>
LoadRunner性能测试之常见函数及参数的说明和作用
查看>>