Bladeren bron

Merge branch 'popup-in-slider-widget'

* popup-in-slider-widget:
  Add ctkSliderWidget::popup implementation.
Julien Finet 13 jaren geleden
bovenliggende
commit
061e93f696
2 gewijzigde bestanden met toevoegingen van 12 en 1 verwijderingen
  1. 9 1
      Libs/Widgets/ctkSliderWidget.cpp
  2. 3 0
      Libs/Widgets/ctkSliderWidget.h

+ 9 - 1
Libs/Widgets/ctkSliderWidget.cpp

@@ -526,10 +526,11 @@ void ctkSliderWidget::setPopupSlider(bool popup)
   if (popup)
     {
     d->SliderPopup = new ctkPopupWidget(0);
-    //d->SliderPopup->setParent(this);
 
     QHBoxLayout* layout = new QHBoxLayout(d->SliderPopup);
     layout->setContentsMargins(0,0,0,0);
+    /// If the Slider has already been created, it will try to keep its
+    /// size.
     layout->addWidget(d->Slider);
 
     d->SliderPopup->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
@@ -546,6 +547,13 @@ void ctkSliderWidget::setPopupSlider(bool popup)
 }
 
 // --------------------------------------------------------------------------
+ctkPopupWidget* ctkSliderWidget::popup()const
+{
+  Q_D(const ctkSliderWidget);
+  return d->SliderPopup;
+}
+
+// --------------------------------------------------------------------------
 QDoubleSpinBox* ctkSliderWidget::spinBox()
 {
   Q_D(ctkSliderWidget);

+ 3 - 0
Libs/Widgets/ctkSliderWidget.h

@@ -172,6 +172,9 @@ public:
   /// The slider can be handled as a popup for the spinbox. The location where
   /// the popup appears is controlled by \sa alignement.
   /// False by default.
+  /// Note: some sizing issues in the popup can happen if the ctkSliderWidget
+  /// has already parent. You might want to consider setting this property
+  /// before setting a parent to ctkSliderWidget.
   bool hasPopupSlider()const;
   void setPopupSlider(bool popup);