diff --git a/src/controls/QskTextInput.cpp b/src/controls/QskTextInput.cpp index a5daf338..3ebbff78 100644 --- a/src/controls/QskTextInput.cpp +++ b/src/controls/QskTextInput.cpp @@ -290,6 +290,7 @@ class QskTextInput::PrivateData QString description; // f.e. used as prompt in QskInputPanel unsigned int activationModes : 3; + bool hasPanel : 1; }; QskTextInput::QskTextInput( QQuickItem* parent ) @@ -297,6 +298,7 @@ QskTextInput::QskTextInput( QQuickItem* parent ) , m_data( new PrivateData() ) { m_data->activationModes = ActivationOnMouse | ActivationOnKey; + m_data->hasPanel = true; setPolishOnResize( true ); setFocusPolicy( Qt::StrongFocus ); @@ -329,6 +331,23 @@ QskTextInput::~QskTextInput() { } +void QskTextInput::setPanel( bool on ) +{ + if ( on != m_data->hasPanel ) + { + m_data->hasPanel = on; + + resetImplicitSize(); + polish(); + update(); + } +} + +bool QskTextInput::hasPanel() const +{ + return m_data->hasPanel; +} + bool QskTextInput::event( QEvent* event ) { if ( event->type() == QEvent::ShortcutOverride ) @@ -473,8 +492,11 @@ QSizeF QskTextInput::layoutSizeHint( Qt::SizeHint which, const QSizeF& ) const QSizeF hint( input->implicitWidth(), input->implicitHeight() ); - hint = outerBoxSize( Panel, hint ); - hint = hint.expandedTo( strutSizeHint( Panel ) ); + if ( m_data->hasPanel ) + { + hint = outerBoxSize( Panel, hint ); + hint = hint.expandedTo( strutSizeHint( Panel ) ); + } return hint; } diff --git a/src/controls/QskTextInput.h b/src/controls/QskTextInput.h index 0ee9eb40..98f9ea63 100644 --- a/src/controls/QskTextInput.h +++ b/src/controls/QskTextInput.h @@ -44,6 +44,9 @@ class QSK_EXPORT QskTextInput : public QskControl WRITE setPasswordMaskDelay RESET resetPasswordMaskDelay NOTIFY passwordMaskDelayChanged ) + Q_PROPERTY( bool panel READ hasPanel + WRITE setPanel NOTIFY panelChanged FINAL ) + using Inherited = QskControl; public: @@ -87,6 +90,9 @@ class QSK_EXPORT QskTextInput : public QskControl void setDescription( const QString& ); QString description() const; + void setPanel( bool ); + bool hasPanel() const; + void setFontRole( int role ); void resetFontRole(); int fontRole() const; @@ -159,6 +165,7 @@ class QSK_EXPORT QskTextInput : public QskControl void activationModesChanged(); void readOnlyChanged( bool ); + void panelChanged( bool ); void textChanged( const QString& ); void displayTextChanged( const QString& ); diff --git a/src/controls/QskTextInputSkinlet.cpp b/src/controls/QskTextInputSkinlet.cpp index 15427718..6be2cd05 100644 --- a/src/controls/QskTextInputSkinlet.cpp +++ b/src/controls/QskTextInputSkinlet.cpp @@ -38,6 +38,10 @@ QSGNode* QskTextInputSkinlet::updateSubNode( { case PanelRole: { + const auto input = static_cast< const QskTextInput* >( skinnable ); + if ( !input->hasPanel() ) + return nullptr; + return updateBoxNode( skinnable, node, QskTextInput::Panel ); } }