Jump to content

What is essential difference between WidgetHSlider and WidgetVSlider?


photo

Recommended Posts

Is there realy necessity in two different classes for horizontal and vertical sliders? For example, there is single orientation parameter Qt slider class.

 

This Unigine code design solution causes following problem in client code: it is really difficult to write generic code when slider orientation doesn't matter. One need to write absolutely identical code for WidgetHSlider and WidgetVSlider.

Link to comment

Hello,

 

I agree! But in the meantime, I noticed that the only difference is their getButton__ and setButton__ functions. You could write your own function something like:

namespace WidgetSlider{
   int getButtonSize(Widget a slider){
       if(is_base_class("Unigine::WidgetHSlider", slider)){
           return slider.getButtonWidth();
       }
       if(is_base_class("unigine::WidgetVSlider", slider)){
           return slider.getButtonHeight();
       }
   }
}

 

And something analgous for the set method.

Link to comment
×
×
  • Create New...