I used cpp to build a custom floating layout class in Qt.
- Qt 5.12.1
- MinGW 7.3.0 64-bit(Windows10)
#include "customdevice.h" // 自定义设备部件
#include "floatlayout.h" // 自定义浮动布局 CustomDevice * customDevice = new CustomDevice(); // 默认只是一个按钮
CustomDevice * customDevice_1 = new CustomDevice("SmartLogger2000", ":/images/icon.jpg", "正常");
// 第一个参数设备名称,第二个参数是图标图片地址,第三个参数是设备状态 QList<CustomDevice *> customDeviceList;
customDeviceList << new CustomDevice();
FloatLayout * floatLayout = new FloatLayout(customDeviceList, this); floatLayout->setTotalValue(18); // 设置浮动布局中的子部件数量为18 customDeviceList[9]->setCustomDeviceContent("0001", ":/images/icon.jpg", "离线");
// 设置/修改第10个自定义设备部件的内容