Logo    
KDWinUtils
Helper library for MFC to Qt migration
Loading...
Searching...
No Matches
KNumber< T > Class Template Reference

The KNumber< T > class is used to replace DDX_Text data exchange for numeric types. More...

#include <knumber.h>

Public Types

using Type = T
 
using value_type = T
 

Public Member Functions

 KNumber (T value)
 
 operator T () const
 
KNumber< T > & operator= (const T &value)
 
void setValidator (QValidator *validator)
 
void setWidget (QWidget *label)
 
QWidget * widget () const
 

Detailed Description

template<typename T>
class KNumber< T >

The KNumber< T > class is used to replace DDX_Text data exchange for numeric types.

This class handles widget that displays a numeric type. It is a proxy for the widget, and can be used to set and get the value. There are no MFC equivalent for this class, as an int, float, double... are used in MFC to represent the state of the widget. Only in the case of a numeric types.

It can be used with a QLineEdit, a QComboBox or a QLabel.

See also
https://learn.microsoft.com/en-us/cpp/mfc/reference/standard-dialog-data-exchange-routines#ddx_text

Member Typedef Documentation

◆ Type

template<typename T >
using KNumber< T >::Type = T

◆ value_type

template<typename T >
using KNumber< T >::value_type = T

Constructor & Destructor Documentation

◆ KNumber()

template<typename T >
KNumber< T >::KNumber ( T value)
inlineexplicit

Constructs a KNumber with a default value.

Member Function Documentation

◆ operator T()

template<typename T >
KNumber< T >::operator T ( ) const
inline

Returns the current value of the widget.

◆ operator=()

template<typename T >
KNumber< T > & KNumber< T >::operator= ( const T & value)
inline

Sets a new value on the widget, the value will be transformed into text.

◆ setValidator()

template<typename T >
void KNumber< T >::setValidator ( QValidator * validator)
inline

Add a validator to the widget, particularly useful for handling DDV routines.

See also
https://learn.microsoft.com/en-us/cpp/mfc/reference/standard-dialog-data-validation-routines

◆ setWidget()

template<typename T >
void KNumber< T >::setWidget ( QWidget * label)
inline

Sets the widget the class is proxying.

◆ widget()

template<typename T >
QWidget * KNumber< T >::widget ( ) const
inline

Returns the underlying widget the class is proxying.


The documentation for this class was generated from the following file: