Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set affinity? #465

Closed
petrmanek opened this issue Jan 31, 2024 · 9 comments
Closed

How to set affinity? #465

petrmanek opened this issue Jan 31, 2024 · 9 comments
Assignees
Milestone

Comments

@petrmanek
Copy link

Hi, I am trying to use affinities with the QtQuick platform and the latest revision of KDDW 2.0 and have a quick question. How and at what point in object lifecycle do you set them? All QML wrappers have affinities declared only as a readonly property, which proxies to the wrapped object (usually a DockWidget or a MainWindow) or an empty list if it is not defined.

I was able to subclass KDDockWidgets::QtQuick::ViewFactory and set DockWidget affinity inside createDockWidget(), however this seems super hacky and it does not give me an easy way to do the same for main windows. An obvious place to do this setup cleanly would be somewhere in MainWindowInstantiator or a DockWidgetInstantiator.

Can you please advise? Am I missing something here?

@petrmanek
Copy link
Author

I suspect this is a low-hanging fruit / undocumented feature. I tried to search through examples and other issues, but could not find anything material. Could I please get any of the developers/maintainers to chime in? @iamsergio

@iamsergio iamsergio self-assigned this Feb 5, 2024
@iamsergio
Copy link
Contributor

I'll get to this soon, currently traveling

@iamsergio iamsergio added this to the v2.1 milestone Feb 8, 2024
@iamsergio
Copy link
Contributor

yeah, API needs to be exposed

@petrmanek
Copy link
Author

@iamsergio Note that I am happy to help with a PR, if that is desirable. I would like to use affinities to load/save only a subset of windows and widgets.

iamsergio added a commit that referenced this issue Feb 11, 2024
@iamsergio
Copy link
Contributor

MainWindowInstantiator, DockWidgetInstantiator and LayoutSaverInstantiator have an affinities property now, it takes a list. See tests/main465.qml

@petrmanek
Copy link
Author

Thanks for implementing this so fast! 🎉

One last question: I have noticed that the referenced commit appears in the mdi_fixed_size_example branch. I am currently running KDDW from the 2.0 branch. What is the difference between those branches, and are there any plans to merge them in the future?

iamsergio added a commit that referenced this issue Feb 12, 2024
@iamsergio
Copy link
Contributor

It's in main now. mdi_fixed_size_example is something else, to be deleted

@petrmanek
Copy link
Author

It's in main now. mdi_fixed_size_example is something else, to be deleted

Are you sure about this? I have just switch back from mdi_fixed_size_example to 725d146, which is the latest commit in 2.0 as of writing, and this does not seem to be included.

@petrmanek
Copy link
Author

Please disregard my last comment. I have only noticed now that there is a main branch. (I was assuming that you were referring to 2.0 when you wrote "main")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants