void TPanel::onCloseButtonPressed() { emit closeButtonPressed(); // Currently, Toonz panels that get closed indeed just remain hidden - // ready to reappair if they are needed again. However, the user expects // a new panel to be created - so we just reset the panel here. // reset(); //Moved to panel invocation in floatingpanelcommand.cpp // Also, remove widget from its dock layout control if (parentLayout()) parentLayout()->removeWidget(this); }
WLayout::~WLayout() { if (!parentLayout()) setParent(0); delete impl_; delete hints_; delete[] margins_; }
void KWidget::setAlignment( Qt::Alignment align ) { QGraphicsLayout *tmpLayout = (QGraphicsLayout*)(parentLayout()); if(tmpLayout == NULL) return ; LayoutType type = parentLayoutType(); if(type == VBox || type == HBox) { QGraphicsLinearLayout *boxLayout = dynamic_cast<QGraphicsLinearLayout*>(tmpLayout); if(boxLayout) { boxLayout->setAlignment(this, align); } } }
Qt::Alignment KWidget::alignment() { QGraphicsLayout *tmpLayout = (QGraphicsLayout*)(parentLayout()); if(tmpLayout == NULL) return Qt::AlignLeft; if(d_func()->layoutType == VBox || d_func()->layoutType == HBox) { QGraphicsLinearLayout *boxLayout = dynamic_cast<QGraphicsLinearLayout*>(tmpLayout); if(boxLayout) { return boxLayout->alignment(this); } } return Qt::AlignLeft; }
void TDockWidget::selectDockPlaceholder(QMouseEvent *me) { if (m_placeholders.size() && m_placeholders[0]->isRoot()) { DockPlaceholder *selected = 0; QPoint pos = parentWidget()->mapFromGlobal(me->globalPos()); if (parentLayout()->contentsRect().contains(pos)) selected = m_placeholders[0]; if (m_selectedPlace != selected) { if (m_selectedPlace) m_selectedPlace->hide(); if (selected) selected->show(); } m_selectedPlace = selected; } else DockWidget::selectDockPlaceholder(me); }
int KWidget::itemSpacing() { QGraphicsLayout *layout = parentLayout(); if(d_func()->layoutType == VBox || d_func()->layoutType == HBox) { QGraphicsLinearLayout *boxLayout = dynamic_cast<QGraphicsLinearLayout*>(layout); if(boxLayout) { QGraphicsLayoutItem *item = dynamic_cast<QGraphicsLayoutItem*>(this); for(int i = 0; i < boxLayout->count(); i++) { if(boxLayout->itemAt(i) == item) { return boxLayout->itemSpacing(i); } } } } return 0; }
void KWidget::setItemSpacing( int space ) { QGraphicsLayout *layout = parentLayout(); LayoutType type = parentLayoutType(); if(type == VBox || type == HBox) { QGraphicsLinearLayout *boxLayout = dynamic_cast<QGraphicsLinearLayout*>(layout); if(boxLayout) { QGraphicsLayoutItem *item = dynamic_cast<QGraphicsLayoutItem*>(this); for(int i = 0; i < boxLayout->count(); i++) { if(boxLayout->itemAt(i) == item) { boxLayout->setItemSpacing(i, space); return ; } } } } }
//! Maximizes \b this TDockWidget, if docked. void TDockWidget::setMaximized(bool status) { parentLayout()->setMaximized(this, status); }
//! Currently working only for \b status = true. If you need to //! dock a TDockWidget, you \b must specify a dock location by either //! choosing a placeholder or identifying the Region and insertion index, //! and then running 'parentLayout()->dockItem(..)'. void TDockWidget::setFloating(bool status) { if (status) { setWindowFlags(Qt::Tool | Qt::FramelessWindowHint); if (!m_floating) parentLayout()->undockItem(this); } }