1. 程式人生 > >Qt之自定義外掛(for Qt Designer)

Qt之自定義外掛(for Qt Designer)

QLedPlugin::QLedPlugin(QObject *parent) : QObject(parent) { initialized = false; } void QLedPlugin::initialize(QDesignerFormEditorInterface * ) { if (initialized) return; initialized = true; } bool QLedPlugin::isInitialized() const { return initialized; } QWidget *QLedPlugin::createWidget(QWidget *parent) { return new QLed(parent); } QString QLedPlugin::name() const { return "QLed"; } QString QLedPlugin::group() const { return "Led Widgets"; } QIcon QLedPlugin::icon() const { return QIcon(":resources/qled.png"); } QString QLedPlugin::toolTip() const { return tr("Led Custom widget Plugin fot Qt Designer"); } QString QLedPlugin::whatsThis() const { return tr("Led Custom widget Plugin fot Qt Designer"); } bool QLedPlugin::isContainer() const { return false; } QString QLedPlugin::domXml() const { return "\n" " \n" " \n" " 0\n" " 0\n" " 50\n" " 50\n" " \n" " \n" " \n" " Binary Led\n" " \n" " \n" " false\n" " \n" " \n" " Led widget\n" " \n" " \n" " QLed::Red\n" " \n" " \n" " QLed::Grey\n" " \n" " \n" " QLed::Circle\n" " \n" "\n"; } QString QLedPlugin::includeFile() const { return "qled.h"; }