| 224 | } |
| 225 | |
| 226 | void LabelWidget::setLabels(QList<TextLabel*> labels) { |
| 227 | m_labelsList = labels; |
| 228 | m_axesList.clear(); |
| 229 | m_label = labels.first(); |
| 230 | setAspects(labels); |
| 231 | |
| 232 | ui.lOffsetX->hide(); |
| 233 | ui.lOffsetY->hide(); |
| 234 | |
| 235 | ui.sbOffsetX->hide(); |
| 236 | ui.sbOffsetY->hide(); |
| 237 | |
| 238 | // show the text fields for name and comment if the label is not hidden (i.e. not a plot title, etc.) |
| 239 | bool visible = !m_label->isHidden(); |
| 240 | ui.lName->setVisible(visible); |
| 241 | ui.leName->setVisible(visible); |
| 242 | ui.lComment->setVisible(visible); |
| 243 | ui.teComment->setVisible(visible); |
| 244 | |
| 245 | this->load(); |
| 246 | initConnections(); |
| 247 | updateBackground(); |
| 248 | |
| 249 | // hide the option "Visible" if the label is child of a InfoElement, |
| 250 | // the label is what the user identifies with the info element itself |
| 251 | visible = (m_label->parentAspect()->type() != AspectType::InfoElement); |
| 252 | ui.chbVisible->setVisible(visible); |
| 253 | |
| 254 | // resize the widget to take the minimal height |
| 255 | layout()->activate(); |
| 256 | const auto s = QSize(this->width(), 0).expandedTo(minimumSize()); |
| 257 | if (s.height() > 0) |
| 258 | resize(s); |
| 259 | } |
| 260 | |
| 261 | void LabelWidget::setAxes(QList<Axis*> axes) { |
| 262 | m_labelsList.clear(); |