FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scoped_connection.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include "core.h"
19 #include <QtCore/Qt>
20 class QObject;
21 
22 namespace qtcore {
23 
25 {
26 public:
27  ScopedConnect(const QObject* sender, const char* signal,
28  const QObject* receiver, const char* slot,
29  Qt::ConnectionType type = Qt::UniqueConnection);
30  ~ScopedConnect();
31 
32 private:
33  const QObject* m_sender;
34  const QObject* m_receiver;
35  const char* m_signal;
36  const char* m_slot;
37 };
38 
40 {
41 public:
42  ScopedDisconnect(const QObject* sender, const char* signal,
43  const QObject* receiver, const char* slot,
44  Qt::ConnectionType type = Qt::UniqueConnection);
46 
47 private:
48  const QObject* m_sender;
49  const QObject* m_receiver;
50  const char* m_signal;
51  const char* m_slot;
52  const Qt::ConnectionType m_type;
53 };
54 
55 } // namespace qtcore
Definition: scoped_connection.h:39
#define QTTOOLS_CORE_EXPORT
Definition: core.h:27
Definition: grid_numbering.cpp:19
Establishes a signal/slot connection between two QObjects and automatically breaks it upon destructio...
Definition: scoped_connection.h:24