diff --git a/OpenVolumeMesh/OVMPropertyVisualizerIntegerT_impl.hh b/OpenVolumeMesh/OVMPropertyVisualizerIntegerT_impl.hh index bf7487ae81cf65fdbb649452bf184aa053e474bf..e0b82ceda1e45594540902c3ee2724913e33f958 100644 --- a/OpenVolumeMesh/OVMPropertyVisualizerIntegerT_impl.hh +++ b/OpenVolumeMesh/OVMPropertyVisualizerIntegerT_impl.hh @@ -66,6 +66,9 @@ OVMPropertyVisualizerInteger<MeshT,T>::OVMPropertyVisualizerInteger(MeshT* _mesh mNumericLimitMax = std::numeric_limits<T>::max(); mNumericLimitMin = std::numeric_limits<T>::min(); + this->connect(w->computeHistogramButton, &QPushButton::clicked, + [this, w](){this->template showHistogram<T>(w->histogram);}); + } template <typename MeshT, typename T> diff --git a/OpenVolumeMesh/OVMPropertyVisualizerT_impl.hh b/OpenVolumeMesh/OVMPropertyVisualizerT_impl.hh index 3728853f3083f1b031efe949044aec7b626b5f0c..dbec6f8bb5a9396f5f0842b56ce51c929b3540cc 100644 --- a/OpenVolumeMesh/OVMPropertyVisualizerT_impl.hh +++ b/OpenVolumeMesh/OVMPropertyVisualizerT_impl.hh @@ -403,7 +403,8 @@ void OVMPropertyVisualizer<MeshT>::setVertexPropertyFromText(unsigned int /*inde template<typename MeshT> template<typename Type> -void OVMPropertyVisualizer<MeshT>::showHistogram(ACG::QtWidgets::QtHistogramWidget *histogramWidget) { +void OVMPropertyVisualizer<MeshT>::showHistogram(ACG::QtWidgets::QtHistogramWidget *histogramWidget) +{ using PV = OVMPropertyVisualizer<MeshT>; const std::string &prop_name = PV::propertyInfo.propName(); diff --git a/PropertyVisualizer/PropertyVisualizer.hh b/PropertyVisualizer/PropertyVisualizer.hh index d8a0d0fbb9c2c780af4e74cdae05e2dfa9281624..7a63565dfe1af8520a83484a3987ccf9d32617cc 100644 --- a/PropertyVisualizer/PropertyVisualizer.hh +++ b/PropertyVisualizer/PropertyVisualizer.hh @@ -193,10 +193,9 @@ void PropertyVisualizer::showHistogramT( ACG::QtWidgets::QtHistogramWidget *widget, Iterable data) { - const size_t max_bins = 50; // TODO: expose in GUI? widget->setMinimumHeight(300); widget->setColorCoder(buildColorCoder()); - widget->setHistogram(ptr::make_unique<ACG::HistogramT<PropType>>(data.begin(), data.end(), max_bins)); + widget->setHistogram(ACG::create_histogram_auto(data)); } #endif /* PROPERTY_VISUALIZER_HH */ diff --git a/Widgets/IntegerWidget.ui b/Widgets/IntegerWidget.ui index 1d6fd130be7b3dc6ce51201600e8851e67efbe1d..3305746ee8b29ae4bf8812b8ba7ed2687ea8359d 100644 --- a/Widgets/IntegerWidget.ui +++ b/Widgets/IntegerWidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>387</width> - <height>243</height> + <width>443</width> + <height>566</height> </rect> </property> <property name="windowTitle"> @@ -17,7 +17,16 @@ <property name="spacing"> <number>0</number> </property> - <property name="margin"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> <number>0</number> </property> <item> @@ -164,6 +173,35 @@ </item> </layout> </item> + <item> + <widget class="QGroupBox" name="histogramGroupbox"> + <property name="title"> + <string>Histogram</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QPushButton" name="computeHistogramButton"> + <property name="text"> + <string>Compute Histogram</string> + </property> + </widget> + </item> + <item> + <widget class="ACG::QtWidgets::QtHistogramWidget" name="histogram" native="true"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> </item> @@ -175,6 +213,12 @@ <extends>QPushButton</extends> <header>ACG/QtWidgets/QtColorChooserButton.hh</header> </customwidget> + <customwidget> + <class>ACG::QtWidgets::QtHistogramWidget</class> + <extends>QWidget</extends> + <header>ACG/QtWidgets/QtHistogramWidget.hh</header> + <container>1</container> + </customwidget> </customwidgets> <tabstops> <tabstop>intFixedRange</tabstop>