QskTextInput renamed to QskTextField ( term used by F2/M3 and QC2 )
This commit is contained in:
parent
b0864965a8
commit
108aa23397
@ -78,7 +78,7 @@
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -296,8 +296,8 @@ namespace
|
||||
void setupTabViewMetrics();
|
||||
void setupTabViewColors( QskAspect::Section, const QskFluent2Theme& );
|
||||
|
||||
void setupTextInputMetrics();
|
||||
void setupTextInputColors( QskAspect::Section, const QskFluent2Theme& );
|
||||
void setupTextFieldMetrics();
|
||||
void setupTextFieldColors( QskAspect::Section, const QskFluent2Theme& );
|
||||
|
||||
void setupTextLabelMetrics();
|
||||
void setupTextLabelColors( QskAspect::Section, const QskFluent2Theme& );
|
||||
@ -355,7 +355,7 @@ void Editor::setupMetrics()
|
||||
setupTabButtonMetrics();
|
||||
setupTabBarMetrics();
|
||||
setupTabViewMetrics();
|
||||
setupTextInputMetrics();
|
||||
setupTextFieldMetrics();
|
||||
setupTextLabelMetrics();
|
||||
setupVirtualKeyboardMetrics();
|
||||
}
|
||||
@ -394,7 +394,7 @@ void Editor::setupColors( QskAspect::Section section, const QskFluent2Theme& the
|
||||
setupTabButtonColors( section, theme );
|
||||
setupTabBarColors( section, theme );
|
||||
setupTabViewColors( section, theme );
|
||||
setupTextInputColors( section, theme );
|
||||
setupTextFieldColors( section, theme );
|
||||
setupTextLabelColors( section, theme );
|
||||
setupVirtualKeyboardColors( section, theme );
|
||||
};
|
||||
@ -1771,9 +1771,9 @@ void Editor::setupTextLabelColors(
|
||||
setColor( Q::Text | section, pal.fillColor.text.primary );
|
||||
}
|
||||
|
||||
void Editor::setupTextInputMetrics()
|
||||
void Editor::setupTextFieldMetrics()
|
||||
{
|
||||
using Q = QskTextInput;
|
||||
using Q = QskTextField;
|
||||
|
||||
setStrutSize( Q::Panel, { -1, 30_px } );
|
||||
setPadding( Q::Panel, { 11_px, 0, 11_px, 0 } );
|
||||
@ -1788,10 +1788,10 @@ void Editor::setupTextInputMetrics()
|
||||
setFontRole( Q::Text, Fluent2::Body );
|
||||
}
|
||||
|
||||
void Editor::setupTextInputColors(
|
||||
void Editor::setupTextFieldColors(
|
||||
QskAspect::Section section, const QskFluent2Theme& theme )
|
||||
{
|
||||
using Q = QskTextInput;
|
||||
using Q = QskTextField;
|
||||
using A = QskAspect;
|
||||
|
||||
const auto& pal = theme.palette;
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -141,7 +141,7 @@ namespace
|
||||
Q_INVOKABLE void setupTabButton();
|
||||
Q_INVOKABLE void setupTabBar();
|
||||
Q_INVOKABLE void setupTabView();
|
||||
Q_INVOKABLE void setupTextInput();
|
||||
Q_INVOKABLE void setupTextField();
|
||||
Q_INVOKABLE void setupTextLabel();
|
||||
|
||||
QskGraphic symbol( const char* name ) const
|
||||
@ -382,9 +382,9 @@ void Editor::setupTextLabel()
|
||||
setBoxBorderColors( Q::Panel, QskRgb::lighter( m_pal.outline, 108 ) );
|
||||
}
|
||||
|
||||
void Editor::setupTextInput()
|
||||
void Editor::setupTextField()
|
||||
{
|
||||
using Q = QskTextInput;
|
||||
using Q = QskTextField;
|
||||
using A = QskAspect;
|
||||
using P = QPalette;
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <QskTabBar.h>
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -200,7 +200,7 @@ namespace
|
||||
Q_INVOKABLE void setupTabButton();
|
||||
Q_INVOKABLE void setupTabBar();
|
||||
Q_INVOKABLE void setupTabView();
|
||||
Q_INVOKABLE void setupTextInput();
|
||||
Q_INVOKABLE void setupTextField();
|
||||
Q_INVOKABLE void setupTextLabel();
|
||||
|
||||
QskGraphic symbol( const char* name ) const
|
||||
@ -450,9 +450,9 @@ void Editor::setupTextLabel()
|
||||
}
|
||||
|
||||
|
||||
void Editor::setupTextInput()
|
||||
void Editor::setupTextField()
|
||||
{
|
||||
using Q = QskTextInput;
|
||||
using Q = QskTextField;
|
||||
|
||||
setStrutSize( Q::Panel, -1.0, 56_dp );
|
||||
setPadding( Q::Panel, { 12_dp, 8_dp, 12_dp, 8_dp } );
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include <QskGridBox.h>
|
||||
#include <QskSlider.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskSpinBox.h>
|
||||
|
||||
namespace
|
||||
@ -70,21 +70,21 @@ namespace
|
||||
setSpacing( 20 );
|
||||
|
||||
{
|
||||
new QskTextInput( "Edit Me", this );
|
||||
new QskTextField( "Edit Me", this );
|
||||
}
|
||||
|
||||
{
|
||||
auto input = new QskTextInput( "Only Read Me", this );
|
||||
input->setReadOnly( true );
|
||||
input->setSizePolicy( Qt::Horizontal, QskSizePolicy::MinimumExpanding );
|
||||
auto textField = new QskTextField( "Only Read Me", this );
|
||||
textField->setReadOnly( true );
|
||||
textField->setSizePolicy( Qt::Horizontal, QskSizePolicy::MinimumExpanding );
|
||||
}
|
||||
|
||||
{
|
||||
auto input = new QskTextInput( "12345", this );
|
||||
input->setMaxLength( 5 );
|
||||
input->setEchoMode( QskTextInput::PasswordEchoOnEdit );
|
||||
auto textField = new QskTextField( "12345", this );
|
||||
textField->setMaxLength( 5 );
|
||||
textField->setEchoMode( QskTextField::PasswordEchoOnEdit );
|
||||
#if 1
|
||||
input->setFixedWidth( 80 );
|
||||
textField->setFixedWidth( 80 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <QskGradient.h>
|
||||
#include <QskGradientDirection.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskWindow.h>
|
||||
#include <QskRgbValue.h>
|
||||
@ -50,14 +50,14 @@ namespace
|
||||
{
|
||||
new QskTextLabel( label, this );
|
||||
|
||||
m_input = new QskTextInput( this );
|
||||
m_input->setValidator( new InputValidator( m_input ) );
|
||||
m_input->setText( QString::number( value ) );
|
||||
m_textField = new QskTextField( this );
|
||||
m_textField->setValidator( new InputValidator( m_textField ) );
|
||||
m_textField->setText( QString::number( value ) );
|
||||
|
||||
const QFontMetricsF fm( m_input->font() );
|
||||
m_input->setFixedWidth( fm.horizontalAdvance( "-0.000" ) );
|
||||
const QFontMetricsF fm( m_textField->font() );
|
||||
m_textField->setFixedWidth( fm.horizontalAdvance( "-0.000" ) );
|
||||
|
||||
connect( m_input, &QskTextInput::editingChanged,
|
||||
connect( m_textField, &QskTextField::editingChanged,
|
||||
this, [ this ]( bool on ) { if ( !on ) Q_EMIT valueChanged(); } );
|
||||
|
||||
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
@ -65,14 +65,14 @@ namespace
|
||||
|
||||
qreal value() const
|
||||
{
|
||||
return m_input->text().toDouble();
|
||||
return m_textField->text().toDouble();
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged();
|
||||
|
||||
private:
|
||||
QskTextInput* m_input;
|
||||
QskTextField* m_textField;
|
||||
};
|
||||
|
||||
class VectorBox : public QskLinearBox
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <QskInputPanel.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskListView.h>
|
||||
#include <QskTextInput.h>
|
||||
#include <QskTextField.h>
|
||||
|
||||
#include <QskAspect.h>
|
||||
#include <QskFunctions.h>
|
||||
@ -201,26 +201,26 @@ class InputBox : public QskLinearBox
|
||||
setMargins( 10 );
|
||||
setSpacing( 10 );
|
||||
|
||||
auto* textInput1 = new QskTextInput( this );
|
||||
textInput1->setText( "Press and edit Me." );
|
||||
textInput1->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
auto* textField1 = new QskTextField( this );
|
||||
textField1->setText( "Press and edit Me." );
|
||||
textField1->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
|
||||
auto* textInput2 = new QskTextInput( this );
|
||||
textInput2->setText( "Press and edit Me." );
|
||||
textInput2->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
textInput2->setActivationModes( QskTextInput::ActivationOnAll );
|
||||
auto* textField2 = new QskTextField( this );
|
||||
textField2->setText( "Press and edit Me." );
|
||||
textField2->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
textField2->setActivationModes( QskTextField::ActivationOnAll );
|
||||
|
||||
auto* textInput3 = new QskTextInput( this );
|
||||
textInput3->setReadOnly( true );
|
||||
textInput3->setText( "Read Only information." );
|
||||
textInput3->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
auto* textField3 = new QskTextField( this );
|
||||
textField3->setReadOnly( true );
|
||||
textField3->setText( "Read Only information." );
|
||||
textField3->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
|
||||
auto* textInput4 = new QskTextInput( this );
|
||||
textInput4->setEchoMode( QskTextInput::Password );
|
||||
textInput4->setPasswordMaskDelay( 1000 );
|
||||
textInput4->setMaxLength( 8 );
|
||||
textInput4->setText( "12345678" );
|
||||
textInput4->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
auto* textField4 = new QskTextField( this );
|
||||
textField4->setEchoMode( QskTextField::Password );
|
||||
textField4->setPasswordMaskDelay( 1000 );
|
||||
textField4->setMaxLength( 8 );
|
||||
textField4->setText( "12345678" );
|
||||
textField4->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -279,8 +279,8 @@ list(APPEND HEADERS
|
||||
controls/QskTabButtonSkinlet.h
|
||||
controls/QskTabView.h
|
||||
controls/QskTabViewSkinlet.h
|
||||
controls/QskTextInput.h
|
||||
controls/QskTextInputSkinlet.h
|
||||
controls/QskTextField.h
|
||||
controls/QskTextFieldSkinlet.h
|
||||
controls/QskTextLabel.h
|
||||
controls/QskTextLabelSkinlet.h
|
||||
controls/QskVariantAnimator.h
|
||||
@ -385,8 +385,8 @@ list(APPEND SOURCES
|
||||
controls/QskTabButtonSkinlet.cpp
|
||||
controls/QskTabView.cpp
|
||||
controls/QskTabViewSkinlet.cpp
|
||||
controls/QskTextInput.cpp
|
||||
controls/QskTextInputSkinlet.cpp
|
||||
controls/QskTextField.cpp
|
||||
controls/QskTextFieldSkinlet.cpp
|
||||
controls/QskTextLabel.cpp
|
||||
controls/QskTextLabelSkinlet.cpp
|
||||
controls/QskVariantAnimator.cpp
|
||||
|
@ -100,8 +100,8 @@
|
||||
#include "QskTextLabel.h"
|
||||
#include "QskTextLabelSkinlet.h"
|
||||
|
||||
#include "QskTextInput.h"
|
||||
#include "QskTextInputSkinlet.h"
|
||||
#include "QskTextField.h"
|
||||
#include "QskTextFieldSkinlet.h"
|
||||
|
||||
#include "QskStatusIndicator.h"
|
||||
#include "QskStatusIndicatorSkinlet.h"
|
||||
@ -205,7 +205,7 @@ QskSkin::QskSkin( QObject* parent )
|
||||
declareSkinlet< QskTabButton, QskTabButtonSkinlet >();
|
||||
declareSkinlet< QskTabView, QskTabViewSkinlet >();
|
||||
declareSkinlet< QskTextLabel, QskTextLabelSkinlet >();
|
||||
declareSkinlet< QskTextInput, QskTextInputSkinlet >();
|
||||
declareSkinlet< QskTextField, QskTextFieldSkinlet >();
|
||||
declareSkinlet< QskProgressBar, QskProgressBarSkinlet >();
|
||||
declareSkinlet< QskProgressRing, QskProgressRingSkinlet >();
|
||||
declareSkinlet< QskRadioBox, QskRadioBoxSkinlet >();
|
||||
|
@ -3,7 +3,7 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskTextInput.h"
|
||||
#include "QskTextField.h"
|
||||
#include "QskFontRole.h"
|
||||
#include "QskQuick.h"
|
||||
|
||||
@ -12,19 +12,19 @@ QSK_QT_PRIVATE_BEGIN
|
||||
#include <private/qquicktextinput_p_p.h>
|
||||
QSK_QT_PRIVATE_END
|
||||
|
||||
QSK_SUBCONTROL( QskTextInput, Panel )
|
||||
QSK_SUBCONTROL( QskTextInput, Text )
|
||||
QSK_SUBCONTROL( QskTextField, Panel )
|
||||
QSK_SUBCONTROL( QskTextField, Text )
|
||||
|
||||
#if 1
|
||||
// shouldn't this be a Selected state, TODO ...
|
||||
QSK_SUBCONTROL( QskTextInput, PanelSelected )
|
||||
QSK_SUBCONTROL( QskTextInput, TextSelected )
|
||||
QSK_SUBCONTROL( QskTextField, PanelSelected )
|
||||
QSK_SUBCONTROL( QskTextField, TextSelected )
|
||||
#endif
|
||||
|
||||
QSK_SYSTEM_STATE( QskTextInput, ReadOnly, QskAspect::FirstSystemState << 1 )
|
||||
QSK_SYSTEM_STATE( QskTextInput, Editing, QskAspect::FirstSystemState << 2 )
|
||||
QSK_SYSTEM_STATE( QskTextField, ReadOnly, QskAspect::FirstSystemState << 1 )
|
||||
QSK_SYSTEM_STATE( QskTextField, Editing, QskAspect::FirstSystemState << 2 )
|
||||
|
||||
static inline void qskPropagateReadOnly( QskTextInput* input )
|
||||
static inline void qskPropagateReadOnly( QskTextField* input )
|
||||
{
|
||||
Q_EMIT input->readOnlyChanged( input->isReadOnly() );
|
||||
|
||||
@ -33,49 +33,49 @@ static inline void qskPropagateReadOnly( QskTextInput* input )
|
||||
}
|
||||
|
||||
static inline void qskBindSignals(
|
||||
const QQuickTextInput* wrappedInput, QskTextInput* input )
|
||||
const QQuickTextInput* input, QskTextField* field )
|
||||
{
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::textChanged,
|
||||
input, [ input ] { Q_EMIT input->textChanged( input->text() ); } );
|
||||
QObject::connect( input, &QQuickTextInput::textChanged,
|
||||
field, [ field ] { Q_EMIT field->textChanged( field->text() ); } );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::displayTextChanged,
|
||||
input, [ input ] { Q_EMIT input->displayTextChanged( input->displayText() ); } );
|
||||
QObject::connect( input, &QQuickTextInput::displayTextChanged,
|
||||
field, [ field ] { Q_EMIT field->displayTextChanged( field->displayText() ); } );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::textEdited,
|
||||
input, [ input ] { Q_EMIT input->textEdited( input->text() ); } );
|
||||
QObject::connect( input, &QQuickTextInput::textEdited,
|
||||
field, [ field ] { Q_EMIT field->textEdited( field->text() ); } );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::validatorChanged,
|
||||
input, &QskTextInput::validatorChanged );
|
||||
QObject::connect( input, &QQuickTextInput::validatorChanged,
|
||||
field, &QskTextField::validatorChanged );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::inputMaskChanged,
|
||||
input, &QskTextInput::inputMaskChanged );
|
||||
QObject::connect( input, &QQuickTextInput::inputMaskChanged,
|
||||
field, &QskTextField::inputMaskChanged );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged,
|
||||
input, [ input ] { qskPropagateReadOnly( input ); } );
|
||||
QObject::connect( input, &QQuickTextInput::readOnlyChanged,
|
||||
field, [ field ] { qskPropagateReadOnly( field ); } );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged,
|
||||
input, &QskTextInput::overwriteModeChanged );
|
||||
QObject::connect( input, &QQuickTextInput::overwriteModeChanged,
|
||||
field, &QskTextField::overwriteModeChanged );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::maximumLengthChanged,
|
||||
input, &QskTextInput::maximumLengthChanged );
|
||||
QObject::connect( input, &QQuickTextInput::maximumLengthChanged,
|
||||
field, &QskTextField::maximumLengthChanged );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::wrapModeChanged,
|
||||
input, [ input ] { Q_EMIT input->wrapModeChanged( input->wrapMode() ); } );
|
||||
QObject::connect( input, &QQuickTextInput::wrapModeChanged,
|
||||
field, [ field ] { Q_EMIT field->wrapModeChanged( field->wrapMode() ); } );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::echoModeChanged,
|
||||
input, [ input ] { Q_EMIT input->echoModeChanged( input->echoMode() ); } );
|
||||
QObject::connect( input, &QQuickTextInput::echoModeChanged,
|
||||
field, [ field ] { Q_EMIT field->echoModeChanged( field->echoMode() ); } );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::passwordCharacterChanged,
|
||||
input, &QskTextInput::passwordCharacterChanged );
|
||||
QObject::connect( input, &QQuickTextInput::passwordCharacterChanged,
|
||||
field, &QskTextField::passwordCharacterChanged );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickTextInput::passwordMaskDelayChanged,
|
||||
input, &QskTextInput::passwordMaskDelayChanged );
|
||||
QObject::connect( input, &QQuickTextInput::passwordMaskDelayChanged,
|
||||
field, &QskTextField::passwordMaskDelayChanged );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickItem::implicitWidthChanged,
|
||||
input, &QskControl::resetImplicitSize );
|
||||
QObject::connect( input, &QQuickItem::implicitWidthChanged,
|
||||
field, &QskControl::resetImplicitSize );
|
||||
|
||||
QObject::connect( wrappedInput, &QQuickItem::implicitHeightChanged,
|
||||
input, &QskControl::resetImplicitSize );
|
||||
QObject::connect( input, &QQuickItem::implicitHeightChanged,
|
||||
field, &QskControl::resetImplicitSize );
|
||||
}
|
||||
|
||||
namespace
|
||||
@ -85,7 +85,7 @@ namespace
|
||||
using Inherited = QQuickTextInput;
|
||||
|
||||
public:
|
||||
TextInput( QskTextInput* );
|
||||
TextInput( QskTextField* );
|
||||
|
||||
void setEditing( bool on );
|
||||
|
||||
@ -200,8 +200,8 @@ namespace
|
||||
}
|
||||
};
|
||||
|
||||
TextInput::TextInput( QskTextInput* textInput )
|
||||
: QQuickTextInput( textInput )
|
||||
TextInput::TextInput( QskTextField* textField )
|
||||
: QQuickTextInput( textField )
|
||||
{
|
||||
classBegin();
|
||||
|
||||
@ -237,7 +237,7 @@ namespace
|
||||
|
||||
void TextInput::updateMetrics()
|
||||
{
|
||||
auto input = static_cast< const QskTextInput* >( parentItem() );
|
||||
auto input = static_cast< const QskTextField* >( parentItem() );
|
||||
|
||||
setAlignment( input->alignment() );
|
||||
setFont( input->font() );
|
||||
@ -245,14 +245,14 @@ namespace
|
||||
|
||||
void TextInput::updateColors()
|
||||
{
|
||||
auto input = static_cast< const QskTextInput* >( parentItem() );
|
||||
auto textField = static_cast< const QskTextField* >( parentItem() );
|
||||
auto d = QQuickTextInputPrivate::get( this );
|
||||
|
||||
bool isDirty = false;
|
||||
|
||||
QColor color;
|
||||
|
||||
color = input->color( QskTextInput::Text );
|
||||
color = textField->color( QskTextField::Text );
|
||||
if ( d->color != color )
|
||||
{
|
||||
d->color = color;
|
||||
@ -261,14 +261,14 @@ namespace
|
||||
|
||||
if ( d->hasSelectedText() )
|
||||
{
|
||||
color = input->color( QskTextInput::PanelSelected );
|
||||
color = textField->color( QskTextField::PanelSelected );
|
||||
if ( d->selectionColor != color )
|
||||
{
|
||||
d->selectionColor = color;
|
||||
isDirty = true;
|
||||
}
|
||||
|
||||
color = input->color( QskTextInput::TextSelected );
|
||||
color = textField->color( QskTextField::TextSelected );
|
||||
if ( d->selectedTextColor != color )
|
||||
{
|
||||
d->selectedTextColor = color;
|
||||
@ -285,7 +285,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
class QskTextInput::PrivateData
|
||||
class QskTextField::PrivateData
|
||||
{
|
||||
public:
|
||||
TextInput* textInput;
|
||||
@ -295,7 +295,7 @@ class QskTextInput::PrivateData
|
||||
bool hasPanel : 1;
|
||||
};
|
||||
|
||||
QskTextInput::QskTextInput( QQuickItem* parent )
|
||||
QskTextField::QskTextField( QQuickItem* parent )
|
||||
: Inherited( parent )
|
||||
, m_data( new PrivateData() )
|
||||
{
|
||||
@ -325,17 +325,17 @@ QskTextInput::QskTextInput( QQuickItem* parent )
|
||||
initSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Fixed );
|
||||
}
|
||||
|
||||
QskTextInput::QskTextInput( const QString& text, QQuickItem* parent )
|
||||
: QskTextInput( parent )
|
||||
QskTextField::QskTextField( const QString& text, QQuickItem* parent )
|
||||
: QskTextField( parent )
|
||||
{
|
||||
m_data->textInput->setText( text );
|
||||
}
|
||||
|
||||
QskTextInput::~QskTextInput()
|
||||
QskTextField::~QskTextField()
|
||||
{
|
||||
}
|
||||
|
||||
void QskTextInput::setPanel( bool on )
|
||||
void QskTextField::setPanel( bool on )
|
||||
{
|
||||
if ( on != m_data->hasPanel )
|
||||
{
|
||||
@ -347,12 +347,12 @@ void QskTextInput::setPanel( bool on )
|
||||
}
|
||||
}
|
||||
|
||||
bool QskTextInput::hasPanel() const
|
||||
bool QskTextField::hasPanel() const
|
||||
{
|
||||
return m_data->hasPanel;
|
||||
}
|
||||
|
||||
bool QskTextInput::event( QEvent* event )
|
||||
bool QskTextField::event( QEvent* event )
|
||||
{
|
||||
if ( event->type() == QEvent::ShortcutOverride )
|
||||
{
|
||||
@ -366,7 +366,7 @@ bool QskTextInput::event( QEvent* event )
|
||||
return Inherited::event( event );
|
||||
}
|
||||
|
||||
void QskTextInput::keyPressEvent( QKeyEvent* event )
|
||||
void QskTextField::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
if ( isEditing() )
|
||||
{
|
||||
@ -418,12 +418,12 @@ void QskTextInput::keyPressEvent( QKeyEvent* event )
|
||||
Inherited::keyPressEvent( event );
|
||||
}
|
||||
|
||||
void QskTextInput::keyReleaseEvent( QKeyEvent* event )
|
||||
void QskTextField::keyReleaseEvent( QKeyEvent* event )
|
||||
{
|
||||
Inherited::keyReleaseEvent( event );
|
||||
}
|
||||
|
||||
void QskTextInput::mousePressEvent( QMouseEvent* event )
|
||||
void QskTextField::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
m_data->textInput->handleEvent( event );
|
||||
|
||||
@ -431,12 +431,12 @@ void QskTextInput::mousePressEvent( QMouseEvent* event )
|
||||
setEditing( true );
|
||||
}
|
||||
|
||||
void QskTextInput::mouseMoveEvent( QMouseEvent* event )
|
||||
void QskTextField::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
m_data->textInput->handleEvent( event );
|
||||
}
|
||||
|
||||
void QskTextInput::mouseReleaseEvent( QMouseEvent* event )
|
||||
void QskTextField::mouseReleaseEvent( QMouseEvent* event )
|
||||
{
|
||||
m_data->textInput->handleEvent( event );
|
||||
|
||||
@ -444,17 +444,17 @@ void QskTextInput::mouseReleaseEvent( QMouseEvent* event )
|
||||
setEditing( true );
|
||||
}
|
||||
|
||||
void QskTextInput::mouseDoubleClickEvent( QMouseEvent* event )
|
||||
void QskTextField::mouseDoubleClickEvent( QMouseEvent* event )
|
||||
{
|
||||
m_data->textInput->handleEvent( event );
|
||||
}
|
||||
|
||||
void QskTextInput::inputMethodEvent( QInputMethodEvent* event )
|
||||
void QskTextField::inputMethodEvent( QInputMethodEvent* event )
|
||||
{
|
||||
m_data->textInput->handleEvent( event );
|
||||
}
|
||||
|
||||
void QskTextInput::focusInEvent( QFocusEvent* event )
|
||||
void QskTextField::focusInEvent( QFocusEvent* event )
|
||||
{
|
||||
if ( m_data->activationModes & ActivationOnFocus )
|
||||
{
|
||||
@ -475,7 +475,7 @@ void QskTextInput::focusInEvent( QFocusEvent* event )
|
||||
Inherited::focusInEvent( event );
|
||||
}
|
||||
|
||||
void QskTextInput::focusOutEvent( QFocusEvent* event )
|
||||
void QskTextField::focusOutEvent( QFocusEvent* event )
|
||||
{
|
||||
switch ( event->reason() )
|
||||
{
|
||||
@ -494,7 +494,7 @@ void QskTextInput::focusOutEvent( QFocusEvent* event )
|
||||
Inherited::focusOutEvent( event );
|
||||
}
|
||||
|
||||
QSizeF QskTextInput::layoutSizeHint( Qt::SizeHint which, const QSizeF& ) const
|
||||
QSizeF QskTextField::layoutSizeHint( Qt::SizeHint which, const QSizeF& ) const
|
||||
{
|
||||
if ( which != Qt::PreferredSize )
|
||||
return QSizeF();
|
||||
@ -514,7 +514,7 @@ QSizeF QskTextInput::layoutSizeHint( Qt::SizeHint which, const QSizeF& ) const
|
||||
return hint;
|
||||
}
|
||||
|
||||
void QskTextInput::updateLayout()
|
||||
void QskTextField::updateLayout()
|
||||
{
|
||||
auto input = m_data->textInput;
|
||||
|
||||
@ -522,23 +522,23 @@ void QskTextInput::updateLayout()
|
||||
qskSetItemGeometry( input, subControlRect( Text ) );
|
||||
}
|
||||
|
||||
void QskTextInput::updateNode( QSGNode* node )
|
||||
void QskTextField::updateNode( QSGNode* node )
|
||||
{
|
||||
m_data->textInput->updateColors();
|
||||
Inherited::updateNode( node );
|
||||
}
|
||||
|
||||
QString QskTextInput::text() const
|
||||
QString QskTextField::text() const
|
||||
{
|
||||
return m_data->textInput->text();
|
||||
}
|
||||
|
||||
void QskTextInput::setText( const QString& text )
|
||||
void QskTextField::setText( const QString& text )
|
||||
{
|
||||
m_data->textInput->setText( text );
|
||||
}
|
||||
|
||||
void QskTextInput::setDescription( const QString& text )
|
||||
void QskTextField::setDescription( const QString& text )
|
||||
{
|
||||
if ( m_data->description != text )
|
||||
{
|
||||
@ -547,17 +547,17 @@ void QskTextInput::setDescription( const QString& text )
|
||||
}
|
||||
}
|
||||
|
||||
QString QskTextInput::description() const
|
||||
QString QskTextField::description() const
|
||||
{
|
||||
return m_data->description;
|
||||
}
|
||||
|
||||
QskTextInput::ActivationModes QskTextInput::activationModes() const
|
||||
QskTextField::ActivationModes QskTextField::activationModes() const
|
||||
{
|
||||
return static_cast< QskTextInput::ActivationModes >( m_data->activationModes );
|
||||
return static_cast< QskTextField::ActivationModes >( m_data->activationModes );
|
||||
}
|
||||
|
||||
void QskTextInput::setActivationModes( ActivationModes modes )
|
||||
void QskTextField::setActivationModes( ActivationModes modes )
|
||||
{
|
||||
if ( static_cast< ActivationModes >( m_data->activationModes ) != modes )
|
||||
{
|
||||
@ -566,13 +566,13 @@ void QskTextInput::setActivationModes( ActivationModes modes )
|
||||
}
|
||||
}
|
||||
|
||||
static inline void qskUpdateInputMethodFont( const QskTextInput* input )
|
||||
static inline void qskUpdateInputMethodFont( const QskTextField* input )
|
||||
{
|
||||
const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle;
|
||||
qskUpdateInputMethod( input, queries );
|
||||
}
|
||||
|
||||
void QskTextInput::setFontRole( const QskFontRole& role )
|
||||
void QskTextField::setFontRole( const QskFontRole& role )
|
||||
{
|
||||
if ( setFontRoleHint( Text, role ) )
|
||||
{
|
||||
@ -581,7 +581,7 @@ void QskTextInput::setFontRole( const QskFontRole& role )
|
||||
}
|
||||
}
|
||||
|
||||
void QskTextInput::resetFontRole()
|
||||
void QskTextField::resetFontRole()
|
||||
{
|
||||
if ( resetFontRoleHint( Text ) )
|
||||
{
|
||||
@ -590,12 +590,12 @@ void QskTextInput::resetFontRole()
|
||||
}
|
||||
}
|
||||
|
||||
QskFontRole QskTextInput::fontRole() const
|
||||
QskFontRole QskTextField::fontRole() const
|
||||
{
|
||||
return fontRoleHint( Text );
|
||||
}
|
||||
|
||||
void QskTextInput::setAlignment( Qt::Alignment alignment )
|
||||
void QskTextField::setAlignment( Qt::Alignment alignment )
|
||||
{
|
||||
if ( setAlignmentHint( Text, alignment ) )
|
||||
{
|
||||
@ -604,7 +604,7 @@ void QskTextInput::setAlignment( Qt::Alignment alignment )
|
||||
}
|
||||
}
|
||||
|
||||
void QskTextInput::resetAlignment()
|
||||
void QskTextField::resetAlignment()
|
||||
{
|
||||
if ( resetAlignmentHint( Text ) )
|
||||
{
|
||||
@ -613,34 +613,34 @@ void QskTextInput::resetAlignment()
|
||||
}
|
||||
}
|
||||
|
||||
Qt::Alignment QskTextInput::alignment() const
|
||||
Qt::Alignment QskTextField::alignment() const
|
||||
{
|
||||
return alignmentHint( Text, Qt::AlignLeft | Qt::AlignTop );
|
||||
}
|
||||
|
||||
void QskTextInput::setWrapMode( QskTextOptions::WrapMode wrapMode )
|
||||
void QskTextField::setWrapMode( QskTextOptions::WrapMode wrapMode )
|
||||
{
|
||||
m_data->textInput->setWrapMode(
|
||||
static_cast< QQuickTextInput::WrapMode >( wrapMode ) );
|
||||
}
|
||||
|
||||
QskTextOptions::WrapMode QskTextInput::wrapMode() const
|
||||
QskTextOptions::WrapMode QskTextField::wrapMode() const
|
||||
{
|
||||
return static_cast< QskTextOptions::WrapMode >(
|
||||
m_data->textInput->wrapMode() );
|
||||
}
|
||||
|
||||
QFont QskTextInput::font() const
|
||||
QFont QskTextField::font() const
|
||||
{
|
||||
return effectiveFont( QskTextInput::Text );
|
||||
return effectiveFont( QskTextField::Text );
|
||||
}
|
||||
|
||||
bool QskTextInput::isReadOnly() const
|
||||
bool QskTextField::isReadOnly() const
|
||||
{
|
||||
return m_data->textInput->isReadOnly();
|
||||
}
|
||||
|
||||
void QskTextInput::setReadOnly( bool on )
|
||||
void QskTextField::setReadOnly( bool on )
|
||||
{
|
||||
auto input = m_data->textInput;
|
||||
|
||||
@ -661,7 +661,7 @@ void QskTextInput::setReadOnly( bool on )
|
||||
setSkinStateFlag( ReadOnly, on );
|
||||
}
|
||||
|
||||
void QskTextInput::setEditing( bool on )
|
||||
void QskTextField::setEditing( bool on )
|
||||
{
|
||||
if ( isReadOnly() || on == isEditing() )
|
||||
return;
|
||||
@ -691,63 +691,63 @@ void QskTextInput::setEditing( bool on )
|
||||
Q_EMIT editingChanged( on );
|
||||
}
|
||||
|
||||
bool QskTextInput::isEditing() const
|
||||
bool QskTextField::isEditing() const
|
||||
{
|
||||
return hasSkinState( Editing );
|
||||
}
|
||||
|
||||
void QskTextInput::ensureVisible( int position )
|
||||
void QskTextField::ensureVisible( int position )
|
||||
{
|
||||
m_data->textInput->ensureVisible( position );
|
||||
}
|
||||
|
||||
int QskTextInput::cursorPosition() const
|
||||
int QskTextField::cursorPosition() const
|
||||
{
|
||||
return m_data->textInput->cursorPosition();
|
||||
}
|
||||
|
||||
void QskTextInput::setCursorPosition( int pos )
|
||||
void QskTextField::setCursorPosition( int pos )
|
||||
{
|
||||
m_data->textInput->setCursorPosition( pos );
|
||||
}
|
||||
|
||||
int QskTextInput::maxLength() const
|
||||
int QskTextField::maxLength() const
|
||||
{
|
||||
return m_data->textInput->maxLength();
|
||||
}
|
||||
|
||||
void QskTextInput::setMaxLength( int length )
|
||||
void QskTextField::setMaxLength( int length )
|
||||
{
|
||||
m_data->textInput->setMaxLength( length );
|
||||
}
|
||||
|
||||
QValidator* QskTextInput::validator() const
|
||||
QValidator* QskTextField::validator() const
|
||||
{
|
||||
return m_data->textInput->validator();
|
||||
}
|
||||
|
||||
void QskTextInput::setValidator( QValidator* validator )
|
||||
void QskTextField::setValidator( QValidator* validator )
|
||||
{
|
||||
m_data->textInput->setValidator( validator );
|
||||
}
|
||||
|
||||
QString QskTextInput::inputMask() const
|
||||
QString QskTextField::inputMask() const
|
||||
{
|
||||
return m_data->textInput->inputMask();
|
||||
}
|
||||
|
||||
void QskTextInput::setInputMask( const QString& mask )
|
||||
void QskTextField::setInputMask( const QString& mask )
|
||||
{
|
||||
m_data->textInput->setInputMask( mask );
|
||||
}
|
||||
|
||||
QskTextInput::EchoMode QskTextInput::echoMode() const
|
||||
QskTextField::EchoMode QskTextField::echoMode() const
|
||||
{
|
||||
const auto mode = m_data->textInput->echoMode();
|
||||
return static_cast< QskTextInput::EchoMode >( mode );
|
||||
return static_cast< QskTextField::EchoMode >( mode );
|
||||
}
|
||||
|
||||
void QskTextInput::setEchoMode( EchoMode mode )
|
||||
void QskTextField::setEchoMode( EchoMode mode )
|
||||
{
|
||||
if ( mode != echoMode() )
|
||||
{
|
||||
@ -758,75 +758,75 @@ void QskTextInput::setEchoMode( EchoMode mode )
|
||||
}
|
||||
}
|
||||
|
||||
QString QskTextInput::passwordCharacter() const
|
||||
QString QskTextField::passwordCharacter() const
|
||||
{
|
||||
return m_data->textInput->passwordCharacter();
|
||||
}
|
||||
|
||||
void QskTextInput::setPasswordCharacter( const QString& text )
|
||||
void QskTextField::setPasswordCharacter( const QString& text )
|
||||
{
|
||||
m_data->textInput->setPasswordCharacter( text );
|
||||
}
|
||||
|
||||
void QskTextInput::resetPasswordCharacter()
|
||||
void QskTextField::resetPasswordCharacter()
|
||||
{
|
||||
m_data->textInput->setPasswordCharacter(
|
||||
QGuiApplication::styleHints()->passwordMaskCharacter() );
|
||||
}
|
||||
|
||||
int QskTextInput::passwordMaskDelay() const
|
||||
int QskTextField::passwordMaskDelay() const
|
||||
{
|
||||
return m_data->textInput->passwordMaskDelay();
|
||||
}
|
||||
|
||||
void QskTextInput::setPasswordMaskDelay( int ms )
|
||||
void QskTextField::setPasswordMaskDelay( int ms )
|
||||
{
|
||||
m_data->textInput->setPasswordMaskDelay( ms );
|
||||
}
|
||||
|
||||
void QskTextInput::resetPasswordMaskDelay()
|
||||
void QskTextField::resetPasswordMaskDelay()
|
||||
{
|
||||
m_data->textInput->resetPasswordMaskDelay();
|
||||
}
|
||||
|
||||
QString QskTextInput::displayText() const
|
||||
QString QskTextField::displayText() const
|
||||
{
|
||||
return m_data->textInput->displayText();
|
||||
}
|
||||
|
||||
QString QskTextInput::preeditText() const
|
||||
QString QskTextField::preeditText() const
|
||||
{
|
||||
const auto d = QQuickTextInputPrivate::get( m_data->textInput );
|
||||
return d->m_textLayout.preeditAreaText();
|
||||
}
|
||||
|
||||
bool QskTextInput::overwriteMode() const
|
||||
bool QskTextField::overwriteMode() const
|
||||
{
|
||||
return m_data->textInput->overwriteMode();
|
||||
}
|
||||
|
||||
void QskTextInput::setOverwriteMode( bool overwrite )
|
||||
void QskTextField::setOverwriteMode( bool overwrite )
|
||||
{
|
||||
m_data->textInput->setOverwriteMode( overwrite );
|
||||
}
|
||||
|
||||
bool QskTextInput::hasAcceptableInput() const
|
||||
bool QskTextField::hasAcceptableInput() const
|
||||
{
|
||||
return m_data->textInput->hasAcceptableInput();
|
||||
}
|
||||
|
||||
bool QskTextInput::fixup()
|
||||
bool QskTextField::fixup()
|
||||
{
|
||||
return m_data->textInput->fixup();
|
||||
}
|
||||
|
||||
QVariant QskTextInput::inputMethodQuery(
|
||||
QVariant QskTextField::inputMethodQuery(
|
||||
Qt::InputMethodQuery property ) const
|
||||
{
|
||||
return inputMethodQuery( property, QVariant() );
|
||||
}
|
||||
|
||||
QVariant QskTextInput::inputMethodQuery(
|
||||
QVariant QskTextField::inputMethodQuery(
|
||||
Qt::InputMethodQuery query, const QVariant& argument ) const
|
||||
{
|
||||
switch ( query )
|
||||
@ -860,22 +860,22 @@ QVariant QskTextInput::inputMethodQuery(
|
||||
}
|
||||
}
|
||||
|
||||
bool QskTextInput::canUndo() const
|
||||
bool QskTextField::canUndo() const
|
||||
{
|
||||
return m_data->textInput->canUndo();
|
||||
}
|
||||
|
||||
bool QskTextInput::canRedo() const
|
||||
bool QskTextField::canRedo() const
|
||||
{
|
||||
return m_data->textInput->canRedo();
|
||||
}
|
||||
|
||||
Qt::InputMethodHints QskTextInput::inputMethodHints() const
|
||||
Qt::InputMethodHints QskTextField::inputMethodHints() const
|
||||
{
|
||||
return m_data->textInput->inputMethodHints();
|
||||
}
|
||||
|
||||
void QskTextInput::setInputMethodHints( Qt::InputMethodHints hints )
|
||||
void QskTextField::setInputMethodHints( Qt::InputMethodHints hints )
|
||||
{
|
||||
if ( m_data->textInput->inputMethodHints() != hints )
|
||||
{
|
||||
@ -884,7 +884,7 @@ void QskTextInput::setInputMethodHints( Qt::InputMethodHints hints )
|
||||
}
|
||||
}
|
||||
|
||||
void QskTextInput::setupFrom( const QQuickItem* item )
|
||||
void QskTextField::setupFrom( const QQuickItem* item )
|
||||
{
|
||||
if ( item == nullptr )
|
||||
return;
|
||||
@ -892,7 +892,7 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||
// finding attributes from the input hints of item
|
||||
|
||||
int maxCharacters = 32767;
|
||||
QskTextInput::EchoMode echoMode = QskTextInput::Normal;
|
||||
QskTextField::EchoMode echoMode = QskTextField::Normal;
|
||||
|
||||
Qt::InputMethodQueries queries = Qt::ImQueryAll;
|
||||
queries &= ~Qt::ImEnabled;
|
||||
@ -906,7 +906,7 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||
event.value( Qt::ImHints ).toInt() );
|
||||
|
||||
if ( hints & Qt::ImhHiddenText )
|
||||
echoMode = QskTextInput::NoEcho;
|
||||
echoMode = QskTextField::NoEcho;
|
||||
}
|
||||
|
||||
if ( event.queries() & Qt::ImMaximumTextLength )
|
||||
@ -944,7 +944,7 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||
int passwordMaskDelay = -1;
|
||||
QString passwordCharacter;
|
||||
|
||||
if ( echoMode == QskTextInput::NoEcho )
|
||||
if ( echoMode == QskTextField::NoEcho )
|
||||
{
|
||||
/*
|
||||
Qt::ImhHiddenText does not provide information
|
||||
@ -967,8 +967,8 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||
if ( value.canConvert< int >() )
|
||||
{
|
||||
const auto mode = value.toInt();
|
||||
if ( mode == QskTextInput::Password )
|
||||
echoMode = QskTextInput::Password;
|
||||
if ( mode == QskTextField::Password )
|
||||
echoMode = QskTextField::Password;
|
||||
}
|
||||
}
|
||||
|
||||
@ -985,4 +985,4 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||
setEchoMode( echoMode );
|
||||
}
|
||||
|
||||
#include "moc_QskTextInput.cpp"
|
||||
#include "moc_QskTextField.cpp"
|
@ -3,8 +3,8 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_TEXT_INPUT_H
|
||||
#define QSK_TEXT_INPUT_H
|
||||
#ifndef QSK_TEXT_FIELD_H
|
||||
#define QSK_TEXT_FIELD_H
|
||||
|
||||
#include "QskControl.h"
|
||||
#include "QskTextOptions.h"
|
||||
@ -12,7 +12,7 @@
|
||||
class QValidator;
|
||||
class QskFontRole;
|
||||
|
||||
class QSK_EXPORT QskTextInput : public QskControl
|
||||
class QSK_EXPORT QskTextField : public QskControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -83,10 +83,10 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||
|
||||
Q_ENUM( EchoMode )
|
||||
|
||||
QskTextInput( QQuickItem* parent = nullptr );
|
||||
QskTextInput( const QString& text, QQuickItem* parent = nullptr );
|
||||
QskTextField( QQuickItem* parent = nullptr );
|
||||
QskTextField( const QString& text, QQuickItem* parent = nullptr );
|
||||
|
||||
~QskTextInput() override;
|
||||
~QskTextField() override;
|
||||
|
||||
void setupFrom( const QQuickItem* );
|
||||
|
||||
@ -219,7 +219,7 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||
std::unique_ptr< PrivateData > m_data;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QskTextInput::ActivationModes )
|
||||
Q_DECLARE_METATYPE( QskTextInput::ActivationModes )
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QskTextField::ActivationModes )
|
||||
Q_DECLARE_METATYPE( QskTextField::ActivationModes )
|
||||
|
||||
#endif
|
@ -3,50 +3,50 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskTextInputSkinlet.h"
|
||||
#include "QskTextInput.h"
|
||||
#include "QskTextFieldSkinlet.h"
|
||||
#include "QskTextField.h"
|
||||
|
||||
QskTextInputSkinlet::QskTextInputSkinlet( QskSkin* skin )
|
||||
QskTextFieldSkinlet::QskTextFieldSkinlet( QskSkin* skin )
|
||||
: Inherited( skin )
|
||||
{
|
||||
setNodeRoles( { PanelRole } );
|
||||
}
|
||||
|
||||
QskTextInputSkinlet::~QskTextInputSkinlet()
|
||||
QskTextFieldSkinlet::~QskTextFieldSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QskTextInputSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
QRectF QskTextFieldSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
if ( subControl == QskTextInput::Panel )
|
||||
if ( subControl == QskTextField::Panel )
|
||||
{
|
||||
return contentsRect;
|
||||
}
|
||||
else if ( subControl == QskTextInput::Text )
|
||||
else if ( subControl == QskTextField::Text )
|
||||
{
|
||||
return skinnable->subControlContentsRect( contentsRect, QskTextInput::Panel );
|
||||
return skinnable->subControlContentsRect( contentsRect, QskTextField::Panel );
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskTextInputSkinlet::updateSubNode(
|
||||
QSGNode* QskTextFieldSkinlet::updateSubNode(
|
||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
switch ( nodeRole )
|
||||
{
|
||||
case PanelRole:
|
||||
{
|
||||
const auto input = static_cast< const QskTextInput* >( skinnable );
|
||||
const auto input = static_cast< const QskTextField* >( skinnable );
|
||||
if ( !input->hasPanel() )
|
||||
return nullptr;
|
||||
|
||||
return updateBoxNode( skinnable, node, QskTextInput::Panel );
|
||||
return updateBoxNode( skinnable, node, QskTextField::Panel );
|
||||
}
|
||||
}
|
||||
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
#include "moc_QskTextInputSkinlet.cpp"
|
||||
#include "moc_QskTextFieldSkinlet.cpp"
|
@ -3,12 +3,12 @@
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_TEXT_INPUT_SKINLET_H
|
||||
#define QSK_TEXT_INPUT_SKINLET_H
|
||||
#ifndef QSK_TEXT_FIELD_SKINLET_H
|
||||
#define QSK_TEXT_FIELD_SKINLET_H
|
||||
|
||||
#include "QskSkinlet.h"
|
||||
|
||||
class QSK_EXPORT QskTextInputSkinlet : public QskSkinlet
|
||||
class QSK_EXPORT QskTextFieldSkinlet : public QskSkinlet
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
@ -21,8 +21,8 @@ class QSK_EXPORT QskTextInputSkinlet : public QskSkinlet
|
||||
RoleCount
|
||||
};
|
||||
|
||||
Q_INVOKABLE QskTextInputSkinlet( QskSkin* = nullptr );
|
||||
~QskTextInputSkinlet() override;
|
||||
Q_INVOKABLE QskTextFieldSkinlet( QskSkin* = nullptr );
|
||||
~QskTextFieldSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
@ -6,7 +6,7 @@
|
||||
#include "QskInputPanelBox.h"
|
||||
#include "QskInputPredictionBar.h"
|
||||
#include "QskLinearBox.h"
|
||||
#include "QskTextInput.h"
|
||||
#include "QskTextField.h"
|
||||
#include "QskTextLabel.h"
|
||||
#include "QskVirtualKeyboard.h"
|
||||
|
||||
@ -15,11 +15,11 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
class TextInputProxy final : public QskTextInput
|
||||
class TextFieldProxy final : public QskTextField
|
||||
{
|
||||
public:
|
||||
TextInputProxy( QskInputPanelBox* panelBox, QQuickItem* parentItem = nullptr )
|
||||
: QskTextInput( parentItem )
|
||||
TextFieldProxy( QskInputPanelBox* panelBox, QQuickItem* parentItem = nullptr )
|
||||
: QskTextField( parentItem )
|
||||
, m_panelBox( panelBox )
|
||||
{
|
||||
setObjectName( QStringLiteral( "InputBoxProxy" ) );
|
||||
@ -32,10 +32,10 @@ namespace
|
||||
QskAspect::Subcontrol substitutedSubcontrol(
|
||||
QskAspect::Subcontrol subControl ) const override
|
||||
{
|
||||
if ( subControl == QskTextInput::Panel )
|
||||
if ( subControl == QskTextField::Panel )
|
||||
return m_panelBox->effectiveSubcontrol( QskInputPanelBox::ProxyPanel );
|
||||
|
||||
if ( subControl == QskTextInput::Text )
|
||||
if ( subControl == QskTextField::Text )
|
||||
return m_panelBox->effectiveSubcontrol( QskInputPanelBox::ProxyText );
|
||||
|
||||
return subControl;
|
||||
@ -65,7 +65,7 @@ class QskInputPanelBox::PrivateData
|
||||
|
||||
QskLinearBox* layout;
|
||||
QskTextLabel* prompt;
|
||||
TextInputProxy* inputProxy;
|
||||
TextFieldProxy* inputProxy;
|
||||
QskInputPredictionBar* predictionBar;
|
||||
QskVirtualKeyboard* keyboard;
|
||||
|
||||
@ -81,7 +81,7 @@ QskInputPanelBox::QskInputPanelBox( QQuickItem* parent )
|
||||
m_data->prompt = new QskTextLabel();
|
||||
m_data->prompt->setVisible( false );
|
||||
|
||||
m_data->inputProxy = new TextInputProxy( this, nullptr );
|
||||
m_data->inputProxy = new TextFieldProxy( this, nullptr );
|
||||
m_data->inputProxy->setVisible(
|
||||
m_data->panelHints & QskInputPanelBox::InputProxy );
|
||||
|
||||
@ -184,10 +184,10 @@ QskAspect::Subcontrol QskInputPanelBox::substitutedSubcontrol(
|
||||
#if 1
|
||||
// TODO ...
|
||||
if ( subControl == QskInputPanelBox::ProxyPanel )
|
||||
return QskTextInput::Panel;
|
||||
return QskTextField::Panel;
|
||||
|
||||
if ( subControl == QskInputPanelBox::ProxyText )
|
||||
return QskTextInput::Text;
|
||||
return QskTextField::Text;
|
||||
#endif
|
||||
|
||||
return subControl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user