| 329 | } |
| 330 | |
| 331 | void LabelWidget::initConnections() { |
| 332 | while (!m_connections.isEmpty()) |
| 333 | disconnect(m_connections.takeFirst()); |
| 334 | m_connections << connect(m_label, &TextLabel::textWrapperChanged, this, &LabelWidget::labelTextWrapperChanged); |
| 335 | m_connections << connect(m_label, &TextLabel::teXImageUpdated, this, &LabelWidget::labelTeXImageUpdated); |
| 336 | m_connections << connect(m_label, &TextLabel::teXFontChanged, this, &LabelWidget::labelTeXFontChanged); |
| 337 | m_connections << connect(m_label, &TextLabel::fontColorChanged, this, &LabelWidget::labelFontColorChanged); |
| 338 | m_connections << connect(m_label, &TextLabel::backgroundColorChanged, this, &LabelWidget::labelBackgroundColorChanged); |
| 339 | m_connections << connect(m_label, &TextLabel::positionChanged, this, &LabelWidget::labelPositionChanged); |
| 340 | |
| 341 | m_connections << connect(m_label, &TextLabel::positionLogicalChanged, this, &LabelWidget::labelPositionLogicalChanged); |
| 342 | m_connections << connect(m_label, &TextLabel::coordinateBindingEnabledChanged, this, &LabelWidget::labelCoordinateBindingEnabledChanged); |
| 343 | m_connections << connect(m_label, &TextLabel::horizontalAlignmentChanged, this, &LabelWidget::labelHorizontalAlignmentChanged); |
| 344 | m_connections << connect(m_label, &TextLabel::verticalAlignmentChanged, this, &LabelWidget::labelVerticalAlignmentChanged); |
| 345 | m_connections << connect(m_label, &TextLabel::rotationAngleChanged, this, &LabelWidget::labelRotationAngleChanged); |
| 346 | m_connections << connect(m_label, &TextLabel::borderShapeChanged, this, &LabelWidget::labelBorderShapeChanged); |
| 347 | m_connections << connect(m_label, &TextLabel::lockChanged, this, &LabelWidget::labelLockChanged); |
| 348 | |
| 349 | if (!m_label->parentAspect()) { |
| 350 | QDEBUG(Q_FUNC_INFO << ", LABEL " << m_label << " HAS NO PARENT!") |
| 351 | return; |
| 352 | } |
| 353 | |
| 354 | const auto type = m_label->parentAspect()->type(); |
| 355 | if (type == AspectType::Worksheet) { |
| 356 | auto* worksheet = static_cast<const Worksheet*>(m_label->parentAspect()); |
| 357 | connect(worksheet->background(), &Background::firstColorChanged, this, &LabelWidget::updateBackground); |
| 358 | } else if (type == AspectType::CartesianPlot) { |
| 359 | auto* plotArea = static_cast<CartesianPlot*>(m_label->parentAspect())->plotArea(); |
| 360 | connect(plotArea->background(), &Background::firstColorChanged, this, &LabelWidget::updateBackground); |
| 361 | } else if (type == AspectType::CartesianPlotLegend) { |
| 362 | auto* legend = static_cast<const CartesianPlotLegend*>(m_label->parentAspect()); |
| 363 | connect(legend->background(), &Background::firstColorChanged, this, &LabelWidget::updateBackground); |
| 364 | } else if (type == AspectType::InfoElement || type == AspectType::Axis) { |
| 365 | auto* plotArea = static_cast<CartesianPlot*>(m_label->parentAspect()->parentAspect())->plotArea(); |
| 366 | connect(plotArea->background(), &Background::firstColorChanged, this, &LabelWidget::updateBackground); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | /*! |
| 371 | * enables/disables the "fixed label"-mode, used when displaying |
nothing calls this directly
no test coverage detected