| 43 | PlotInfo::~PlotInfo() {} |
| 44 | |
| 45 | void 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 | |
| 84 | QLabel *PlotInfo::addLabelInfo(InfoPosition hpos, InfoPosition vpos) |
| 85 | { |
no test coverage detected