API extended

This commit is contained in:
Uwe Rathmann 2025-01-30 10:25:26 +01:00
parent 09d4e367f5
commit 5af007cf4a
2 changed files with 45 additions and 39 deletions

View File

@ -178,12 +178,6 @@ void QskAbstractTextInput::setup( QQuickItem* wrappedInput )
the cursor using skin hints and/or creating the scene graph node the cursor using skin hints and/or creating the scene graph node
from the skinlet. TODO ... from the skinlet. TODO ...
- colorChanged
- fontChanged
Set from the skin hints - might be important enough to offer a
convenience API
- selectionColorChanged - selectionColorChanged
- selectedTextColorChanged - selectedTextColorChanged
@ -285,35 +279,18 @@ QString QskAbstractTextInput::preeditText() const
return INPUT_INVOKE( preeditText ); return INPUT_INVOKE( preeditText );
} }
void QskAbstractTextInput::clear() bool QskAbstractTextInput::canUndo() const { return INPUT_INVOKE( canUndo ); }
{ bool QskAbstractTextInput::canRedo() const { return INPUT_INVOKE( canRedo ); }
INPUT_INVOKE( clear ); bool QskAbstractTextInput::canPaste() const { return INPUT_INVOKE( canPaste ); }
}
void QskAbstractTextInput::selectAll() void QskAbstractTextInput::clear() { INPUT_INVOKE( clear ); }
{ void QskAbstractTextInput::selectAll() { INPUT_INVOKE( selectAll ); }
INPUT_INVOKE( selectAll ); void QskAbstractTextInput::deselect() { INPUT_INVOKE( deselect ); }
} void QskAbstractTextInput::cut() { INPUT_INVOKE( cut ); }
void QskAbstractTextInput::copy() { INPUT_INVOKE( copy ); }
void QskAbstractTextInput::deselect() void QskAbstractTextInput::paste() { INPUT_INVOKE( paste ); }
{ void QskAbstractTextInput::undo() { INPUT_INVOKE( undo ); }
INPUT_INVOKE( deselect ); void QskAbstractTextInput::redo() { INPUT_INVOKE( redo ); }
}
bool QskAbstractTextInput::canUndo() const
{
return INPUT_INVOKE( canUndo );
}
bool QskAbstractTextInput::canRedo() const
{
return INPUT_INVOKE( canRedo );
}
bool QskAbstractTextInput::canPaste() const
{
return INPUT_INVOKE( canPaste );
}
void QskAbstractTextInput::setFontRole( const QskFontRole& role ) void QskAbstractTextInput::setFontRole( const QskFontRole& role )
{ {
@ -322,7 +299,7 @@ void QskAbstractTextInput::setFontRole( const QskFontRole& role )
const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle; const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle;
qskUpdateInputMethod( this, queries ); qskUpdateInputMethod( this, queries );
Q_EMIT fontRoleChanged(); Q_EMIT fontRoleChanged( role );
} }
} }
@ -333,7 +310,7 @@ void QskAbstractTextInput::resetFontRole()
const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle; const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle;
qskUpdateInputMethod( this, queries ); qskUpdateInputMethod( this, queries );
Q_EMIT fontRoleChanged(); Q_EMIT fontRoleChanged( fontRole() );
} }
} }
@ -682,6 +659,23 @@ QSizeF QskAbstractTextInput::unwrappedTextSize() const
return QSizeF( w, h ); return QSizeF( w, h );
} }
void QskAbstractTextInput::setTextColor( const QColor& color )
{
if ( setColor( Text, color ) )
Q_EMIT textColorChanged( color );
}
void QskAbstractTextInput::resetTextColor()
{
if ( resetColor( Text ) )
Q_EMIT textColorChanged( color( Text ) );
}
QColor QskAbstractTextInput::textColor() const
{
return color( Text );
}
void QskAbstractTextInput::setAlignment( Qt::Alignment alignment ) void QskAbstractTextInput::setAlignment( Qt::Alignment alignment )
{ {
if ( setAlignmentHint( Text, alignment ) ) if ( setAlignmentHint( Text, alignment ) )

View File

@ -38,6 +38,9 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl
Q_PROPERTY( bool inputMethodComposing READ isInputMethodComposing Q_PROPERTY( bool inputMethodComposing READ isInputMethodComposing
NOTIFY inputMethodComposingChanged ) NOTIFY inputMethodComposingChanged )
Q_PROPERTY( QColor textColor READ textColor
WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged )
Q_PROPERTY( QskFontRole fontRole READ fontRole Q_PROPERTY( QskFontRole fontRole READ fontRole
WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged ) WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged )
@ -115,6 +118,10 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl
void setWrapMode( QskTextOptions::WrapMode ); void setWrapMode( QskTextOptions::WrapMode );
QskTextOptions::WrapMode wrapMode() const; QskTextOptions::WrapMode wrapMode() const;
void setTextColor( const QColor& );
void resetTextColor();
QColor textColor() const;
void setFontRole( const QskFontRole& role ); void setFontRole( const QskFontRole& role );
void resetFontRole(); void resetFontRole();
QskFontRole fontRole() const; QskFontRole fontRole() const;
@ -150,12 +157,19 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl
void deselect(); void deselect();
void selectAll(); void selectAll();
void cut();
void copy();
void paste();
void undo();
void redo();
Q_SIGNALS: Q_SIGNALS:
void editingChanged( bool ); void editingChanged( bool );
void readOnlyChanged( bool ); void readOnlyChanged( bool );
void activationModesChanged(); void activationModesChanged();
void inputMethodHintsChanged( Qt::InputMethodHints ); void inputMethodHintsChanged( Qt::InputMethodHints );
void fontRoleChanged(); void fontRoleChanged( const QskFontRole& );
void textColorChanged( const QColor& );
void overwriteModeChanged( bool ); void overwriteModeChanged( bool );
void cursorPositionChanged( int ); void cursorPositionChanged( int );
void cursorVisibleChanged( bool ); void cursorVisibleChanged( bool );
@ -171,11 +185,9 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl
void textEdited( const QString& ); void textEdited( const QString& );
void preeditTextChanged(); void preeditTextChanged();
#if 1
void canUndoChanged( bool ); void canUndoChanged( bool );
void canRedoChanged( bool ); void canRedoChanged( bool );
void canPasteChanged( bool ); void canPasteChanged( bool );
#endif
protected: protected:
QskAbstractTextInput( QQuickItem* parent = nullptr ); QskAbstractTextInput( QQuickItem* parent = nullptr );