Why Does Qt Use Moc for Signals and Slots(QT官方的解释:GUI可以是动态的)
GUIs are Dynamic
C++ is a standarized, powerful and elaborate general-purpose language. It's the only language that is exploited on such a wide range of software projects, spanning every kind of application from entire operating systems, database servers and high end graphics applications to common desktop applications. One of the keys to C++'s success is its scalable language design that focuses on maximum performance and minimal memory consumption whilst still maintaining ANSI C compatibility.
For all these advantages, there are some downsides. For C++, the static object model is a clear disadvantage over the dynamic messaging approach of Objective C when it comes to component-based graphical user interface programming. What's good for a high end database server or an operating system isn't necessarily the right design choice for a GUI frontend. With moc
, we have turned this disadvantage into an advantage, and added the flexibility required to meet the challenge of safe and efficient graphical user interface programming.
Our approach goes far beyond anything you can do with templates. For example, we can have object properties. And we can have overloaded signals and slots, which feels natural when programming in a language where overloads are a key concept. Our signals add zero bytes to the size of a class instance, which means we can add new signals without breaking binary compatibility.
Another benefit is that we can explore an object's signals and slots at runtime. We can establish connections using type-safe call-by-name, without having to know the exact types of the objects we are connecting. This is impossible with a template based solution. This kind of runtime introspection opens up new possibilities, for example GUIs that are generated and connected from Qt Designer's XML UI files.
http://doc.qt.io/qt-5/why-moc.html
Why Does Qt Use Moc for Signals and Slots(QT官方的解释:GUI可以是动态的)的更多相关文章
- How Qt Signals and Slots Work(感觉是通过Meta根据名字来调用)
Qt is well known for its signals and slots mechanism. But how does it work? In this blog post, we wi ...
- Dynamic Signals and Slots
Ref https://doc.qt.io/archives/qq/qq16-dynamicqobject.html Trolltech | Documentation | Qt Quarterly ...
- qt之旅-1纯手写Qt界面
通过手写qt代码来认识qt程序的构成,以及特性.设计一个查找对话框.以下是设计过程 1 新建一个empty qt project 2 配置pro文件 HEADERS += \ Find.h QT += ...
- Qt 4.6: A Quick Start to Qt Designer
Qt 4.6: A Quick Start to Qt Designer A Quick Start to Qt Designer Using Qt Designer involves four ba ...
- Qt DLL总结【三】-VS2008+Qt 使用QPluginLoader访问DLL
目录 Qt DLL总结[一]-链接库预备知识 Qt DLL总结[二]-创建及调用QT的 DLL Qt DLL总结[三]-VS2008+Qt 使用QPluginLoader访问DLL 开发环境:VS20 ...
- Qt国际化(Q_DECLARE_TR_FUNCTIONS() 宏给非Qt类添加翻译支持,以前没见过QTextEncoder和QTextDecoder和QLibraryInfo::location()和QEvent::LanguageChange)
Internationalization with Qt 应用程序的国际化就是使得程序能在国际间可用而不仅仅是在本国可用的过程. Relevant Qt Classes andAPIs 以下的类支持Q ...
- Qt-c++桌面编程报错:qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "",已解决
语言:c++ 编译库:Qt GUI,qt5.12.1 软件类型:Qt application,qt桌面软件 运行平台:window 10 ?按照[https://www.devbean.net/201 ...
- Qt开发的程序在没有安装Qt环境的机器上可能出现的一些问题
Qt开发的程序在没有安装Qt环境的机器上可能出现的一些问题,如:除png外的其它类型的图片,如:jpg.ico.bmp等,还有中文乱码等问题,出现这些问题的本质是Qt对这类文件格式或编码格式的支持方式 ...
- [Qt Creator 快速入门] 第2章 Qt程序编译和源码详解
一.编写 Hello World Gui程序 Hello World程序就是让应用程序显示"Hello World"字符串.这是最简单的应用,但却包含了一个应用程序的基本要素,所以 ...
随机推荐
- ASP.NET MVC3快速入门——第四节、添加一个模型
在本节中我们将追加一些类来管理数据库中的电影.这些类将成为我们的MVC应用程序中的“模型”部分.我们将使用一个.NET Framework的被称之为“Entiry Framework”的数据访问技术来 ...
- Linux 下的下载文件命令
普通文件只需 wget fileAddr 下载带有登录验证的文件 [chen@localhost Downloads]$ wget --user='av\bname' --ask-password ...
- C# 判断两个日期是否是同一天
System.Data.Entity.DbFunctions.DiffDays(cs.StartTime.Value,DateTime.Now) == 0//只获取当天 OR XX.StartTime ...
- CF 578A A Problem about Polyline
题意: There is a polyline going through points (0, 0) – (x, x) – (2x, 0) – (3x, x) – (4x, 0) – ... - ( ...
- bzoj2049-洞穴勘测(动态树lct模板题)
Description 辉辉热衷于洞穴勘测.某天,他按照地图来到了一片被标记为JSZX的洞穴群地区.经过初步勘测,辉辉发现这片区域由n个洞穴(分别编号为1到n)以及若干通道组成,并且每条通道连接了恰好 ...
- QQ聊天界面的布局和设计(IOS篇)-第二季
QQChat Layout - 第二季 本来第二季是快写好了, 也花了点功夫, 结果gitbook出了点问题, 给没掉了.有些细节可能会一带而过, 如有疑问, 相互交流进步~. 在第一季中我们完成了Q ...
- apacheOfbiz
一.ofbiz 用自身数据库安装 1. 由 binary 安装: 由 binary 安装非常简单, 以下是安装方法: 下载ofbiz-2.0-beta1-complete.tar.gz, 注意不是of ...
- hdu 5256 序列变换(LIS最长上升子序列)
Problem Description 我们有一个数列A1,A2...An,你现在要求修改数量最少的元素,使得这个数列严格递增.其中无论是修改前还是修改后,每个元素都必须是整数. 请输出最少需要修改多 ...
- python高级编程之选择好名称:完2
# -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #分解代码 #小就是美,这也适用所有级别的代码,当一个函数,类或者一 ...
- Git的一些用法(建立新的branch)
建立新的branch和查看全部的branch(kk的代码是基于现有的branch) 切换到branch kk: 当然我们也能够在android studio里操作: 注意切换的时候代码会丢失,必须先c ...