Sizing fixes
This commit is contained in:
parent
a36386cc20
commit
c94f5144e7
4 changed files with 20 additions and 11 deletions
|
|
@ -27,22 +27,26 @@ public:
|
|||
void setup1() {
|
||||
mRootWidget.setRootWidget(&mDockLayout);
|
||||
|
||||
mDockLayout.addChild(&mFloatingMenu);
|
||||
mDockLayout.addChild(&mFloatingMenu2);
|
||||
mDockLayout.addChild(&mFloatingMenu);
|
||||
|
||||
mDockLayout.setCenterWidget(&mButton4);
|
||||
mDockLayout.dockWidget(&mButton3, DockLayoutWidget::RIGHT);
|
||||
mDockLayout.setCenterWidget(&mButton5);
|
||||
mDockLayout.dockWidget(&mButton6, DockLayoutWidget::RIGHT);
|
||||
|
||||
mFloatingMenu.addToMenu(&mButton);
|
||||
mFloatingMenu2.addToMenu(&mButton2);
|
||||
//mFloatingMenu2.addToMenu(&mFloatingMenu);
|
||||
mFloatingMenu2.addToMenu(&mButton3);
|
||||
mFloatingMenu2.addToMenu(&mButton4);
|
||||
|
||||
mButton.setAction([this]() { mButton2.setColor(RGBA::random()); });
|
||||
mButton2.setAction([this]() { mButton.setColor(RGBA::random()); });
|
||||
|
||||
mButton3.setAction([this]() { mDockLayout.dockWidget(&mFloatingMenu, DockLayoutWidget::Side::LEFT); });
|
||||
mButton3.setText("dock");
|
||||
mButton5.setAction([this]() { mDockLayout.dockWidget(&mFloatingMenu, DockLayoutWidget::Side::LEFT); });
|
||||
mButton6.setAction([this]() { mDockLayout.undockWidget(DockLayoutWidget::Side::LEFT); });
|
||||
|
||||
mButton4.setAction([this]() { mDockLayout.undockWidget(DockLayoutWidget::Side::LEFT); });
|
||||
mButton5.setText("dock");
|
||||
mButton6.setText("undock");
|
||||
|
||||
// mLayoutWidget.addChild(&mButton2);
|
||||
|
||||
|
|
@ -53,8 +57,8 @@ public:
|
|||
// mAnimationTestWidget.addChild(&mWidgetFloating);
|
||||
// mAnimationTestWidget.addChild(&mLayoutWidget);
|
||||
|
||||
RootWidget::setWidgetArea(mFloatingMenu2, { 300, 100, 150, 200 });
|
||||
RootWidget::setWidgetArea(mFloatingMenu, { 100, 100, 150, 200 });
|
||||
RootWidget::setWidgetArea(mFloatingMenu2, { 300, 100, 150, 500 });
|
||||
RootWidget::setWidgetArea(mFloatingMenu, { 100, 100, 150, 300 });
|
||||
|
||||
// mWidgetFloating.addChild(&mLayoutWidget);
|
||||
|
||||
|
|
@ -120,6 +124,8 @@ private:
|
|||
ButtonWidget mButton2;
|
||||
ButtonWidget mButton3;
|
||||
ButtonWidget mButton4;
|
||||
ButtonWidget mButton5;
|
||||
ButtonWidget mButton6;
|
||||
|
||||
FloatingWidget mFloatingWidget;
|
||||
FloatingMenu mFloatingMenu;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ void RootWidget::processFrame(EventHandler* events, const RectF& screenArea) {
|
|||
|
||||
if (mDebug) {
|
||||
mScreenArea.size -= { 400, 0 };
|
||||
events->setEnableKeyEvents(true);
|
||||
if (events->isPressed(InputID::K)) mDebugStopProcessing = !mDebugStopProcessing;
|
||||
if (mDebugStopProcessing) return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,6 +209,10 @@ void Widget::adjustLayout(bool vertical) {
|
|||
Vec2F availableSize = getRelativeAreaT().size;
|
||||
|
||||
for (auto child : mChildren) {
|
||||
if (child->mSizePolicy[!vertical] != SizePolicy::Minimal) {
|
||||
child->pickRect();
|
||||
}
|
||||
|
||||
if (child->mSizePolicy[vertical] == SizePolicy::Expanding) {
|
||||
contributors.emplace_back( child, true );
|
||||
|
||||
|
|
@ -217,8 +221,6 @@ void Widget::adjustLayout(bool vertical) {
|
|||
child->setAreaCache(area);
|
||||
child->clampRect();
|
||||
|
||||
} else {
|
||||
// child->triggerWidgetUpdate("expand child in layout");
|
||||
}
|
||||
contentSize += child->getAreaCache().size;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace tp {
|
|||
FloatingWidget() {
|
||||
setDebug("float", { 0.0, 0.9, 0.1, 1 });
|
||||
|
||||
// mSizePolicy = { SizePolicy::Contract, SizePolicy::Contract };
|
||||
mSizePolicy = { SizePolicy::Fixed, SizePolicy::Fixed };
|
||||
mLayoutPolicy = LayoutPolicy::Horizontally;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue