Embedded designer in kdev4

Andreas Pakulat apaku at gmx.de
Fri Jan 12 20:14:30 UTC 2007


Hi,

this is mainly for Matt. I needed a short break from thesis-hacking and
checked wether I could re-activate the widgets and properties tools of
the embedded designer.

Its more like a hack, because we probably want to have them as toolviews
and not put with a splitter into the widget. But I don't know atm how to
provide toolviews from a KPart...

Just wanted to let you know and ask if it makes sense to commit this,
until somebody has time to rework the designer (probably after Alexander
started sublime integration).

Andreas

-- 
A vivid and creative mind characterizes you.
-------------- next part --------------
Index: qtdesignerpart.h
===================================================================
--- qtdesignerpart.h	(Revision 622533)
+++ qtdesignerpart.h	(Arbeitskopie)
@@ -11,6 +11,8 @@ class QAction;
 class QDesignerFormEditorInterface;
 class QDesignerFormWindowInterface;
 class QWorkspace;
+class KTabWidget;
+class QSplitter;
 
 class KAboutData;
 class KAction;
@@ -54,6 +56,8 @@ private:
   QPointer<QDesignerFormEditorInterface> m_designer;
   QPointer<QDesignerFormWindowInterface> m_window;
   QPointer<QWorkspace> m_workspace;
+  QPointer<QSplitter> m_splitter;
+  QPointer<KTabWidget> m_tabwidget;
 
   DesignerActionHash m_designerActions;
 
Index: qtdesignerpart.cpp
===================================================================
--- qtdesignerpart.cpp	(Revision 622533)
+++ qtdesignerpart.cpp	(Arbeitskopie)
@@ -8,6 +8,8 @@
 #include <QtDesigner/QtDesigner>
 #include <QtDesigner/QDesignerComponents>
 #include <QWorkspace>
+#include <QTextEdit>
+#include <QSplitter>
 
 #include <kaboutdata.h>
 #include <kaction.h>
@@ -18,6 +20,7 @@
 #include <ksavefile.h>
 #include <kstandardaction.h>
 #include <kicon.h>
+#include <ktabwidget.h>
 #include <kactioncollection.h>
 
 #include "kdevcore.h"
@@ -34,9 +37,12 @@ QtDesignerPart::QtDesignerPart(QWidget* 
 {
   QDesignerComponents::initializeResources();
 
-  m_workspace = new QWorkspace(parentWidget);
+  m_splitter = new QSplitter(parentWidget);
+  m_tabwidget = new KTabWidget(m_splitter);
+
+  m_workspace = new QWorkspace(m_splitter);
   m_workspace->setScrollBarsEnabled(true);
-  setWidget( m_workspace );
+  setWidget( m_splitter );
 
   setXMLFile( "kdevqtdesigner.rc" );
 
@@ -53,13 +59,26 @@ QtDesignerPart::QtDesignerPart(QWidget* 
   m_designer->setPropertyEditor(QDesignerComponents::createPropertyEditor(m_designer, 0));
   Q_ASSERT(m_designer->propertyEditor() != 0);
 
+  m_designer->setObjectInspector(QDesignerComponents::createObjectInspector(m_designer, 0));
+  Q_ASSERT(m_designer->objectInspector() != 0);
+
+  m_designer->setActionEditor(QDesignerComponents::createActionEditor(m_designer, 0));
+  Q_ASSERT(m_designer->actionEditor() != 0);
+
   (void) new qdesigner_internal::QDesignerIntegration(m_designer, this);
 
   m_designer->widgetBox()->setObjectName( i18n("Widget Box") );
   m_designer->propertyEditor()->setObjectName( i18n("Property Editor") );
+  m_designer->actionEditor()->setObjectName( i18n("Action Editor") );
+  m_designer->objectInspector()->setObjectName( i18n("Object Inspector") );
 
   setupActions();
 
+  m_tabwidget->addTab( m_designer->widgetBox(), i18n("Widgets") );
+  m_tabwidget->addTab( m_designer->propertyEditor(), i18n("Properties") );
+  m_tabwidget->addTab( m_designer->objectInspector(), i18n("Objects") );
+  m_tabwidget->addTab( m_designer->actionEditor(), i18n("Actions") );
+
   connect( KDevCore::documentController(), SIGNAL( documentActivated( KDevDocument* ) ),
            this, SLOT( activated( KDevDocument* ) ) );
 }
@@ -76,8 +95,8 @@ QtDesignerPart::~QtDesignerPart()
 
         delete m_designer;
     }
-    if (m_workspace)
-        m_workspace->deleteLater();
+    if (m_splitter)
+        m_splitter->deleteLater();
 }
 
 void QtDesignerPart::activated( KDevDocument *document )


More information about the KDevelop-devel mailing list