diff --git a/src/controls/QskAbstractTextInput.cpp b/src/controls/QskAbstractTextInput.cpp index 9dfa1eb8..c4040ceb 100644 --- a/src/controls/QskAbstractTextInput.cpp +++ b/src/controls/QskAbstractTextInput.cpp @@ -178,12 +178,6 @@ void QskAbstractTextInput::setup( QQuickItem* wrappedInput ) the cursor using skin hints and/or creating the scene graph node from the skinlet. TODO ... - - colorChanged - - fontChanged - - Set from the skin hints - might be important enough to offer a - convenience API - - selectionColorChanged - selectedTextColorChanged @@ -285,35 +279,18 @@ QString QskAbstractTextInput::preeditText() const return INPUT_INVOKE( preeditText ); } -void QskAbstractTextInput::clear() -{ - INPUT_INVOKE( clear ); -} +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::selectAll() -{ - INPUT_INVOKE( selectAll ); -} - -void QskAbstractTextInput::deselect() -{ - INPUT_INVOKE( deselect ); -} - -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::clear() { INPUT_INVOKE( clear ); } +void QskAbstractTextInput::selectAll() { INPUT_INVOKE( selectAll ); } +void QskAbstractTextInput::deselect() { INPUT_INVOKE( deselect ); } +void QskAbstractTextInput::cut() { INPUT_INVOKE( cut ); } +void QskAbstractTextInput::copy() { INPUT_INVOKE( copy ); } +void QskAbstractTextInput::paste() { INPUT_INVOKE( paste ); } +void QskAbstractTextInput::undo() { INPUT_INVOKE( undo ); } +void QskAbstractTextInput::redo() { INPUT_INVOKE( redo ); } 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; 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; qskUpdateInputMethod( this, queries ); - Q_EMIT fontRoleChanged(); + Q_EMIT fontRoleChanged( fontRole() ); } } @@ -682,6 +659,23 @@ QSizeF QskAbstractTextInput::unwrappedTextSize() const 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 ) { if ( setAlignmentHint( Text, alignment ) ) diff --git a/src/controls/QskAbstractTextInput.h b/src/controls/QskAbstractTextInput.h index 34077f7c..6dad1534 100644 --- a/src/controls/QskAbstractTextInput.h +++ b/src/controls/QskAbstractTextInput.h @@ -38,6 +38,9 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl Q_PROPERTY( bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged ) + Q_PROPERTY( QColor textColor READ textColor + WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged ) + Q_PROPERTY( QskFontRole fontRole READ fontRole WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged ) @@ -115,6 +118,10 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl void setWrapMode( QskTextOptions::WrapMode ); QskTextOptions::WrapMode wrapMode() const; + void setTextColor( const QColor& ); + void resetTextColor(); + QColor textColor() const; + void setFontRole( const QskFontRole& role ); void resetFontRole(); QskFontRole fontRole() const; @@ -150,12 +157,19 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl void deselect(); void selectAll(); + void cut(); + void copy(); + void paste(); + void undo(); + void redo(); + Q_SIGNALS: void editingChanged( bool ); void readOnlyChanged( bool ); void activationModesChanged(); void inputMethodHintsChanged( Qt::InputMethodHints ); - void fontRoleChanged(); + void fontRoleChanged( const QskFontRole& ); + void textColorChanged( const QColor& ); void overwriteModeChanged( bool ); void cursorPositionChanged( int ); void cursorVisibleChanged( bool ); @@ -171,11 +185,9 @@ class QSK_EXPORT QskAbstractTextInput : public QskControl void textEdited( const QString& ); void preeditTextChanged(); -#if 1 void canUndoChanged( bool ); void canRedoChanged( bool ); void canPasteChanged( bool ); -#endif protected: QskAbstractTextInput( QQuickItem* parent = nullptr );