File: sconnect.h

package info (click to toggle)
dspdfviewer 1.15.1%2Bgit20230427.d432d8d-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 924 kB
  • sloc: cpp: 2,303; makefile: 22; sh: 7
file content (15 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <stdexcept>

/** secure connect:
 *
 * Quick and dirty hack to check QObject::connect()'s return value
 */
template<typename Sender, typename Signal, typename Receiver, typename Slot>
void sconnect(Sender sender, Signal signal, Receiver receiver, Slot slot, Qt::ConnectionType type=Qt::AutoConnection) {
	bool okay = QObject::connect(
		sender, signal, receiver, slot, type);
	if ( ! okay ) {
		throw std::runtime_error(
		std::string("QObject::connect failed. sender: ")+signal+" receiver: "+slot);
	}
}