Skip to content

Commit

Permalink
input text: styling and small stuff
Browse files Browse the repository at this point in the history
Resolves uwerat#400
  • Loading branch information
peter-ha committed Oct 15, 2024
1 parent 39c6e8b commit fd94513
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions designsystems/material3/QskMaterial3TextInputSkinlet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ namespace
const auto iconMargins = input->marginHint( Q::LeadingIcon );

const auto x1 = iconMargins.left() - margins.left();
const auto r1 = x1 / panelRect.width();
auto r1 = x1 / panelRect.width();
r1 = qBound( 0.0, r1, 1.0 );

const auto w = qskHorizontalAdvance( input->effectiveFont( Q::LabelText ), input->labelText() );

const auto x2 = x1 + w + margins.right();
const auto r2 = x2 / panelRect.width();
auto r2 = x2 / panelRect.width();
r2 = qBound( 0.0, r2, 1.0 );

topGradient.setStops( {
{ 0.0, topGradient.startColor() },
Expand Down
8 changes: 5 additions & 3 deletions src/controls/QskTextInput.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ class QSK_EXPORT QskTextInput : public QskControl
{
Q_OBJECT

Q_PROPERTY( QString inputText READ inputText WRITE setInputText NOTIFY inputTextChanged USER true )
Q_PROPERTY( QString inputText READ inputText
WRITE setInputText NOTIFY inputTextChanged USER true )

Q_PROPERTY( QString labelText READ labelText WRITE setLabelText NOTIFY labelTextChanged )
Q_PROPERTY( QString labelText READ labelText
WRITE setLabelText NOTIFY labelTextChanged )

Q_PROPERTY( QString hintText READ hintText
WRITE setHintText NOTIFY hintTextChanged )
Expand Down Expand Up @@ -99,7 +101,7 @@ class QSK_EXPORT QskTextInput : public QskControl
Q_ENUM( EchoMode )

QskTextInput( QQuickItem* parent = nullptr );
QskTextInput( const QString&, QQuickItem* parent = nullptr ); // ### do we need this constructor?
QskTextInput( const QString&, QQuickItem* parent = nullptr );

~QskTextInput() override;

Expand Down

0 comments on commit fd94513

Please sign in to comment.