Exemple #1
0
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);
}
Exemple #2
0
WLayout::~WLayout()
{
  if (!parentLayout())
    setParent(0);

  delete impl_;
  delete hints_;
  delete[] margins_;
}
Exemple #3
0
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);
        }
    }
}
Exemple #4
0
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;
}
Exemple #5
0
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);
}
Exemple #6
0
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;
}
Exemple #7
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 ;
                }
            }
        }
    }
}
Exemple #8
0
//! Maximizes \b this TDockWidget, if docked.
void TDockWidget::setMaximized(bool status) {
  parentLayout()->setMaximized(this, status);
}
Exemple #9
0
//! 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);
  }
}