Comments (2)
I don't have a better answer than those workarounds, the use case is a bit exotic.
If you have access to DockWidget_p.h you can change d->affinities yourself, if you are aware of possible edge cases (I listed a few).
I'm tempted to allow changing affinities if the dock widget is currently closed.
from kddockwidgets.
Actually, my first idea cannot work. I cannot make the LayoutSaver
save the layout of a dockwidget with unique-name "A" and restore it on another dockwidget with unique-name "B". Changing the affinites doesn't help here, forget this idea.
So currently, I have only the second idea, where I replace the unique names (and affinities) within the serialized layout.
This works, I tested it.
But I really don't like to rely on the fact, that I can get the layout in plain-text and find and replace unique names therein.
Generally speaking, the layout is transferred from one set of dockwidgets to another set of dockwidgets, simply using a mapping between the unique names.
The mapping can be applied on the serialized plain-text layout, as already said, but it could also be done right before serialization and restoration.
In any case, the responsibility that there are no conflicts etc. would lie on the user.
I think this could be a feature of the LayoutSaver
. It would be a single function which sets a mapping. And if a mapping is set, right after serialization or right before restoration, the unique-names of all dock-widgets and main-windows in LayoutSaver::Layout
would then be changed.
layout_saver = LayoutSaver()
# Generalize the layout; Could also use this final names if they are known at this point of time
layout_saver.use_mapping( { "MW_0" : "MW_x",
"DW_0_A": "DW_x_A",
"DW_0_B": "DW_x_B" } )
generalized_layout = layout_saver.serializeLayout()
...
layout_saver = LayoutSaver()
layout_saver.use_mapping( { "MW_x" : "MW_1",
"DW_x_A": "DW_1_A",
"DW_x_B": "DW_1_B" } )
layout = layout_saver.restoreLayout(generalized_layout)
This would need to be extended, to have one mapping for the unique-names and one for the affinities.
from kddockwidgets.
Related Issues (20)
- Qt Quick: crash when `delete`-ing a toplevel dockwidget HOT 1
- Qt Quick: Crash when deleting dockWidget in MDI HOT 1
- Indicators not showing due to other `KDDockWidget` in background HOT 2
- Restore layout for window doesn't work if it's currently maximized HOT 7
- On restore, LayoutSaver assigns zero width/height to windows from disconnected screen
- Move DockWidget programmically HOT 1
- Broken "Toggle Another" Quick MDI example HOT 4
- Linking problems HOT 18
- Restore maximized window state while it's currently maximized doesn't work HOT 2
- The display on the right side of the dock window is weird. HOT 3
- Crash in KDDockWidgets::DockWidgetInstantiator::isFocusedChanged HOT 4
- Broken restoration of nested `MainWindow`
- Hidden Dock-widgets deletion HOT 3
- Support for QtQuick in Python HOT 1
- How can I hide, then reshow tab group all at once so that tabs can be brought back together instead of seperating? HOT 3
- Build fails with fmt 11
- Is the installed version available? HOT 1
- fixed dockwidget
- Multiple main window in qtquick HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kddockwidgets.