|
| 1 | +/** |
| 2 | + * @file examplewidget.cpp |
| 3 | + * @brief 示例窗口实现文件 |
| 4 | + * @author howdy213 |
| 5 | + * @date 2025-07-11 |
| 6 | + * @version 1.0.0 |
| 7 | + * |
| 8 | + * Copyright 2025 howdy213 |
| 9 | + * |
| 10 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 11 | + * you may not use this file except in compliance with the License. |
| 12 | + * You may obtain a copy of the License at |
| 13 | + * |
| 14 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 15 | + * |
| 16 | + * Unless required by applicable law or agreed to in writing, software |
| 17 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | + * See the License for the specific language governing permissions and |
| 20 | + * limitations under the License. |
| 21 | + */ |
| 22 | +#include"examplewidget.h" |
| 23 | +#include"exampledialog.h" |
| 24 | +#include"../WidgetExplorerSDK/we.h" |
| 25 | +#include"../WidgetExplorerSDK/wfile.h" |
| 26 | +#include"../WidgetExplorerSDK/WPlugin/wplugin.h" |
| 27 | +#include"../WidgetExplorerSDK/WPlugin/wwidgetmanager.h" |
| 28 | + |
| 29 | +#include<QWidget> |
| 30 | +#include<windows.h> |
| 31 | + |
| 32 | +ExampleWidget::ExampleWidget(WEBase* parent){ |
| 33 | + Q_UNUSED(parent) |
| 34 | + |
| 35 | +} |
| 36 | +ExampleWidget::~ExampleWidget(){ |
| 37 | + |
| 38 | +} |
| 39 | +void ExampleWidget::receiveMessage(WMetaData &msg){ |
| 40 | + if(msg.map[W_DATA_COMMAND]=="start"){ |
| 41 | + if(widget.isHidden())widget.show(); |
| 42 | + else widget.activateWindow(); |
| 43 | + } |
| 44 | + widget.appCommand((QString) |
| 45 | + "\n--"+qvariant_cast<QString>(PPlugin->getMetaData(W_PLUGIN_ATTR_NAME)) |
| 46 | + +"@"+qvariant_cast<QString>(PPlugin->getMetaData(W_PLUGIN_ATTR_PATH)) |
| 47 | + +"--\nfrom:"+msg.from |
| 48 | + +"\ndest:"+msg.dest |
| 49 | + +"\nmsg:\n"); |
| 50 | + widget.appCommand(msg.map); |
| 51 | + if(msg.map[W_DATA_COMMAND]=="clear"){ |
| 52 | + widget.setCommand(data); |
| 53 | + if(widget.isHidden())widget.show(); |
| 54 | + else widget.activateWindow(); |
| 55 | + } |
| 56 | +} |
| 57 | +void ExampleWidget::initWidget(){ |
| 58 | + this->setAttr(WNAME,"ExampleWidget"); |
| 59 | +} |
0 commit comments