SignalUtils.hpp
1 #pragma once
2 #include <QComboBox>
3 #include <QSpinBox>
4 
5 struct SignalUtils
6 {
7  static constexpr auto QSpinBox_valueChanged_int()
8  {
9  return static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged);
10  }
11  static constexpr auto QDoubleSpinBox_valueChanged_double()
12  {
13  return static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged);
14  }
15  static constexpr auto QComboBox_currentIndexChanged_int()
16  {
17  return static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged);
18  }
19  static constexpr auto QComboBox_activated_int()
20  {
21  return static_cast<void (QComboBox::*)(int)>(&QComboBox::activated);
22  }
23 
24  template <typename Spinbox_T>
25  static constexpr auto SpinBox_valueChanged();
26 };
27 
28 template <>
29 inline constexpr auto SignalUtils::SpinBox_valueChanged<QSpinBox>()
30 {
31  return QSpinBox_valueChanged_int();
32 }
33 template <>
34 inline constexpr auto SignalUtils::SpinBox_valueChanged<QDoubleSpinBox>()
35 {
36  return QDoubleSpinBox_valueChanged_double();
37 }
Definition: SignalUtils.hpp:6