void KDockSplitter::activate(QWidget *c0, QWidget *c1) { if ( c0 ) child0 = c0; if ( c1 ) child1 = c1; setupMinMaxSize(); if (divider) delete divider; divider = new QFrame(this, "pannerdivider"); divider->setFrameStyle(QFrame::Panel | QFrame::Raised); divider->setLineWidth(1); divider->raise(); if (orientation == Horizontal) divider->setCursor(QCursor(sizeVerCursor)); else divider->setCursor(QCursor(sizeHorCursor)); divider->installEventFilter(this); initialised= true; updateName(); divider->show(); resizeEvent(0); }
void KDockSplitter::activate(QWidget *c0, QWidget *c1) { if(c0) child0 = c0; if(c1) child1 = c1; setupMinMaxSize(); if(divider) delete divider; divider = new QFrame(this, "pannerdivider"); divider->setFrameStyle(QFrame::Panel | QFrame::Raised); divider->setLineWidth(1); divider->raise(); if(m_orientation == Horizontal) divider->setCursor(QCursor(sizeVerCursor)); else divider->setCursor(QCursor(sizeHorCursor)); divider->installEventFilter(this); initialised = true; updateName(); divider->show(); // without this resize event, things will not work. why exactly? :( resizeEvent(0); KDockWidget *dw0 = (KDockWidget *)child0; KDockWidget *dw1 = (KDockWidget *)child1; // if fixed size is set, restore first, to restore xpos correctly if(fixedWidth0 != -1 || fixedHeight0 != -1) restoreFromForcedFixedSize(dw0); if(fixedWidth1 != -1 || fixedHeight1 != -1) restoreFromForcedFixedSize(dw1); // now force fixed sizes, if they are set. if(dw0->forcedFixedWidth() != -1) { setForcedFixedWidth(dw0, dw0->forcedFixedWidth()); } else if(dw1->forcedFixedWidth() != -1) { setForcedFixedWidth(dw1, dw1->forcedFixedWidth()); } if(dw0->forcedFixedHeight() != -1) { setForcedFixedHeight(dw0, dw0->forcedFixedHeight()); } else if(dw1->forcedFixedHeight() != -1) { setForcedFixedHeight(dw1, dw1->forcedFixedHeight()); } }
void KDockSplitter::setForcedFixedHeight(KDockWidget *dw, int h) { if(dw == child0) { if(fixedHeight0 == -1) savedXPos = xpos; if(h == fixedHeight0) return; fixedHeight0 = h; setSeparatorPos(h * factor / height(), true); // // kdDebug(282)<<"Set forced fixed width for widget 0 :"<<h<<endl; } else { if(fixedHeight1 == -1) savedXPos = xpos; if(h == fixedHeight1) return; fixedHeight1 = h; setSeparatorPos((height() - h) * factor / height(), true); // kdDebug(282)<<"Set forced fixed height for widget 1 :"<<h<<endl; } setupMinMaxSize(); if(divider) divider->hide(); }
void KDockSplitter::setForcedFixedWidth(KDockWidget *dw, int w) { if(dw == child0) { if(fixedWidth0 == -1) savedXPos = xpos; if(w == fixedWidth0) return; fixedWidth0 = w; setSeparatorPos(w * factor / width(), true); // kdDebug(282)<<"Set forced fixed width for widget 0 :"<<w<<endl; } else { if(fixedWidth1 == -1) savedXPos = xpos; if(w == fixedWidth1) return; fixedWidth1 = w; setSeparatorPos((width() - w) * factor / width(), true); // kdDebug(282)<<"Set forced fixed width for widget 1 :"<<w<<endl; } setupMinMaxSize(); if(divider) divider->hide(); }
bool KDockSplitter::event( QEvent* e ) { if ( e->type() == QEvent::LayoutHint ){ // change children min/max size setupMinMaxSize(); setSeparatorPos(xpos); } return QWidget::event(e); }
bool K3DockSplitter::event( QEvent* e ) { if ( e->type() == QEvent::LayoutHint ){ // change children min/max size. This is needed, otherwise // it is possible the divider get's out of bounds. setupMinMaxSize(); resizeEvent(0); } return QWidget::event(e); }