designer/thermometer_plugin.cpp

changeset 316
dcd472be9ae8
equal deleted inserted replaced
315:cf4e83cecdb5 316:dcd472be9ae8
1 /***************************************************************************
2 * Copyright (C) 2006-2008 by Tomasz Ziobrowski *
3 * http://www.3electrons.com *
4 * e-mail: t.ziobrowski@3electrons.com *
5 * *
6 * Adapted for the bmsapp project by Michiel Broek, 2022. *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23
24 #include <QObject>
25 #include <QtUiPlugin/QDesignerCustomWidgetInterface>
26 #include <QString>
27 #include <QWidget>
28 #include <QIcon>
29 #include <QtPlugin>
30
31 #include "analog/thermometer.h"
32 #include "thermometer_plugin.h"
33
34 /*------------------------------------------------------------------------------------------------
35 * THERMOMETER
36 *------------------------------------------------------------------------------------------------*/
37
38
39 ThermoMeterPlugin::ThermoMeterPlugin(QObject *parent)
40 : QObject(parent)
41 {
42 }
43
44 void ThermoMeterPlugin::initialize(QDesignerFormEditorInterface * /*core*/)
45 {
46 if (initialized)
47 return;
48
49 initialized = true;
50 }
51
52 bool ThermoMeterPlugin::isInitialized() const
53 {
54 return initialized;
55 }
56
57 QWidget *ThermoMeterPlugin::createWidget(QWidget *parent)
58 {
59 return new ThermoMeter(parent);
60 }
61
62 QString ThermoMeterPlugin::name() const
63 {
64 return "ThermoMeter";
65 }
66
67 QString ThermoMeterPlugin::group() const
68 {
69 return "BMSapp Widgets";
70 }
71
72 QIcon ThermoMeterPlugin::icon() const
73 {
74 return QIcon();
75 }
76
77 QString ThermoMeterPlugin::toolTip() const
78 {
79 return QString();
80 }
81
82 QString ThermoMeterPlugin::whatsThis() const
83 {
84 return QString();
85 }
86
87 bool ThermoMeterPlugin::isContainer() const
88 {
89 return false;
90 }
91
92 QString ThermoMeterPlugin::domXml() const
93 {
94 return "<ui language=\"c++\">\n"
95 " <widget class=\"ThermoMeter\" name=\"thermometer\">\n"
96 " <property name=\"geometry\">\n"
97 " <rect>\n"
98 " <x>0</x>\n"
99 " <y>0</y>\n"
100 " <width>40</width>\n"
101 " <height>160</height>\n"
102 " </rect>\n"
103 " </property>\n"
104 " <property name=\"toolTip\" >\n"
105 " <string>Shows the temperature</string>\n"
106 " </property>\n"
107 " <property name=\"whatsThis\" >\n"
108 " <string>The bar meter widget displays "
109 "the temperature attached to it</string>\n"
110 " </property>\n"
111 " </widget>\n"
112 "</ui>\n";
113 }
114
115 QString ThermoMeterPlugin::includeFile() const
116 {
117 return "analog/thermometer.h";
118 }
119

mercurial