sending a QEvent::ReadOnlyChange

This commit is contained in:
Uwe Rathmann 2021-02-09 12:25:41 +01:00
parent ecc7c6d9a6
commit 864fa97180
3 changed files with 13 additions and 2 deletions

View File

@ -161,6 +161,9 @@ void QskBoundedInput::setReadOnly( bool readOnly )
setWheelEnabled( !readOnly );
Q_EMIT readOnlyChanged( readOnly );
QEvent event( QEvent::ReadOnlyChange );
QCoreApplication::sendEvent( this, &event );
}
bool QskBoundedInput::isReadOnly() const

View File

@ -56,7 +56,7 @@ class QSK_EXPORT QskBoundedInput : public QskBoundedControl
void readOnlyChanged( bool );
protected:
void keyPressEvent( QKeyEvent* event ) override;
void keyPressEvent( QKeyEvent* ) override;
#ifndef QT_NO_WHEELEVENT
void wheelEvent( QWheelEvent* ) override;

View File

@ -19,6 +19,14 @@ QSK_SUBCONTROL( QskTextInput, TextSelected )
QSK_SYSTEM_STATE( QskTextInput, ReadOnly, QskAspect::FirstSystemState << 1 )
QSK_SYSTEM_STATE( QskTextInput, Editing, QskAspect::FirstSystemState << 2 )
static inline void qskPropagateReadOnly( QskTextInput* input )
{
Q_EMIT input->readOnlyChanged( input->isReadOnly() );
QEvent event( QEvent::ReadOnlyChange );
QCoreApplication::sendEvent( input, &event );
}
static inline void qskBindSignals(
const QQuickTextInput* wrappedInput, QskTextInput* input )
{
@ -37,7 +45,7 @@ static inline void qskBindSignals(
input, &QskTextInput::inputMaskChanged );
QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged,
input, &QskTextInput::readOnlyChanged );
input, [ input ] { qskPropagateReadOnly( input ); } );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 8, 0 )
QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged,