gallery updated, dummy TextFieldSkinlets introduced
This commit is contained in:
parent
e86378a072
commit
f0d53322aa
@ -3,13 +3,27 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
############################################################################
|
||||
|
||||
set(SOURCES
|
||||
QskFluent2Global.h
|
||||
QskFluent2Theme.h QskFluent2Theme.cpp
|
||||
QskFluent2Skin.h QskFluent2Skin.cpp
|
||||
QskFluent2SkinFactory.h QskFluent2SkinFactory.cpp
|
||||
list(APPEND HEADERS
|
||||
QskFluent2Global.h QskFluent2Theme.h QskFluent2SkinFactory.h
|
||||
)
|
||||
|
||||
list(APPEND PRIVATE_HEADERS
|
||||
QskFluent2TextFieldSkinlet.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES
|
||||
QskFluent2Theme.cpp
|
||||
QskFluent2Skin.cpp
|
||||
QskFluent2SkinFactory.cpp
|
||||
QskFluent2TextFieldSkinlet.cpp
|
||||
)
|
||||
|
||||
qt_add_resources(SOURCES QskFluent2Icons.qrc)
|
||||
|
||||
qsk_add_plugin(fluent2skin skins QskFluent2SkinFactory ${SOURCES})
|
||||
set_target_properties(fluent2skin PROPERTIES DEFINE_SYMBOL QSK_FLUENT2_MAKEDLL )
|
||||
qsk_add_plugin(fluent2skin skins QskFluent2SkinFactory
|
||||
${SOURCES} ${HEADERS} ${PRIVATE_HEADERS}
|
||||
)
|
||||
|
||||
set_target_properties(fluent2skin PROPERTIES
|
||||
DEFINE_SYMBOL QSK_FLUENT2_MAKEDLL
|
||||
)
|
||||
|
@ -47,6 +47,7 @@
|
||||
*/
|
||||
#include "QskFluent2Skin.h"
|
||||
#include "QskFluent2Theme.h"
|
||||
#include "QskFluent2TextFieldSkinlet.h"
|
||||
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
@ -79,7 +80,6 @@
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextFieldSkinlet.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -1787,6 +1787,9 @@ void Editor::setupTextFieldMetrics()
|
||||
|
||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
setFontRole( Q::Text, Fluent2::Body );
|
||||
|
||||
setAlignment( Q::PlaceholderText, alignment( Q::Text ) );
|
||||
setFontRole( Q::PlaceholderText, fontRole( Q::Text ) );
|
||||
}
|
||||
|
||||
void Editor::setupTextFieldColors(
|
||||
@ -1800,6 +1803,7 @@ void Editor::setupTextFieldColors(
|
||||
|
||||
setColor( Q::Panel | SK::Selected, pal.fillColor.accent.selectedTextBackground );
|
||||
setColor( Q::Text | SK::Selected, pal.fillColor.textOnAccent.selectedText );
|
||||
setColor( Q::PlaceholderText, pal.fillColor.text.secondary );
|
||||
|
||||
for( const auto state : { A::NoState, Q::Hovered, Q::Focused, Q::Editing, Q::Disabled } )
|
||||
{
|
||||
@ -1810,21 +1814,21 @@ void Editor::setupTextFieldColors(
|
||||
panelColor = pal.fillColor.control.defaultColor;
|
||||
borderColor1 = pal.elevation.textControl.border[0];
|
||||
borderColor2 = pal.elevation.textControl.border[1];
|
||||
textColor = pal.fillColor.text.secondary;
|
||||
textColor = pal.fillColor.text.primary;
|
||||
}
|
||||
else if ( state == Q::Hovered )
|
||||
{
|
||||
panelColor = pal.fillColor.control.secondary;
|
||||
borderColor1 = pal.elevation.textControl.border[0];
|
||||
borderColor2 = pal.elevation.textControl.border[1];
|
||||
textColor = pal.fillColor.text.secondary;
|
||||
textColor = pal.fillColor.text.primary;
|
||||
}
|
||||
else if ( ( state == Q::Focused ) || ( state == Q::Editing ) )
|
||||
{
|
||||
panelColor = pal.fillColor.control.inputActive;
|
||||
borderColor1 = pal.elevation.textControl.border[0];
|
||||
borderColor2 = pal.fillColor.accent.defaultColor;
|
||||
textColor = pal.fillColor.text.secondary;
|
||||
textColor = pal.fillColor.text.primary;
|
||||
}
|
||||
else if ( state == Q::Disabled )
|
||||
{
|
||||
@ -2029,6 +2033,8 @@ void Editor::setupVirtualKeyboardColors(
|
||||
QskFluent2Skin::QskFluent2Skin( QObject* parent )
|
||||
: Inherited( parent )
|
||||
{
|
||||
declareSkinlet< QskTextField, QskFluent2TextFieldSkinlet >();
|
||||
|
||||
setupFonts();
|
||||
|
||||
Editor editor( &hintTable() );
|
||||
|
26
designsystems/fluent2/QskFluent2TextFieldSkinlet.cpp
Normal file
26
designsystems/fluent2/QskFluent2TextFieldSkinlet.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) The authors
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskFluent2TextFieldSkinlet.h"
|
||||
#include "QskTextField.h"
|
||||
|
||||
using Q = QskTextField;
|
||||
|
||||
QskFluent2TextFieldSkinlet::QskFluent2TextFieldSkinlet( QskSkin* skin )
|
||||
: Inherited( skin )
|
||||
{
|
||||
}
|
||||
|
||||
QskFluent2TextFieldSkinlet::~QskFluent2TextFieldSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QskFluent2TextFieldSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
#include "moc_QskFluent2TextFieldSkinlet.cpp"
|
26
designsystems/fluent2/QskFluent2TextFieldSkinlet.h
Normal file
26
designsystems/fluent2/QskFluent2TextFieldSkinlet.h
Normal file
@ -0,0 +1,26 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) The authors
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_FLUENT2_TEXTFIELD_SKINLET_H
|
||||
#define QSK_FLUENT2_TEXTFIELD_SKINLET_H
|
||||
|
||||
#include "QskFluent2Global.h"
|
||||
#include "QskTextFieldSkinlet.h"
|
||||
|
||||
class QSK_FLUENT2_EXPORT QskFluent2TextFieldSkinlet : public QskTextFieldSkinlet
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
using Inherited = QskTextFieldSkinlet;
|
||||
|
||||
public:
|
||||
Q_INVOKABLE QskFluent2TextFieldSkinlet( QskSkin* = nullptr );
|
||||
~QskFluent2TextFieldSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
};
|
||||
|
||||
#endif
|
@ -10,6 +10,7 @@ list(APPEND HEADERS
|
||||
list(APPEND PRIVATE_HEADERS
|
||||
QskMaterial3ProgressBarSkinlet.h
|
||||
QskMaterial3SliderSkinlet.h
|
||||
QskMaterial3TextFieldSkinlet.h
|
||||
)
|
||||
|
||||
list(APPEND SOURCES
|
||||
@ -17,6 +18,7 @@ list(APPEND SOURCES
|
||||
QskMaterial3SkinFactory.cpp
|
||||
QskMaterial3ProgressBarSkinlet.cpp
|
||||
QskMaterial3SliderSkinlet.cpp
|
||||
QskMaterial3TextFieldSkinlet.cpp
|
||||
)
|
||||
|
||||
qt_add_resources(SOURCES QskMaterial3Icons.qrc)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "QskMaterial3Skin.h"
|
||||
#include "QskMaterial3ProgressBarSkinlet.h"
|
||||
#include "QskMaterial3SliderSkinlet.h"
|
||||
#include "QskMaterial3TextFieldSkinlet.h"
|
||||
|
||||
#include <QskSkinHintTableEditor.h>
|
||||
|
||||
@ -46,7 +47,6 @@
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextFieldSkinlet.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -479,11 +479,19 @@ void Editor::setupTextField()
|
||||
setFontRole( Q::Text, BodyMedium );
|
||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
setAlignment( Q::PlaceholderText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||
|
||||
const auto disabledPanelColor = QskRgb::toTransparentF( m_pal.onSurface, 0.04 );
|
||||
setGradient( Q::Panel | Q::Disabled, disabledPanelColor );
|
||||
setBoxBorderColors( Q::Panel | Q::Disabled, m_pal.onSurface38 );
|
||||
|
||||
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
||||
|
||||
// PlaceholderText
|
||||
|
||||
setColor( Q::PlaceholderText, color( Q::Text ) );
|
||||
setFontRole( Q::PlaceholderText, fontRole( Q::Text ) );
|
||||
setAlignment( Q::PlaceholderText, alignment( Q::Text ) );
|
||||
}
|
||||
|
||||
void Editor::setupProgressBar()
|
||||
@ -1601,6 +1609,7 @@ QskMaterial3Skin::QskMaterial3Skin( QObject* parent )
|
||||
{
|
||||
declareSkinlet< QskProgressBar, QskMaterial3ProgressBarSkinlet >();
|
||||
declareSkinlet< QskSlider, QskMaterial3SliderSkinlet >();
|
||||
declareSkinlet< QskTextField, QskMaterial3TextFieldSkinlet >();
|
||||
}
|
||||
|
||||
QskMaterial3Skin::~QskMaterial3Skin()
|
||||
|
30
designsystems/material3/QskMaterial3TextFieldSkinlet.cpp
Normal file
30
designsystems/material3/QskMaterial3TextFieldSkinlet.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) The authors
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskMaterial3TextFieldSkinlet.h"
|
||||
#include "QskTextField.h"
|
||||
|
||||
QskMaterial3TextFieldSkinlet::QskMaterial3TextFieldSkinlet( QskSkin* skin )
|
||||
: Inherited( skin )
|
||||
{
|
||||
}
|
||||
|
||||
QskMaterial3TextFieldSkinlet::~QskMaterial3TextFieldSkinlet()
|
||||
{
|
||||
}
|
||||
|
||||
QRectF QskMaterial3TextFieldSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||
{
|
||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||
}
|
||||
|
||||
QSGNode* QskMaterial3TextFieldSkinlet::updateSubNode(
|
||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
#include "moc_QskMaterial3TextFieldSkinlet.cpp"
|
30
designsystems/material3/QskMaterial3TextFieldSkinlet.h
Normal file
30
designsystems/material3/QskMaterial3TextFieldSkinlet.h
Normal file
@ -0,0 +1,30 @@
|
||||
/******************************************************************************
|
||||
* QSkinny - Copyright (C) The authors
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef QSK_MATERIAL3_TEXTFIELD_SKINLET_H
|
||||
#define QSK_MATERIAL3_TEXTFIELD_SKINLET_H
|
||||
|
||||
#include "QskMaterial3Global.h"
|
||||
#include "QskTextFieldSkinlet.h"
|
||||
|
||||
class QSK_MATERIAL3_EXPORT QskMaterial3TextFieldSkinlet : public QskTextFieldSkinlet
|
||||
{
|
||||
Q_GADGET
|
||||
|
||||
using Inherited = QskTextFieldSkinlet;
|
||||
|
||||
public:
|
||||
Q_INVOKABLE QskMaterial3TextFieldSkinlet( QskSkin* = nullptr );
|
||||
~QskMaterial3TextFieldSkinlet() override;
|
||||
|
||||
QRectF subControlRect( const QskSkinnable*,
|
||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||
|
||||
protected:
|
||||
QSGNode* updateSubNode( const QskSkinnable*,
|
||||
quint8 nodeRole, QSGNode* ) const override;
|
||||
};
|
||||
|
||||
#endif
|
@ -70,7 +70,8 @@ namespace
|
||||
setSpacing( 20 );
|
||||
|
||||
{
|
||||
new QskTextField( "Edit Me", this );
|
||||
auto textField = new QskTextField( "Joe", this );
|
||||
textField->setPlaceholderText( "<Name>" );
|
||||
}
|
||||
|
||||
{
|
||||
@ -81,10 +82,11 @@ namespace
|
||||
|
||||
{
|
||||
auto textField = new QskTextField( "12345", this );
|
||||
textField->setPlaceholderText( "<Password>" );
|
||||
textField->setMaxLength( 5 );
|
||||
textField->setEchoMode( QskTextField::PasswordEchoOnEdit );
|
||||
#if 1
|
||||
textField->setFixedWidth( 80 );
|
||||
textField->setFixedWidth( 100 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user