Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
f2166808
Commit
f2166808
authored
Nov 23, 2021
by
Ingo Klöcker
Browse files
Add support for QPointer<T> to KDAB_SET_OBJECT_NAME()
parent
d26810c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/utils/kdtoolsglobal.h
View file @
f2166808
...
...
@@ -10,6 +10,7 @@
#pragma once
#include
<qglobal.h>
#include
<QPointer>
#define KDAB_DISABLE_COPY( x ) private: x( const x & ); x & operator=( const x & )
...
...
@@ -51,9 +52,27 @@ inline T &__kdtools__dereference_for_methodcall(T *o)
return
*
o
;
}
#define KDAB_SET_OBJECT_NAME( x ) __kdtools__dereference_for_methodcall( x ).setObjectName( QStringLiteral( #x ) )
template
<
typename
T
>
inline
void
__kleotools__set_object_name
(
T
&
o
,
const
QString
&
s
)
{
o
.
setObjectName
(
s
);
}
#define KDAB_SYNCHRONIZED( mutex ) if ( bool __counter_##__LINE__ = false ) {} else \
for ( QMutexLocker __locker_##__LINE__( &__kdtools__dereference_for_methodcall( mutex ) ) ; !__counter_##__LINE__ ; __counter_##__LINE__ = true )
template
<
typename
T
>
inline
void
__kleotools__set_object_name
(
T
*
o
,
const
QString
&
s
)
{
if
(
o
)
{
o
->
setObjectName
(
s
);
}
}
template
<
typename
T
>
inline
void
__kleotools__set_object_name
(
QPointer
<
T
>
&
o
,
const
QString
&
s
)
{
__kleotools__set_object_name
(
o
.
data
(),
s
);
}
#define KDAB_SET_OBJECT_NAME( x ) __kleotools__set_object_name( x, QStringLiteral( #x ) )
#define KDAB_SYNCHRONIZED( mutex ) if ( bool __counter_##__LINE__ = false ) {} else \
for ( QMutexLocker __locker_##__LINE__( &__kdtools__dereference_for_methodcall( mutex ) ) ; !__counter_##__LINE__ ; __counter_##__LINE__ = true )
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment