把自定义控件集成到Qt Designer中

- #include <QDesignerCustomWidgetInterface>
- class IconEditorPlugin : public QObject, public QDesignerCustomWidgetInterface
- {
- Q_OBJECT
- Q_INTERFACES(QDesignerCustomWidgetInterface)
- public:
- IconEditorPlugin(QObject *parent = 0);
- QString name() const;
- QString includeFile() const;
- QString group() const;
- QIcon icon() const;
- QString toolTip() const;
- QString whatsThis() const;
- bool isContainer() const;
- QWidget *createWidget(QWidget *parent);
- };
- IconEditorPlugin::IconEditorPlugin(QObject *parent)
- : QObject(parent)
- {
- }
- QString IconEditorPlugin::name() const
- {
- return "IconEditor";
- }
- QString IconEditorPlugin::includeFile() const
- {
- return "iconeditor.h";
- }
- QString IconEditorPlugin::group() const
- {
- return tr("Image Manipulation Widgets");
- }
- QIcon IconEditorPlugin::icon() const
- {
- return QIcon(":/images/iconeditor.png");
- }
- QString IconEditorPlugin::toolTip() const
- {
- return tr("An icon editor widget");
- }
- QString IconEditorPlugin::whatsThis() const
- {
- return tr("This widget is presented in Chapter 5 of <i>C++ GUI "
- "Programming with Qt 4</i> as an example of a custom Qt "
- "widget.");
- }
- bool IconEditorPlugin::isContainer() const
- {
- return false;
- }
- QWidget *IconEditorPlugin::createWidget(QWidget *parent)
- {
- return new IconEditor(parent);
- }
- Q_EXPORT_PLUGIN2(iconeditorplugin, IconEditorPlugin)
如果想在Qt Designer集成多个自定义控件,你可以为每个控件创建一个的插件,也可以把所有控件组合到一个插件中,从QDesignerCustomWidgetCollectionInterface派生。
把自定义控件集成到Qt Designer中的更多相关文章
- 自定义的插件如何加载到Qt Designer中(详细)
要想在Qt Designer中使用自定义控件,必须要使Qt Designer能够知道我们的自定义控件的存在.有两种方法可以把新自定义控件的信息通知给Qt Designer:“升级(promotion) ...
- 无法启动 Maya 集成的 qt designer 的解决方法和原因 以及 中英文切换
无法启动 Maya 集成的 qt designer 的解决方法和原因 以及 中英文切换 前言: Maya 集成了 PySide,同时集成了qt designer,在 Maya 的安装目录下的 bin ...
- VS2008 Qt Designer 中自定义信号槽
一.Qt Designer自定义槽函数 发现:在VS2008 +Qt4.7 中打开ui文件,所用的英文QT Designer工具,没有转到槽函数的功能,不如QtCreator自带的QtDesigne ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的autoFillBackground属性
autoFillBackground属性可以确认部件背景是否自动填充,如果自动填充,Qt会在调用Paint事件之前填充部件的背景.使用的颜色由部件调色板中的QPalette.window 角色定义(关 ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的样式表styleSheet属性
styleSheet属性是定义部件外观的属性样式表,在Qt中styleSheet样式表是类似于html的css样式一样的方法,只是时专门为Qt中的部件开发的.styleSheet的定义语法也是类似CS ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的layoutDirection属性
layoutDirection属性保存的是部件的布局方向,有三个取值: 在部件上设置布局方向时,它将传播到部件的子级,但不会传播到作为窗口的子级,也不会传播到已显式调用setLayoutDirecti ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的accessibleDescription和accessibleName辅助阅读属性
accessibleDescription和accessibleName属性都是用于残疾人辅助阅读的,这两个属性都有国际化属性(关于国际化请参考<PyQt(Python+Qt)学习随笔:Qt D ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的toolTip、toolTipDuration、statusTip、whatsThis属性
toolTip属性 toolTip属性设置部件的toolTip提示信息,toolTip提示信息在鼠标放到控件上会浮动出一个小框显示提示信息.默认情况下,仅显示活动窗口子部件的toolTip,可以通过在 ...
- PyQt(Python+Qt)学习随笔:Qt Designer中部件的是否接受鼠标拖放事件的acceptDrops属性及含义
acceptDrops属性表示当前部件是否接受鼠标拖放事件,鼠标拖放应该是与鼠标拖拽结合在一起的,在Qt Designer中可以通过属性acceptDrops设置部件是否接受鼠标拖放事件.如果部件接受 ...
随机推荐
- instancetype和id的区别
一.什么是instancetype instancetype是clang 3.5开始,clang提供的一个关键字,表示某个方法返回的未知类型的Objective-C对象.我们都知道未知类型的的对象可以 ...
- mysql死锁——mysql之四
1.MySQL常用存储引擎的锁机制 MyISAM和MEMORY采用表级锁(table-level locking) BDB采用页面锁(page-level locking)或表级锁,默认为页面锁 In ...
- Linux用户与用户组,UID及GID
以下列出文章: Linux系统下如果查看用户的UID和GID:http://blog.csdn.net/ahangliu/article/details/7567444 Linux的用户和用户组管理: ...
- css案例学习之span边框实现的特殊效果
bottom left bottom right top left top right 配合颜色来使用,实现一些神奇的效果 #menu a span{ height:; width:; /*borde ...
- java使用poi创建excel文件
import org.apache.poi.hssf.usermodel.HSSFCell;import org.apache.poi.hssf.usermodel.HSSFRow;import or ...
- [转]UltraISO制作U盘启动盘安装Win7/9/10系统攻略
原文地址:http://www.cnblogs.com/pchmonster/p/4716708.html U盘安装好处就是不用使用笨拙的光盘,光盘还容易出现问题,无法读取的问题.U盘体积小,携带方便 ...
- 2.x ESL第二章习题 2.8
题目 代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3 ...
- python3 时间和日期
Python程序可以通过多种方式来处理日期和时间.日期格式之间的转换是计算机的一个共同核心.Python的时间和日历模块能够帮助我们跟踪的日期和时间. 什么是刻度? 时间间隔以秒为单位的浮点数.特别是 ...
- Timer和TimerTask
目录结构: Timer和TimerTask 一个Timer调度的例子 如何终止Timer线程 关于cancle方式终止线程 反复执行一个任务 schedule VS. scheduleAtFixedR ...
- hdu 3954 Level up(线段树)
题目链接:hdu 3954 Level up 题目大意:N个英雄,M个等级,初始等级为1,给定每一个等级须要的经验值,Q次操作,操作分两种,W l r x:表示l~r之间的英雄每一个人杀了x个怪物:Q ...