Skip to content

Commit

Permalink
compat/qt-signal: remove crap that only qt_signal<void> needs
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Dec 19, 2021
1 parent b9a3909 commit 7edc2c3
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions compat/qt-signal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class OTR_COMPAT_EXPORT sig_void final : public QObject
{
connect(this, &sig_void::notify, datum, f, conntype);
}
sig_void(QObject* parent = nullptr);
explicit sig_void(QObject* parent = nullptr);
void operator()() const { notify(); }

signals:
Expand All @@ -33,28 +33,23 @@ template<> struct sig<void> { using t = sig_void; };
#ifndef OTR_GENERATE_SIGNAL3
# define OTR_GENERATE_SIGNAL3(x)
#endif
#define OTR_GENERATE_SIGNAL2(type) \
class OTR_COMPAT_EXPORT sig_##type final : public QObject \
{ \
Q_OBJECT \
public: \
template<typename t, typename F> \
sig_##type(t* datum, F&& f, Qt::ConnectionType conntype = Qt::AutoConnection) : QObject(datum) \
{ \
connect(this, &sig_##type::notify, datum, f, conntype); \
} \
sig_##type(QObject* parent = nullptr) : QObject(parent) {} \
void operator()(const type& x) const; \
Q_SIGNALS: \
void notify(const type& x) const; \
}; \
#define OTR_GENERATE_SIGNAL2(type) \
class OTR_COMPAT_EXPORT sig_##type final : public QObject \
{ \
Q_OBJECT \
public: \
explicit sig_##type(QObject* parent = nullptr) : QObject(parent) {} \
void operator()(const type& x) const; \
Q_SIGNALS: \
void notify(const type& x) const; \
}; \
OTR_GENERATE_SIGNAL3(type)

# define OTR_GENERATE_SIGNAL(type) \
OTR_GENERATE_SIGNAL2(type); \
using qlist##type = QList<type>; \
OTR_GENERATE_SIGNAL2(qlist##type); \
template<> struct sig<type> { using t = sig_##type; }; \
# define OTR_GENERATE_SIGNAL(type) \
OTR_GENERATE_SIGNAL2(type); \
using qlist##type = QList<type>; \
OTR_GENERATE_SIGNAL2(qlist##type); \
template<> struct sig<type> { using t = sig_##type; }; \
template<> struct sig<qlist##type> { using t = qlist##type; }

using slider_value = options::slider_value;
Expand Down

0 comments on commit 7edc2c3

Please sign in to comment.