QskTextFieldSkinlet::Selected state introduced
This commit is contained in:
parent
77e556fad2
commit
4540cc1e4e
@ -79,6 +79,7 @@
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextFieldSkinlet.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -1792,12 +1793,13 @@ void Editor::setupTextFieldColors(
|
||||
QskAspect::Section section, const QskFluent2Theme& theme )
|
||||
{
|
||||
using Q = QskTextField;
|
||||
using SK = QskTextFieldSkinlet;
|
||||
using A = QskAspect;
|
||||
|
||||
const auto& pal = theme.palette;
|
||||
|
||||
setColor( Q::PanelSelected, pal.fillColor.accent.selectedTextBackground );
|
||||
setColor( Q::TextSelected, pal.fillColor.textOnAccent.selectedText );
|
||||
setColor( Q::Panel | SK::Selected, pal.fillColor.accent.selectedTextBackground );
|
||||
setColor( Q::Text | SK::Selected, pal.fillColor.textOnAccent.selectedText );
|
||||
|
||||
for( const auto state : { A::NoState, Q::Hovered, Q::Focused, Q::Editing, Q::Disabled } )
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextFieldSkinlet.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -385,6 +386,7 @@ void Editor::setupTextLabel()
|
||||
void Editor::setupTextField()
|
||||
{
|
||||
using Q = QskTextField;
|
||||
using SK = QskTextFieldSkinlet;
|
||||
using A = QskAspect;
|
||||
using P = QPalette;
|
||||
|
||||
@ -395,11 +397,13 @@ void Editor::setupTextField()
|
||||
const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled;
|
||||
|
||||
setGradient( Q::Panel | state, m_pal.color( colorGroup, P::Base ) );
|
||||
setColor( Q::PanelSelected | state, m_pal.color( colorGroup, P::Highlight ) );
|
||||
|
||||
setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) );
|
||||
setColor( Q::TextSelected | state, m_pal.color( colorGroup, P::HighlightedText ) );
|
||||
|
||||
setColor( Q::Panel | SK::Selected | state,
|
||||
m_pal.color( colorGroup, P::Highlight ) );
|
||||
|
||||
setColor( Q::Text | SK::Selected | state,
|
||||
m_pal.color( colorGroup, P::HighlightedText ) );
|
||||
}
|
||||
|
||||
setBoxBorderMetrics( Q::Panel, 1_px );
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include <QskTabButton.h>
|
||||
#include <QskTabView.h>
|
||||
#include <QskTextField.h>
|
||||
#include <QskTextFieldSkinlet.h>
|
||||
#include <QskTextLabel.h>
|
||||
#include <QskVirtualKeyboard.h>
|
||||
|
||||
@ -453,10 +454,12 @@ void Editor::setupTextLabel()
|
||||
void Editor::setupTextField()
|
||||
{
|
||||
using Q = QskTextField;
|
||||
using SK = QskTextFieldSkinlet;
|
||||
|
||||
setStrutSize( Q::Panel, -1.0, 56_dp );
|
||||
setPadding( Q::Panel, { 12_dp, 8_dp, 12_dp, 8_dp } );
|
||||
setGradient( Q::Panel, m_pal.surfaceVariant );
|
||||
setColor( Q::Panel | SK::Selected, m_pal.primary12 );
|
||||
setBoxShape( Q::Panel, m_pal.shapeExtraSmallTop );
|
||||
setBoxBorderMetrics( Q::Panel, { 0, 0, 0, 1_dp } );
|
||||
setBoxBorderColors( Q::Panel, m_pal.onSurfaceVariant );
|
||||
|
@ -4,6 +4,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#include "QskTextField.h"
|
||||
#include "QskTextFieldSkinlet.h"
|
||||
#include "QskFontRole.h"
|
||||
#include "QskQuick.h"
|
||||
|
||||
@ -16,12 +17,6 @@ QSK_SUBCONTROL( QskTextField, Panel )
|
||||
QSK_SUBCONTROL( QskTextField, Text )
|
||||
QSK_SUBCONTROL( QskTextField, PlaceholderText )
|
||||
|
||||
#if 1
|
||||
// shouldn't this be a Selected state, TODO ...
|
||||
QSK_SUBCONTROL( QskTextField, PanelSelected )
|
||||
QSK_SUBCONTROL( QskTextField, TextSelected )
|
||||
#endif
|
||||
|
||||
QSK_SYSTEM_STATE( QskTextField, ReadOnly, QskAspect::FirstSystemState << 1 )
|
||||
QSK_SYSTEM_STATE( QskTextField, Editing, QskAspect::FirstSystemState << 2 )
|
||||
|
||||
@ -262,14 +257,14 @@ namespace
|
||||
|
||||
if ( d->hasSelectedText() )
|
||||
{
|
||||
color = textField->color( QskTextField::PanelSelected );
|
||||
color = textField->color( QskTextField::Panel | QskTextFieldSkinlet::Selected );
|
||||
if ( d->selectionColor != color )
|
||||
{
|
||||
d->selectionColor = color;
|
||||
isDirty = true;
|
||||
}
|
||||
|
||||
color = textField->color( QskTextField::TextSelected );
|
||||
color = textField->color( QskTextField::Text | QskTextFieldSkinlet::Selected );
|
||||
if ( d->selectedTextColor != color )
|
||||
{
|
||||
d->selectedTextColor = color;
|
||||
|
@ -55,7 +55,7 @@ class QSK_EXPORT QskTextField : public QskControl
|
||||
using Inherited = QskControl;
|
||||
|
||||
public:
|
||||
QSK_SUBCONTROLS( Panel, Text, PlaceholderText, PanelSelected, TextSelected )
|
||||
QSK_SUBCONTROLS( Panel, Text, PlaceholderText )
|
||||
QSK_STATES( ReadOnly, Editing )
|
||||
|
||||
enum ActivationMode
|
||||
|
@ -8,6 +8,8 @@
|
||||
|
||||
using Q = QskTextField;
|
||||
|
||||
QSK_SYSTEM_STATE( QskTextFieldSkinlet, Selected, QskAspect::FirstUserState >> 1 )
|
||||
|
||||
QskTextFieldSkinlet::QskTextFieldSkinlet( QskSkin* skin )
|
||||
: Inherited( skin )
|
||||
{
|
||||
|
@ -15,6 +15,8 @@ class QSK_EXPORT QskTextFieldSkinlet : public QskSkinlet
|
||||
using Inherited = QskSkinlet;
|
||||
|
||||
public:
|
||||
QSK_STATES( Selected )
|
||||
|
||||
enum NodeRole
|
||||
{
|
||||
PanelRole,
|
||||
|
Loading…
x
Reference in New Issue
Block a user