Re: undocking/detaching toolviews to regular windows instead of tool windows
Kevin Funk <[email protected]>
| Newsgroups | gmane.comp.kde.users.kdevelop |
|---|---|
| Message-ID | <8202855.lFpQKLkKVv@kerberos> |
On Thursday, 12 October 2017 14:15:43 CEST René J.V. Bertin wrote:
> Hi,
>
> Anyone else who'd like to be able to undock/detach toolview windows to
> become regular windows that remain visible when application focus changes,
> that can be covered by the mainwindow (and moved partially off screen)? The
> documentation toolview would be a prime candidate in my book.
Makes sense. Patches welcome.
Should be easy enough, you need to reparent the widget contained in the
QDockWidget, set the Qt::Window flag and show it again. Work from there.
Something I hacked together in 5 mins (basically untested):
```
diff --git a/kdevplatform/sublime/idealdockwidget.cpp b/kdevplatform/sublime/
idealdockwidget.cpp
index d8fcac4be9..31541dd21d 100644
--- a/kdevplatform/sublime/idealdockwidget.cpp
+++ b/kdevplatform/sublime/idealdockwidget.cpp
@@ -140,6 +141,16 @@ void IdealDockWidget::contextMenuRequested(const QPoint
&point)
setShortcut->setToolTip(i18n("Use this shortcut to trigger visibility of
the tool view."));
menu.addSeparator();
+ QAction *separateWindow = menu.addAction(i18n("Turn into separate
window"));
+ connect(separateWindow, &QAction::triggered, this, [this]() {
+ if (auto w = widget()) {
+ // turn into top-level window
+ w->setParent(nullptr);
+ w->setWindowFlag(Qt::Window, true);
+ w->show();
+ });
+
+ menu.addSeparator();
QAction* remove = menu.addAction(QIcon::fromTheme(QStringLiteral("dialog-
close")), i18n("Remove Tool View"));
QAction* triggered = menu.exec(senderWidget->mapToGlobal(point));
```
Seems to do the job. But please investigate some more yourself, please make
sure that doesn't break any other integration within the Sublime architecture.
Only then file a patch, best with some unit test.
Regards,
Kevin
> FWIW I'm making some progress but could use a hand esp. from someone
> understanding the architecture a bit better - if such a feature would be
> appreciate by others than just myself.
FWIW, René also cross-posted basically the same question to:
http://lists.qt-project.org/pipermail/interest/2017-October/028275.html
(Just in case someone is reading only either mailing list...)
Regards,
Kevin
> Thanks,
> René
--
Kevin Funk | [email protected] | http://kfunk.org
signature.asc
(application/pgp-signature, 163 B)
-----BEGIN PGP SIGNATURE----- iEYEABECAAYFAlnfcXQACgkQxkz1axPKzl0vYwCfWbZhX1YKFrxDX8WUbMdp6kKS DXwAoMTwCvq6k0yN5x5DKDs7isldMGMc =iQwv -----END PGP SIGNATURE-----