Qx v0.6
Qt Extensions Library
Loading...
Searching...
No Matches
qx-helpers.h File Reference

The qx-concepts header file provides a set of various convenience functions that are are designed to facilitate common fundamental tasks with as brief syntax as possible. More...

#include <type_traits>
#include <utility>
#include <QMetaObject>
#include <QObject>
#include "qx/utility/qx-typetraits.h"
#include "qx/utility/qx-concepts.h"
Include dependency graph for qx-helpers.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  qxFuncAggregate< Functors >
 
class  Qx::ScopedConnection
 The ScopedConnection class disconnects a connection when it goes out of scope. More...
 

Namespaces

namespace  Qx
 The Qx namespace is the main namespace through which all non-global functionality of the Qx library is accessed.
 

Concepts

concept  Qx::arrowable_container_type
 

Typedefs

template<typename T >
using Qx::container_arrow_result
 

Functions

template<arrowable_container_type T>
container_arrow_result< T > Qx::container_arrow_operator (T &data)
 
template<typename T >
const T qxAsConst (T &&t)
 
template<typename T >
std::add_const< T >::type qxAsConst (T &t)
 
template<typename T >
void qxDelete (T *&pointer)
 
template<typename PointerToMemberFunction , typename Functor >
ScopedConnection Qx::scopedConnect (const QObject *sender, PointerToMemberFunction signal, Functor &&functor)
 

Function Documentation

◆ qxAsConst() [1/2]

template<typename T >
const T qxAsConst ( T && t)

Serves the same purpose as qAsConst() (preventing implicitly-shared Qt containers from detaching), but this version works for rvalues, albeit with some efficiency concerns depending on the nature of t.

◆ qxAsConst() [2/2]

template<typename T >
std::add_const< T >::type qxAsConst ( T & t)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to qAsConst(T& t).

This overload exists so that qxAsConst can consistently be used everywhere for both lvalues and rvalues, instead of having to employ mixed usage of qxAsConst() and qAsConst().

◆ qxDelete()

template<typename T >
void qxDelete ( T *& pointer)

Calls delete on pointer and then sets it to nullptr .