瀏覽代碼

Merge branch 'master' into TransferFunctionWidget

Julien Finet 14 年之前
父節點
當前提交
d339ea93c5

+ 5 - 1
CMake/ctkDashboardDriverScript.cmake

@@ -93,7 +93,11 @@ endif()
 #message("empty_binary_directory:${empty_binary_directory}")
 #message("force_build:${force_build}")
 
-set(CTEST_USE_LAUNCHERS 1)
+# For more details, see http://www.kitware.com/blog/home/post/11
+set(CTEST_USE_LAUNCHERS 0)
+if (NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio")
+  set(CTEST_USE_LAUNCHERS 1)
+endif()
 
 if(empty_binary_directory)
   message("Directory ${CTEST_BINARY_DIRECTORY} cleaned !")

+ 1 - 2
CMakeLists.txt

@@ -318,7 +318,7 @@ SET(CTK_LIBS
   DICOM/Widgets:OFF
   ImageProcessing/ITK/Core:OFF
   #Messaging/Core:OFF  # MessagingCore library need some love :) - Let's disable it for now :(
-  ModuleDescription:OFF
+  #ModuleDescription:OFF # ModuleDescription library need some love :) - Let's disable it for now :(
   Scripting/Python/Core:OFF
   Scripting/Python/Widgets:OFF
   Visualization/VTK/Core:OFF
@@ -331,7 +331,6 @@ SET(CTK_LIBS
 #
 SET(CTK_PLUGINS
   org.commontk.eventbus:OFF
-  #org.commontk.cli:OFF # MessagingCore library need some love :) - Let's disable it for now :(
   org.commontk.configadmin:OFF
   org.commontk.dah.app:OFF
   org.commontk.dah.core:OFF

+ 3 - 0
Libs/Core/CMakeLists.txt

@@ -26,6 +26,8 @@ SET(KIT_SRCS
   ctkAbstractQObjectFactory.tpp
   ctkAbstractLibraryFactory.h
   ctkAbstractLibraryFactory.tpp
+  ctkCallback.cpp
+  ctkCallback.h
   ctkCommandLineParser.cpp
   ctkCommandLineParser.h
   ctkDependencyGraph.cpp
@@ -82,6 +84,7 @@ ENDIF()
 
 # Headers that should run through moc
 SET(KIT_MOC_SRCS
+  ctkCallback.h
   ctkCommandLineParser.h
   ctkErrorLogFDMessageHandler_p.h
   ctkErrorLogModel.h

+ 2 - 0
Libs/Core/Testing/Cpp/CMakeLists.txt

@@ -25,6 +25,7 @@ SET(KITTests_SRCS
   ctkAbstractObjectFactoryTest1.cpp
   ctkAbstractPluginFactoryTest1.cpp
   ctkAbstractQObjectFactoryTest1.cpp
+  ctkCallbackTest1.cpp
   ctkCommandLineParserTest1.cpp
   ctkErrorLogModelTest1.cpp
   ctkErrorLogModelTest2.cpp
@@ -110,6 +111,7 @@ IF(HAVE_BFD)
   ADD_TEST(NAME ctkBinaryFileDescriptorTest1 COMMAND ${KIT_TESTS} ctkBinaryFileDescriptorTest1 $<TARGET_FILE:ctkBinaryFileDescriptorTestHelper>)
   SET_PROPERTY(TEST ctkBinaryFileDescriptorTest1 PROPERTY LABELS ${PROJECT_NAME})
 ENDIF()
+SIMPLE_TEST( ctkCallbackTest1 )
 SIMPLE_TEST( ctkCommandLineParserTest1 )
 SIMPLE_TEST( ctkDependencyGraphTest1 )
 SIMPLE_TEST( ctkDependencyGraphTest2 )

+ 107 - 0
Libs/Core/Testing/Cpp/ctkCallbackTest1.cpp

@@ -0,0 +1,107 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+// Qt includes
+#include <QCoreApplication>
+#include <QTimer>
+
+// CTK includes
+#include "ctkCallback.h"
+
+// STD includes
+#include <cstdlib>
+#include <iostream>
+
+namespace
+{
+bool Done1;
+void doSomething1()
+{
+  Done1 = true;
+}
+
+bool Done2;
+void doSomething2()
+{
+  Done2 = true;
+}
+
+} // end of anomymous namespace
+
+//-----------------------------------------------------------------------------
+int ctkCallbackTest1(int argc, char * argv [] )
+{
+  QCoreApplication app(argc, argv);
+  
+
+  Done1 = false;
+  Done2 = false;
+
+  ctkCallback callback1;
+  if (callback1.callback() != 0)
+    {
+    std::cerr << "Line " << __LINE__ << " - Problem vith ctkCallback constructor"
+              << " - ctkCallback::callback() should return 0" << std::endl;
+    return EXIT_FAILURE;
+    }
+    
+  callback1.setCallback(doSomething1);
+  if (callback1.callback() != doSomething1)
+    {
+    std::cerr << "Line " << __LINE__ << " - Problem vith ctkCallback::setCallback()" << std::endl;
+    return EXIT_FAILURE;
+    }
+  
+  QTimer::singleShot(0, &callback1, SLOT(invoke()));
+  
+  ctkCallback callback2(doSomething2);
+  if (callback2.callback() != doSomething2)
+    {
+    std::cerr << "Line " << __LINE__ << " - Problem vith ctkCallback constructor" << std::endl;
+    return EXIT_FAILURE;
+    }
+    
+  QTimer::singleShot(0, &callback2, SLOT(invoke()));
+  
+  ctkCallback callback3;
+  
+  QTimer::singleShot(0, &callback3, SLOT(invoke()));
+
+  QTimer::singleShot(0, &app, SLOT(quit()));
+
+  int status = app.exec();
+  if (status == EXIT_FAILURE)
+    {
+    return EXIT_FAILURE;
+    }
+
+  if (!Done1)
+    {
+    std::cerr << "Line " << __LINE__ << " - Probem with ctkCallback" << std::endl;
+    return EXIT_FAILURE;
+    }
+    
+  if (!Done2)
+    {
+    std::cerr << "Line " << __LINE__ << " - Probem with ctkCallback::setCallback" << std::endl;
+    return EXIT_FAILURE;
+    }
+  return EXIT_SUCCESS;
+}

+ 66 - 0
Libs/Core/ctkCallback.cpp

@@ -0,0 +1,66 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+// CTK includes
+#include "ctkCallback.h"
+
+// --------------------------------------------------------------------------
+// ctkCallback methods
+
+// --------------------------------------------------------------------------
+ctkCallback::ctkCallback(QObject * parentObject) : QObject(parentObject)
+{
+  this->setCallback(0);
+}
+
+// --------------------------------------------------------------------------
+ctkCallback::ctkCallback(void (*newCallback)(), QObject * parentObject) : QObject(parentObject)
+{
+  this->setCallback(newCallback);
+}
+
+// --------------------------------------------------------------------------
+ctkCallback::~ctkCallback()
+{
+}
+
+// --------------------------------------------------------------------------
+void (*ctkCallback::callback()const)()
+{
+  return this->Callback;
+}
+  
+// --------------------------------------------------------------------------
+void ctkCallback::setCallback(void (*newCallback)())
+{
+  this->Callback = newCallback;
+}
+
+// --------------------------------------------------------------------------
+void ctkCallback::invoke()
+{
+  if (!this->Callback)
+    {
+    return;
+    }
+  (*this->Callback)();
+}
+
+

+ 54 - 0
Libs/Core/ctkCallback.h

@@ -0,0 +1,54 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
+
+#ifndef __ctkCallback_h
+#define __ctkCallback_h
+
+// Qt includes
+#include <QObject>
+
+// CTK includes
+#include "ctkCoreExport.h"
+
+//---------------------------------------------------------------------------
+class CTK_CORE_EXPORT ctkCallback : public QObject
+{
+  Q_OBJECT
+public:
+
+  ctkCallback(QObject * parentObject = 0);
+  ctkCallback(void (*callback)(), QObject * parentObject = 0);
+  virtual ~ctkCallback();
+
+  /// Returns the current pointer function
+  void (*callback()const)();
+  /// Sets a pointer function to call when invoke() is called.
+  void setCallback(void (*callback)());
+  
+public slots:
+  /// Internally calls the pointer function \a callback.
+  virtual void invoke();
+  
+private:
+  void (*Callback)();
+};
+
+#endif
+

+ 1 - 1
Libs/PluginFramework/ctkPluginFrameworkLauncher.cpp

@@ -35,7 +35,7 @@
 #include <cstdlib>
 #endif // _WIN32
 
-#include <CTKConfig.h>
+#include <ctkConfig.h>
 
 class ctkPluginFrameworkLauncherPrivate
 {

+ 3 - 3
Libs/Visualization/VTK/Widgets/CMakeLists.txt

@@ -114,9 +114,9 @@ ctkMacroBuildLib(
   )
 
 # Plugins
-#IF(BUILD_QTDESIGNER_PLUGINS)
-#  ADD_SUBDIRECTORY(Plugins)
-#ENDIF()
+IF(BUILD_QTDESIGNER_PLUGINS)
+  ADD_SUBDIRECTORY(Plugins)
+ENDIF()
 
 # Testing
 IF(BUILD_TESTING)

+ 108 - 42
Libs/Widgets/Testing/Cpp/ctkCollapsibleButtonTest2.cpp

@@ -32,7 +32,7 @@
 // STD includes
 #include <cstdlib>
 #include <iostream>
-
+#include <QDebug>
 //-----------------------------------------------------------------------------
 int ctkCollapsibleButtonTest2(int argc, char * argv [] )
 {
@@ -40,123 +40,189 @@ int ctkCollapsibleButtonTest2(int argc, char * argv [] )
 
   ctkCollapsibleButton collapsibleButton;
   collapsibleButton.setText("Button");
+  collapsibleButton.setCollapsed(true);
 
   QLabel* label0 = new QLabel("should be invisible", &collapsibleButton);
   QLabel* label1 = new QLabel("should be invisible", &collapsibleButton);
   QLabel* label2 = new QLabel("should be invisible", &collapsibleButton);
-  QLabel* label3 = new QLabel("should be visible", &collapsibleButton);
+  QLabel* label3 = new QLabel("should be invisible", &collapsibleButton);
   QLabel* label4 = new QLabel("should be visible", &collapsibleButton);
   QLabel* label5 = new QLabel("should be visible", &collapsibleButton);
-  
+  QLabel* label6 = new QLabel("should be visible", &collapsibleButton);
+  QLabel* label7 = new QLabel("should be visible", &collapsibleButton);
+  QLabel* label8 = new QLabel("should be visible", &collapsibleButton);
+
+  label0->setVisible(false);
+  label7->setVisible(true);
+
   QVBoxLayout *vbox = new QVBoxLayout;
+  vbox->setContentsMargins(0, 0, 0, 0);
   vbox->addWidget(label0);
   vbox->addWidget(label1);
   vbox->addWidget(label2);
   vbox->addWidget(label3);
   vbox->addWidget(label4);
   vbox->addWidget(label5);
+  vbox->addWidget(label6);
+  vbox->addWidget(label7);
+  vbox->addWidget(label8);
   collapsibleButton.setLayout(vbox);
 
-  label0->setVisible(false);
+  label1->setVisible(false);
 
   collapsibleButton.show();
 
-  label1->setVisible(false);
-  
   if (label0->isVisible() ||
       label1->isVisible() ||
-      !label2->isVisible() ||
-      !label3->isVisible() ||
-      !label4->isVisible() ||
-      !label5->isVisible())
+      label2->isVisible() ||
+      label3->isVisible() ||
+      label4->isVisible() ||
+      label5->isVisible() ||
+      label6->isVisible() ||
+      label7->isVisible() ||
+      label8->isVisible())
     {
-    std::cout << "Wrong child visibility: "
+    std::cout <<  __LINE__ << "Wrong child visibility: "
       << label0->isVisible()  << " "
       << label1->isVisible()  << " "
       << label2->isVisible() << " "
       << label3->isVisible() << " "
       << label4->isVisible() << " "
-      << label5->isVisible() << std::endl;
+      << label5->isVisible() << " "
+      << label6->isVisible() << " "
+      << label7->isVisible() << " "
+      << label8->isVisible() << std::endl;
     return EXIT_FAILURE;
     }
-  
-  collapsibleButton.setCollapsed(true);
-  
+
+  label2->setVisible(false);
+
+  if (label2->isVisible())
+    {
+    std::cout <<  __LINE__ << "Wrong child visibility: "
+      << label2->isVisible() << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  collapsibleButton.setCollapsed(false);
+
   if (label0->isVisible() ||
       label1->isVisible() ||
       label2->isVisible() ||
-      label3->isVisible() ||
-      label4->isVisible() ||
-      label5->isVisible())
+      !label3->isVisible() ||
+      !label4->isVisible() ||
+      !label5->isVisible() ||
+      !label6->isVisible() ||
+      !label7->isVisible() ||
+      !label8->isVisible())
     {
-    std::cout << "Wrong child visibility: "
+    std::cout <<  __LINE__ << "Wrong child visibility: "
       << label0->isVisible()  << " "
       << label1->isVisible()  << " "
       << label2->isVisible() << " "
       << label3->isVisible() << " "
       << label4->isVisible() << " "
-      << label5->isVisible() << std::endl;
+      << label5->isVisible() << " "
+      << label6->isVisible() << " "
+      << label7->isVisible() << " "
+      << label8->isVisible() << std::endl;
     return EXIT_FAILURE;
     }
-  
-  label2->setVisible(false);
-  label3->setVisible(true);
-  label4->setVisible(false);
-  label5->setVisible(false);
-  label5->setVisible(true);
+
+  label3->setVisible(false);
+  label8->setVisible(false);
   
   if (label0->isVisible() ||
       label1->isVisible() ||
       label2->isVisible() ||
       label3->isVisible() ||
-      label4->isVisible() ||
-      label5->isVisible())
+      !label4->isVisible() ||
+      !label5->isVisible() ||
+      !label6->isVisible() ||
+      !label7->isVisible() ||
+      label8->isVisible())
     {
-    std::cout << "Wrong child visibility: "
+    std::cout <<  __LINE__ << "Wrong child visibility: "
       << label0->isVisible()  << " "
       << label1->isVisible()  << " "
       << label2->isVisible() << " "
       << label3->isVisible() << " "
       << label4->isVisible() << " "
-      << label5->isVisible() << std::endl;
+      << label5->isVisible() << " "
+      << label6->isVisible() << " "
+      << label7->isVisible() << " "
+      << label8->isVisible() << std::endl;
     return EXIT_FAILURE;
     }
-  
-  collapsibleButton.setCollapsed(false);
+
+  collapsibleButton.setCollapsed(true);
 
   if (label0->isVisible() ||
       label1->isVisible() ||
       label2->isVisible() ||
-      !label3->isVisible() ||
+      label3->isVisible() ||
       label4->isVisible() ||
-      !label5->isVisible())
+      label5->isVisible() ||
+      label6->isVisible() ||
+      label7->isVisible() ||
+      label8->isVisible())
     {
-    std::cout << "Wrong child visibility: "
+    std::cout <<  __LINE__ << "Wrong child visibility: "
       << label0->isVisible()  << " "
       << label1->isVisible()  << " "
       << label2->isVisible() << " "
       << label3->isVisible() << " "
       << label4->isVisible() << " "
-      << label5->isVisible() << std::endl;
+      << label5->isVisible() << " "
+      << label6->isVisible() << " "
+      << label7->isVisible() << " "
+      << label8->isVisible() << std::endl;
     return EXIT_FAILURE;
     }
 
-  label4->setVisible(true);
+  label4->setVisible(false);
+  label8->setVisible(true);
+
+  if (label4->isVisible() ||
+      label8->isVisible())
+    {
+    std::cout <<  __LINE__ << "Wrong child visibility: "
+      << label4->isVisible() << " "
+      << label8->isVisible() << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  collapsibleButton.setCollapsed(false);
 
   if (label0->isVisible() ||
       label1->isVisible() ||
       label2->isVisible() ||
-      !label3->isVisible() ||
-      !label4->isVisible() ||
-      !label5->isVisible())
+      label3->isVisible() ||
+      label4->isVisible() ||
+      !label5->isVisible() ||
+      !label6->isVisible() ||
+      !label7->isVisible() ||
+      !label8->isVisible())
     {
-    std::cout << "Wrong child visibility: "
+    std::cout << __LINE__ << "Wrong child visibility: "
       << label0->isVisible()  << " "
       << label1->isVisible()  << " "
       << label2->isVisible() << " "
       << label3->isVisible() << " "
       << label4->isVisible() << " "
-      << label5->isVisible() << std::endl;
+      << label5->isVisible() << " "
+      << label6->isVisible() << " "
+      << label7->isVisible() << " "
+      << label8->isVisible() << std::endl;
+    return EXIT_FAILURE;
+    }
+
+  label4->setVisible(true);
+
+  if (!label4->isVisible())
+    {
+    std::cout << "Wrong child visibility: "
+      << label4->isVisible() << std::endl;
     return EXIT_FAILURE;
     }
 

+ 70 - 13
Libs/Widgets/ctkCollapsibleButton.cpp

@@ -55,7 +55,16 @@ public:
   int      CollapsedHeight;
   bool     ExclusiveMouseOver;
   bool     LookOffWhenChecked;
+
+  /// We change the visibility of the chidren in setChildrenVisibility
+  /// and we track when the visibility is changed to force it back to possibly
+  /// force the child to be hidden. To prevent infinite loop we need to know
+  /// who is changing children's visibility.
   bool     ForcingVisibility;
+  /// Sometimes the creation of the widget is not done inside setVisible,
+  /// as we need to do special processing the first time the button is
+  /// setVisible, we track its created state with the variable
+  bool     IsStateCreated;
 
   int      MaximumHeight;  // use carefully
 
@@ -68,6 +77,8 @@ public:
 ctkCollapsibleButtonPrivate::ctkCollapsibleButtonPrivate(ctkCollapsibleButton& object)
   :q_ptr(&object)
 {
+  this->ForcingVisibility = false;
+  this->IsStateCreated = false;
 }
 
 //-----------------------------------------------------------------------------
@@ -109,17 +120,34 @@ void ctkCollapsibleButtonPrivate::init()
 //-----------------------------------------------------------------------------
 void ctkCollapsibleButtonPrivate::setChildVisibility(QWidget* childWidget)
 {
+  Q_Q(ctkCollapsibleButton);
+  // Don't hide children while the widget is not yet created (before show() is
+  // called). If we hide them (but don't set ExplicitShowHide), they would be
+  // shown anyway when they will be created (because ExplicitShowHide is not set).
+  // If we set ExplicitShowHide, then calling setVisible(false) on them would
+  // be a no (because they are already hidden and ExplicitShowHide is set).
+  // So we don't hide/show the children until the widget is created.
+  if (!q->testAttribute(Qt::WA_WState_Created))
+    {
+    return;
+    }
   this->ForcingVisibility = true;
 
-  bool visible= !this->Collapsed &&
-    (childWidget->property("visibilityToParent").isValid() ?
-       childWidget->property("visibilityToParent").toBool() : true);
+  bool visible= !this->Collapsed;
+  // if the widget has been explicity hidden, then hide it.
+  if (childWidget->property("visibilityToParent").isValid()
+      && !childWidget->property("visibilityToParent").toBool())
+    {
+    visible = false;
+    }
 
   childWidget->setVisible(visible);
 
-  // restore the flag as we don't want to make it like it is an explicit visible set.
-  if (!childWidget->property("visibilityToParent").isValid() ||
-      childWidget->property("visibilityToParent").toBool())
+  // setVisible() has set the ExplicitShowHide flag, restore it as we don't want
+  // to make it like it was an explicit visible set because we want
+  // to allow the children to be explicitly hidden by the user.
+  if ((!childWidget->property("visibilityToParent").isValid() ||
+      childWidget->property("visibilityToParent").toBool()))
     {
     childWidget->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
     }
@@ -250,9 +278,13 @@ void ctkCollapsibleButton::collapse(bool collapsed)
     }
 
   // update the visibility of all the children
-  foreach(QWidget* child, this->findChildren<QWidget*>())
+  foreach(QObject* child, this->children())
     {
-    d->setChildVisibility(child);
+    QWidget* childWidget = qobject_cast<QWidget*>(child);
+    if (childWidget)
+      {
+      d->setChildVisibility(childWidget);
+      }
     }
 
   // this might be too many updates...
@@ -627,17 +659,26 @@ bool ctkCollapsibleButton::hitButton(const QPoint & _pos)const
 void ctkCollapsibleButton::childEvent(QChildEvent* c)
 {
   Q_D(ctkCollapsibleButton);
+  QObject* child = c->child();
   if (c && c->type() == QEvent::ChildAdded &&
-      c->child() && c->child()->isWidgetType())
+      child && child->isWidgetType())
     {
+    QWidget *childWidget = qobject_cast<QWidget*>(c->child());
+    // Handle the case where the child has already it's visibility set before
+    // being added to the widget
+    if (childWidget->testAttribute(Qt::WA_WState_ExplicitShowHide) &&
+        childWidget->testAttribute(Qt::WA_WState_Hidden))
+      {
+      // if the widget has explicitly set to hidden, then mark it as such
+      childWidget->setProperty("visibilityToParent", false);
+      }
     // We want to catch all the child's Show/Hide events.
-    c->child()->installEventFilter(this);
+    child->installEventFilter(this);
     // If the child is added while ctkCollapsibleButton is collapsed, then we
     // need to hide the child.
-    QWidget *w = static_cast<QWidget*>(c->child());
-    d->setChildVisibility(w);
+    d->setChildVisibility(childWidget);
     }
-  this->QWidget::childEvent(c);
+  this->QAbstractButton::childEvent(c);
 }
 
 //-----------------------------------------------------------------------------
@@ -651,6 +692,22 @@ void ctkCollapsibleButton::setVisible(bool show)
   d->ForcingVisibility = true;
   this->QWidget::setVisible(show);
   d->ForcingVisibility = false;
+  // We have been ignoring setChildVisibility() while the collapsible button
+  // is not yet created, now that it is created, ensure that the children
+  // are correctly shown/hidden depending on their explicit visibility and
+  // the collapsed property of the button.
+  if (!d->IsStateCreated && this->testAttribute(Qt::WA_WState_Created))
+    {
+    d->IsStateCreated = true;
+    foreach(QObject* child, this->children())
+      {
+      QWidget* childWidget = qobject_cast<QWidget*>(child);
+      if (childWidget)
+        {
+        d->setChildVisibility(childWidget);
+        }
+      }
+    }
 }
 
 //-----------------------------------------------------------------------------

+ 14 - 2
Libs/Widgets/ctkDoubleRangeSlider.cpp

@@ -90,8 +90,8 @@ void ctkDoubleRangeSliderPrivate::init()
   this->MaxValue = this->Slider->maximumValue();
   this->SingleStep = this->Slider->singleStep();
 
-  q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed,
-                               QSizePolicy::Slider));
+  q->setSizePolicy(this->Slider->sizePolicy());
+  q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
 
   this->connectSlider();
 }
@@ -498,6 +498,18 @@ void ctkDoubleRangeSlider::triggerAction( QAbstractSlider::SliderAction action)
 void ctkDoubleRangeSlider::setOrientation(Qt::Orientation newOrientation)
 {
   Q_D(ctkDoubleRangeSlider);
+  if (this->orientation() == newOrientation)
+    {
+    return;
+    }
+  if (!testAttribute(Qt::WA_WState_OwnSizePolicy))
+    {
+    QSizePolicy sp = this->sizePolicy();
+    sp.transpose();
+    this->setSizePolicy(sp);
+    this->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
+    }
+  // d->Slider will take care of calling updateGeometry
   d->Slider->setOrientation(newOrientation);
 }
 

+ 14 - 2
Libs/Widgets/ctkDoubleSlider.cpp

@@ -89,8 +89,8 @@ void ctkDoubleSliderPrivate::init()
   q->connect(this->Slider, SIGNAL(rangeChanged(int, int)),
              q, SLOT(onRangeChanged(int, int)));
 
-  q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed,
-                               QSizePolicy::Slider));
+  q->setSizePolicy(this->Slider->sizePolicy());
+  q->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
 }
   
 // --------------------------------------------------------------------------
@@ -344,6 +344,18 @@ Qt::Orientation ctkDoubleSlider::orientation()const
 void ctkDoubleSlider::setOrientation(Qt::Orientation newOrientation)
 {
   Q_D(ctkDoubleSlider);
+  if (this->orientation() == newOrientation)
+    {
+    return;
+    }
+  if (!testAttribute(Qt::WA_WState_OwnSizePolicy))
+    {
+    QSizePolicy sp = this->sizePolicy();
+    sp.transpose();
+    this->setSizePolicy(sp);
+    this->setAttribute(Qt::WA_WState_OwnSizePolicy, false);
+    }
+  // d->Slider will take care of calling updateGeometry
   d->Slider->setOrientation(newOrientation);
 }
 

+ 0 - 33
Plugins/org.commontk.cli/CMakeLists.txt

@@ -1,33 +0,0 @@
-PROJECT(org_commontk_cli)
-
-SET(PLUGIN_export_directive "org_commontk_cli_EXPORT")
-
-SET(PLUGIN_SRCS
-  ctkCLIPlugin.cpp
-)
-
-SET(PLUGIN_MOC_SRCS
-  ctkCLIPlugin.h
-  ctkCLIRegistry.h
-  ctkICLIManager.h
-)
-
-SET(PLUGIN_resources
-
-)
-
-SET(PLUGIN_cached_resourcefiles
-  servicedescriptor.xml
-)
-
-ctkFunctionGetTargetLibraries(PLUGIN_target_libraries)
-
-ctkMacroBuildPlugin(
-  NAME ${PROJECT_NAME}
-  EXPORT_DIRECTIVE ${PLUGIN_export_directive}
-  SRCS ${PLUGIN_SRCS}
-  MOC_SRCS ${PLUGIN_MOC_SRCS}
-  RESOURCES ${PLUGIN_resources}
-  CACHED_RESOURCEFILES ${PLUGIN_cached_resourcefiles}
-  TARGET_LIBRARIES ${PLUGIN_target_libraries}
-)

+ 0 - 42
Plugins/org.commontk.cli/ctkCLIPlugin.cpp

@@ -1,42 +0,0 @@
-/*
- * ctkCLIPlugin.cxx
- *
- *  Created on: Mar 11, 2010
- *      Author: zelzer
- */
-
-#include "ctkCLIPlugin.h"
-
-#include "ctkCLIRegistry.h"
-
-#include <QtPlugin>
-#include <QServiceInterfaceDescriptor>
-#include <QStringList>
-
-#include <iostream>
-
-using namespace QtMobility;
-
-void ctkCLIPlugin::start(ctkPluginContext* context)
-{
-  ctkCLIRegistry* registry = new ctkCLIRegistry();
-  context->registerService(QStringList("ctkCLIRegistry"), registry);
-
-  std::cout << "Plugin A started\n";
-}
-
-void ctkCLIPlugin::stop(ctkPluginContext* context)
-{
-  std::cout << "Plugin B stopped\n";
-}
-
-QObject* ctkCLIPlugin::createInstance(const QServiceInterfaceDescriptor& descriptor,
-                            QServiceContext* context,
-                            QAbstractSecuritySession* session)
-{
-  std::cout << "Creating service instance for " << descriptor.interfaceName().toStdString() << std::endl;
-  return 0;
-}
-
-Q_EXPORT_PLUGIN2(org_commontk_cli, ctkCLIPlugin)
-

+ 0 - 34
Plugins/org.commontk.cli/ctkCLIPlugin.h

@@ -1,34 +0,0 @@
-/*
- * ctkCLIPlugin.h
- *
- *  Created on: Mar 11, 2010
- *      Author: zelzer
- */
-
-#ifndef CTKCLIPLUGIN_H_
-#define CTKCLIPLUGIN_H_
-
-#include <ctkPluginActivator.h>
-
-#include <QServicePluginInterface>
-
-class ctkCLIPlugin : public QObject,
-                  public ctkPluginActivator,
-                  public QtMobility::QServicePluginInterface
-{
-  Q_OBJECT
-  Q_INTERFACES(ctkPluginActivator QtMobility::QServicePluginInterface)
-
-public:
-
-  void start(ctkPluginContext* context);
-  void stop(ctkPluginContext* context);
-
-  QObject* createInstance(const QtMobility::QServiceInterfaceDescriptor& descriptor,
-                          QtMobility::QServiceContext* context,
-                          QtMobility::QAbstractSecuritySession* session);
-
-};
-
-
-#endif /* CTKCLIPLUGIN_H_ */

+ 0 - 37
Plugins/org.commontk.cli/ctkCLIRegistry.h

@@ -1,37 +0,0 @@
-/*=============================================================================
-
-  Library: CTK
-
-  Copyright (c) German Cancer Research Center,
-    Division of Medical and Biological Informatics
-
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-
-=============================================================================*/
-
-
-#ifndef CTKCLIREGISTRY_H
-#define CTKCLIREGISTRY_H
-
-#include <QObject>
-
-class ctkCLIRegistry : public QObject
-{
-  Q_OBJECT
-
-public:
-
-
-};
-
-#endif // CTKCLIREGISTRY_H

+ 0 - 19
Plugins/org.commontk.cli/ctkICLIManager.h

@@ -1,19 +0,0 @@
-/*
- * ctkICLIManager.h
- *
- *  Created on: Mar 11, 2010
- *      Author: zelzer
- */
-
-#ifndef CTKICLIMANAGER_H_
-#define CTKICLIMANAGER_H_
-
-#include <QObject>
-
-class ctkICLIManager : public QObject
-{
-  Q_OBJECT
-};
-
-
-#endif /* CTKICLIMANAGER_H_ */

+ 0 - 1
Plugins/org.commontk.cli/manifest_headers.cmake

@@ -1 +0,0 @@
-#SET(Plugin-ActivationPolicy eager)

+ 0 - 5
Plugins/org.commontk.cli/org_commontk_cli.qrc

@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/org_commontk_cli">
-  <file>servicedescriptor.xml</file>
- </qresource>
-</RCC>

+ 0 - 12
Plugins/org.commontk.cli/servicedescriptor.xml

@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-  <service>
-    <name>org.commontk.cli_0.0.0</name>
-    <filepath>liborg_commontk_cli</filepath>
-    <interface>
-      <name>org.commontk.cli.ICLIManager</name>
-      <version>1.0</version>
-      <capabilities></capabilities>
-      <customproperty key="objectclass">ctkICLIManager</customproperty>
-      <description>Interface that allows to discover and manage CLI modules</description>
-    </interface>
-  </service>

+ 0 - 9
Plugins/org.commontk.cli/target_libraries.cmake

@@ -1,9 +0,0 @@
-#
-# See CMake/ctkFunctionGetTargetLibraries.cmake
-# 
-# This file should list the libraries required to build the current CTK plugin.
-# 
-
-SET(target_libraries
-  CTKPluginFramework
-  )

+ 2 - 2
Utilities/LastConfigureStep/CTKGenerateCTKConfig.cmake

@@ -137,8 +137,8 @@ CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfig.cmake.in
                ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfig.cmake @ONLY IMMEDIATE)
 CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfigVersion.cmake.in
                ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfigVersion.cmake @ONLY IMMEDIATE)
-CONFIGURE_FILE(${CTK_SOURCE_DIR}/CTKConfig.h.in
-               ${CTK_SUPERBUILD_BINARY_DIR}/CTKConfig.h @ONLY IMMEDIATE)
+CONFIGURE_FILE(${CTK_SOURCE_DIR}/ctkConfig.h.in
+               ${CTK_SUPERBUILD_BINARY_DIR}/ctkConfig.h @ONLY IMMEDIATE)
 
 #-----------------------------------------------------------------------------
 # Settings specific to the install tree.

+ 6 - 0
CTKConfig.h.in

@@ -1 +1,7 @@
+#ifndef __ctkConfig_h
+#define __ctkConfig_h
+
 #define CTK_PLUGIN_DIR "@CTK_BINARY_DIR@/bin/plugins/"
+
+#endif
+