MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / addCustomInfo

Method addCustomInfo

gui/src/widgets/plotinfo.cpp:45–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43PlotInfo::~PlotInfo() {}
44
45void PlotInfo::addCustomInfo(QWidget *info, InfoPosition hpos, InfoPosition vpos)
46{
47 QVBoxLayout *targetLayout = nullptr;
48 QWidget *targetParent = nullptr;
49 bool alignRight = (hpos == IP_RIGHT);
50
51 if(vpos == IP_BOTTOM) {
52 if(hpos == IP_LEFT) {
53 targetLayout = m_bottomLeftLayout;
54 targetParent = m_bottomLeftInfo;
55 } else {
56 targetLayout = m_bottomRightLayout;
57 targetParent = m_bottomRightInfo;
58 }
59 targetLayout->insertWidget(0, info, 0, alignRight ? Qt::AlignRight : Qt::Alignment());
60 } else {
61 if(hpos == IP_LEFT) {
62 targetLayout = m_leftLayout;
63 targetParent = m_leftInfo;
64 } else {
65 targetLayout = m_rightLayout;
66 targetParent = m_rightInfo;
67 }
68 targetLayout->addWidget(info, 0, alignRight ? Qt::AlignRight : Qt::Alignment());
69 }
70
71 info->setParent(targetParent);
72
73 if(alignRight) {
74 QLabel *labelInfo = dynamic_cast<QLabel *>(info);
75 if(labelInfo) {
76 labelInfo->setAlignment(Qt::AlignRight);
77 labelInfo->setAttribute(Qt::WA_TransparentForMouseEvents);
78 }
79 }
80
81 info->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
82}
83
84QLabel *PlotInfo::addLabelInfo(InfoPosition hpos, InfoPosition vpos)
85{

Callers 5

FFTPlotComponentMethod · 0.80
TimePlotComponentMethod · 0.80
setupToolTemplateMethod · 0.80
setupPlotInfoMethod · 0.80
setupPlotInfoMethod · 0.80

Calls 2

setParentMethod · 0.80
addWidgetMethod · 0.45

Tested by

no test coverage detected