undocking/detaching toolviews to regular windows instead of tool windows

Kevin Funk kfunk at kde.org
Sat Oct 14 10:34:31 BST 2017

On Friday, 13 October 2017 22:13:05 CEST René J.V. Bertin wrote:
> On Thursday October 12 2017 15:43:16 Kevin Funk wrote:
> Hi,
> >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,
> Almost there...
> >best with some unit test.
> I think the test_viewactivation test could be adapted to use
> IdealDockWidgets instead of QDockWidgets, but that requires exporting at
> least IdealDockController, IdealButtonBarWidget, IdealToolWidget and
> IdealLayout (I've already exported IdealDockWidgets itself so that doc
> plugins can configure it to use regular instead of floating windows).
> I guess that those classes would require exporting for any unittest, is that
> worth it? I mean, you cannot really unit-test how those windows behave, if
> they render their content as it should etc, can you?

That probably makes sense, yes.

Note that we shouldn't export the symbols of those classes in all cases (as it 
has an performance impact).

Please try to use something like this (just hacked this together) for classes 
only needed to be exported for unit tests:

diff --git a/kdevplatform/config-kdevplatform.h.cmake b/kdevplatform/config-
index 7e3bdd9e0a..4ae2c01dd6 100644
--- a/kdevplatform/config-kdevplatform.h.cmake
+++ b/kdevplatform/config-kdevplatform.h.cmake
@@ -3,4 +3,12 @@
+#cmakedefine01 BUILD_TESTING
diff --git a/kdevplatform/sublime/idealbuttonbarwidget.h b/kdevplatform/
index f087f8ce7c..88289e4e71 100644
--- a/kdevplatform/sublime/idealbuttonbarwidget.h
+++ b/kdevplatform/sublime/idealbuttonbarwidget.h
@@ -23,6 +23,9 @@
+#include "config-kdevplatform.h"
+#include "sublimeexport.h"
 #include <QWidget>
 class IdealToolButton;
@@ -40,7 +43,7 @@ class IdealDockWidget;
 class View;
 class Area;
-class IdealButtonBarWidget: public QWidget
public QWidget
> FWIW, I also get the test to link when I add the source files for the
> classes above to the test sources. The result doesn't crash straight away.

Yep, but that a) increases compile, b) you need to collectively add all the 
source files a certain source file depends on, too (maintenance burden)

Better use something like above.

> I know this is safe with C, but is it also safe with C++?

I think that hasn't anything to do with whether it's C or C++

> R.


Kevin Funk | kfunk at kde.org | http://kfunk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20171014/2e8497e3/attachment.sig>

More information about the KDevelop mailing list