Merge branch 'master' into features/menubutton
This commit is contained in:
commit
607939a4dc
|
|
@ -3,13 +3,27 @@
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
set(SOURCES
|
list(APPEND HEADERS
|
||||||
QskFluent2Global.h
|
QskFluent2Global.h QskFluent2Theme.h QskFluent2SkinFactory.h
|
||||||
QskFluent2Theme.h QskFluent2Theme.cpp
|
|
||||||
QskFluent2Skin.h QskFluent2Skin.cpp
|
|
||||||
QskFluent2SkinFactory.h QskFluent2SkinFactory.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
list(APPEND PRIVATE_HEADERS
|
||||||
|
QskFluent2TextFieldSkinlet.h
|
||||||
|
)
|
||||||
|
|
||||||
|
list(APPEND SOURCES
|
||||||
|
QskFluent2Theme.cpp
|
||||||
|
QskFluent2Skin.cpp
|
||||||
|
QskFluent2SkinFactory.cpp
|
||||||
|
QskFluent2TextFieldSkinlet.cpp
|
||||||
|
)
|
||||||
|
|
||||||
qt_add_resources(SOURCES QskFluent2Icons.qrc)
|
qt_add_resources(SOURCES QskFluent2Icons.qrc)
|
||||||
|
|
||||||
qsk_add_plugin(fluent2skin skins QskFluent2SkinFactory ${SOURCES})
|
qsk_add_plugin(fluent2skin skins QskFluent2SkinFactory
|
||||||
set_target_properties(fluent2skin PROPERTIES DEFINE_SYMBOL QSK_FLUENT2_MAKEDLL )
|
${SOURCES} ${HEADERS} ${PRIVATE_HEADERS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(fluent2skin PROPERTIES
|
||||||
|
DEFINE_SYMBOL QSK_FLUENT2_MAKEDLL
|
||||||
|
)
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@
|
||||||
*/
|
*/
|
||||||
#include "QskFluent2Skin.h"
|
#include "QskFluent2Skin.h"
|
||||||
#include "QskFluent2Theme.h"
|
#include "QskFluent2Theme.h"
|
||||||
|
#include "QskFluent2TextFieldSkinlet.h"
|
||||||
|
|
||||||
#include <QskSkinHintTableEditor.h>
|
#include <QskSkinHintTableEditor.h>
|
||||||
|
|
||||||
|
|
@ -78,7 +79,7 @@
|
||||||
#include <QskTabBar.h>
|
#include <QskTabBar.h>
|
||||||
#include <QskTabButton.h>
|
#include <QskTabButton.h>
|
||||||
#include <QskTabView.h>
|
#include <QskTabView.h>
|
||||||
#include <QskTextInput.h>
|
#include <QskTextField.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskVirtualKeyboard.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
|
|
||||||
|
|
@ -296,8 +297,8 @@ namespace
|
||||||
void setupTabViewMetrics();
|
void setupTabViewMetrics();
|
||||||
void setupTabViewColors( QskAspect::Section, const QskFluent2Theme& );
|
void setupTabViewColors( QskAspect::Section, const QskFluent2Theme& );
|
||||||
|
|
||||||
void setupTextInputMetrics();
|
void setupTextFieldMetrics();
|
||||||
void setupTextInputColors( QskAspect::Section, const QskFluent2Theme& );
|
void setupTextFieldColors( QskAspect::Section, const QskFluent2Theme& );
|
||||||
|
|
||||||
void setupTextLabelMetrics();
|
void setupTextLabelMetrics();
|
||||||
void setupTextLabelColors( QskAspect::Section, const QskFluent2Theme& );
|
void setupTextLabelColors( QskAspect::Section, const QskFluent2Theme& );
|
||||||
|
|
@ -355,7 +356,7 @@ void Editor::setupMetrics()
|
||||||
setupTabButtonMetrics();
|
setupTabButtonMetrics();
|
||||||
setupTabBarMetrics();
|
setupTabBarMetrics();
|
||||||
setupTabViewMetrics();
|
setupTabViewMetrics();
|
||||||
setupTextInputMetrics();
|
setupTextFieldMetrics();
|
||||||
setupTextLabelMetrics();
|
setupTextLabelMetrics();
|
||||||
setupVirtualKeyboardMetrics();
|
setupVirtualKeyboardMetrics();
|
||||||
}
|
}
|
||||||
|
|
@ -394,7 +395,7 @@ void Editor::setupColors( QskAspect::Section section, const QskFluent2Theme& the
|
||||||
setupTabButtonColors( section, theme );
|
setupTabButtonColors( section, theme );
|
||||||
setupTabBarColors( section, theme );
|
setupTabBarColors( section, theme );
|
||||||
setupTabViewColors( section, theme );
|
setupTabViewColors( section, theme );
|
||||||
setupTextInputColors( section, theme );
|
setupTextFieldColors( section, theme );
|
||||||
setupTextLabelColors( section, theme );
|
setupTextLabelColors( section, theme );
|
||||||
setupVirtualKeyboardColors( section, theme );
|
setupVirtualKeyboardColors( section, theme );
|
||||||
};
|
};
|
||||||
|
|
@ -1771,9 +1772,9 @@ void Editor::setupTextLabelColors(
|
||||||
setColor( Q::Text | section, pal.fillColor.text.primary );
|
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 } );
|
setStrutSize( Q::Panel, { -1, 30_px } );
|
||||||
setPadding( Q::Panel, { 11_px, 0, 11_px, 0 } );
|
setPadding( Q::Panel, { 11_px, 0, 11_px, 0 } );
|
||||||
|
|
@ -1786,18 +1787,23 @@ void Editor::setupTextInputMetrics()
|
||||||
|
|
||||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
setFontRole( Q::Text, Fluent2::Body );
|
setFontRole( Q::Text, Fluent2::Body );
|
||||||
|
|
||||||
|
setAlignment( Q::PlaceholderText, alignment( Q::Text ) );
|
||||||
|
setFontRole( Q::PlaceholderText, fontRole( Q::Text ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupTextInputColors(
|
void Editor::setupTextFieldColors(
|
||||||
QskAspect::Section section, const QskFluent2Theme& theme )
|
QskAspect::Section section, const QskFluent2Theme& theme )
|
||||||
{
|
{
|
||||||
using Q = QskTextInput;
|
using Q = QskTextField;
|
||||||
|
using SK = QskTextFieldSkinlet;
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
|
|
||||||
const auto& pal = theme.palette;
|
const auto& pal = theme.palette;
|
||||||
|
|
||||||
setColor( Q::PanelSelected, pal.fillColor.accent.selectedTextBackground );
|
setColor( Q::Panel | SK::Selected, pal.fillColor.accent.selectedTextBackground );
|
||||||
setColor( Q::TextSelected, pal.fillColor.textOnAccent.selectedText );
|
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 } )
|
for( const auto state : { A::NoState, Q::Hovered, Q::Focused, Q::Editing, Q::Disabled } )
|
||||||
{
|
{
|
||||||
|
|
@ -1808,21 +1814,21 @@ void Editor::setupTextInputColors(
|
||||||
panelColor = pal.fillColor.control.defaultColor;
|
panelColor = pal.fillColor.control.defaultColor;
|
||||||
borderColor1 = pal.elevation.textControl.border[0];
|
borderColor1 = pal.elevation.textControl.border[0];
|
||||||
borderColor2 = pal.elevation.textControl.border[1];
|
borderColor2 = pal.elevation.textControl.border[1];
|
||||||
textColor = pal.fillColor.text.secondary;
|
textColor = pal.fillColor.text.primary;
|
||||||
}
|
}
|
||||||
else if ( state == Q::Hovered )
|
else if ( state == Q::Hovered )
|
||||||
{
|
{
|
||||||
panelColor = pal.fillColor.control.secondary;
|
panelColor = pal.fillColor.control.secondary;
|
||||||
borderColor1 = pal.elevation.textControl.border[0];
|
borderColor1 = pal.elevation.textControl.border[0];
|
||||||
borderColor2 = pal.elevation.textControl.border[1];
|
borderColor2 = pal.elevation.textControl.border[1];
|
||||||
textColor = pal.fillColor.text.secondary;
|
textColor = pal.fillColor.text.primary;
|
||||||
}
|
}
|
||||||
else if ( ( state == Q::Focused ) || ( state == Q::Editing ) )
|
else if ( ( state == Q::Focused ) || ( state == Q::Editing ) )
|
||||||
{
|
{
|
||||||
panelColor = pal.fillColor.control.inputActive;
|
panelColor = pal.fillColor.control.inputActive;
|
||||||
borderColor1 = pal.elevation.textControl.border[0];
|
borderColor1 = pal.elevation.textControl.border[0];
|
||||||
borderColor2 = pal.fillColor.accent.defaultColor;
|
borderColor2 = pal.fillColor.accent.defaultColor;
|
||||||
textColor = pal.fillColor.text.secondary;
|
textColor = pal.fillColor.text.primary;
|
||||||
}
|
}
|
||||||
else if ( state == Q::Disabled )
|
else if ( state == Q::Disabled )
|
||||||
{
|
{
|
||||||
|
|
@ -2027,6 +2033,8 @@ void Editor::setupVirtualKeyboardColors(
|
||||||
QskFluent2Skin::QskFluent2Skin( QObject* parent )
|
QskFluent2Skin::QskFluent2Skin( QObject* parent )
|
||||||
: Inherited( parent )
|
: Inherited( parent )
|
||||||
{
|
{
|
||||||
|
declareSkinlet< QskTextField, QskFluent2TextFieldSkinlet >();
|
||||||
|
|
||||||
setupFonts();
|
setupFonts();
|
||||||
|
|
||||||
Editor editor( &hintTable() );
|
Editor editor( &hintTable() );
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -42,7 +42,8 @@
|
||||||
#include <QskTabBar.h>
|
#include <QskTabBar.h>
|
||||||
#include <QskTabButton.h>
|
#include <QskTabButton.h>
|
||||||
#include <QskTabView.h>
|
#include <QskTabView.h>
|
||||||
#include <QskTextInput.h>
|
#include <QskTextField.h>
|
||||||
|
#include <QskTextFieldSkinlet.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskVirtualKeyboard.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
|
|
||||||
|
|
@ -141,7 +142,7 @@ namespace
|
||||||
Q_INVOKABLE void setupTabButton();
|
Q_INVOKABLE void setupTabButton();
|
||||||
Q_INVOKABLE void setupTabBar();
|
Q_INVOKABLE void setupTabBar();
|
||||||
Q_INVOKABLE void setupTabView();
|
Q_INVOKABLE void setupTabView();
|
||||||
Q_INVOKABLE void setupTextInput();
|
Q_INVOKABLE void setupTextField();
|
||||||
Q_INVOKABLE void setupTextLabel();
|
Q_INVOKABLE void setupTextLabel();
|
||||||
|
|
||||||
QskGraphic symbol( const char* name ) const
|
QskGraphic symbol( const char* name ) const
|
||||||
|
|
@ -382,26 +383,30 @@ void Editor::setupTextLabel()
|
||||||
setBoxBorderColors( Q::Panel, QskRgb::lighter( m_pal.outline, 108 ) );
|
setBoxBorderColors( Q::Panel, QskRgb::lighter( m_pal.outline, 108 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupTextInput()
|
void Editor::setupTextField()
|
||||||
{
|
{
|
||||||
using Q = QskTextInput;
|
using Q = QskTextField;
|
||||||
|
using SK = QskTextFieldSkinlet;
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
using P = QPalette;
|
using P = QPalette;
|
||||||
|
|
||||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignTop );
|
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
setAlignment( Q::PlaceholderText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
|
||||||
for ( auto state : { A::NoState, Q::Disabled } )
|
for ( auto state : { A::NoState, Q::Disabled } )
|
||||||
{
|
{
|
||||||
const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled;
|
const auto colorGroup = ( state == A::NoState ) ? P::Active : P::Disabled;
|
||||||
|
|
||||||
setGradient( Q::Panel | state, m_pal.color( colorGroup, P::Base ) );
|
setColor( Q::Panel | state, m_pal.color( colorGroup, P::Base ) );
|
||||||
setColor( Q::PanelSelected | state, m_pal.color( colorGroup, P::Highlight ) );
|
setColor( Q::Panel | SK::Selected | state, m_pal.color( colorGroup, P::Highlight ) );
|
||||||
|
|
||||||
setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) );
|
setColor( Q::Text | state, m_pal.color( colorGroup, P::Text ) );
|
||||||
setColor( Q::TextSelected | state, m_pal.color( colorGroup, P::HighlightedText ) );
|
setColor( Q::Text | SK::Selected | state, m_pal.color( colorGroup, P::HighlightedText ) );
|
||||||
|
setColor( Q::PlaceholderText, m_pal.color( colorGroup, P::PlaceholderText ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setColor( Q::Panel | Q::ReadOnly, m_pal.disabled( P::Base ) );
|
||||||
|
|
||||||
setBoxBorderMetrics( Q::Panel, 1_px );
|
setBoxBorderMetrics( Q::Panel, 1_px );
|
||||||
|
|
||||||
setBoxBorderColors( Q::Panel, m_pal.outline );
|
setBoxBorderColors( Q::Panel, m_pal.outline );
|
||||||
|
|
@ -409,7 +414,7 @@ void Editor::setupTextInput()
|
||||||
setBoxBorderColors( Q::Panel | Q::Focused, m_pal.highlightedOutline );
|
setBoxBorderColors( Q::Panel | Q::Focused, m_pal.highlightedOutline );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setBoxShape( Q::Panel, 2 );
|
setBoxShape( Q::Panel, 2_px );
|
||||||
setPadding( Q::Panel, 4_px );
|
setPadding( Q::Panel, 4_px );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ list(APPEND HEADERS
|
||||||
list(APPEND PRIVATE_HEADERS
|
list(APPEND PRIVATE_HEADERS
|
||||||
QskMaterial3ProgressBarSkinlet.h
|
QskMaterial3ProgressBarSkinlet.h
|
||||||
QskMaterial3SliderSkinlet.h
|
QskMaterial3SliderSkinlet.h
|
||||||
|
QskMaterial3TextFieldSkinlet.h
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
|
|
@ -17,6 +18,7 @@ list(APPEND SOURCES
|
||||||
QskMaterial3SkinFactory.cpp
|
QskMaterial3SkinFactory.cpp
|
||||||
QskMaterial3ProgressBarSkinlet.cpp
|
QskMaterial3ProgressBarSkinlet.cpp
|
||||||
QskMaterial3SliderSkinlet.cpp
|
QskMaterial3SliderSkinlet.cpp
|
||||||
|
QskMaterial3TextFieldSkinlet.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
qt_add_resources(SOURCES QskMaterial3Icons.qrc)
|
qt_add_resources(SOURCES QskMaterial3Icons.qrc)
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include "QskMaterial3Skin.h"
|
#include "QskMaterial3Skin.h"
|
||||||
#include "QskMaterial3ProgressBarSkinlet.h"
|
#include "QskMaterial3ProgressBarSkinlet.h"
|
||||||
#include "QskMaterial3SliderSkinlet.h"
|
#include "QskMaterial3SliderSkinlet.h"
|
||||||
|
#include "QskMaterial3TextFieldSkinlet.h"
|
||||||
|
|
||||||
#include <QskSkinHintTableEditor.h>
|
#include <QskSkinHintTableEditor.h>
|
||||||
|
|
||||||
|
|
@ -45,7 +46,7 @@
|
||||||
#include <QskTabBar.h>
|
#include <QskTabBar.h>
|
||||||
#include <QskTabButton.h>
|
#include <QskTabButton.h>
|
||||||
#include <QskTabView.h>
|
#include <QskTabView.h>
|
||||||
#include <QskTextInput.h>
|
#include <QskTextField.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskVirtualKeyboard.h>
|
#include <QskVirtualKeyboard.h>
|
||||||
|
|
||||||
|
|
@ -200,7 +201,7 @@ namespace
|
||||||
Q_INVOKABLE void setupTabButton();
|
Q_INVOKABLE void setupTabButton();
|
||||||
Q_INVOKABLE void setupTabBar();
|
Q_INVOKABLE void setupTabBar();
|
||||||
Q_INVOKABLE void setupTabView();
|
Q_INVOKABLE void setupTabView();
|
||||||
Q_INVOKABLE void setupTextInput();
|
Q_INVOKABLE void setupTextField();
|
||||||
Q_INVOKABLE void setupTextLabel();
|
Q_INVOKABLE void setupTextLabel();
|
||||||
|
|
||||||
QskGraphic symbol( const char* name ) const
|
QskGraphic symbol( const char* name ) const
|
||||||
|
|
@ -450,13 +451,15 @@ void Editor::setupTextLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Editor::setupTextInput()
|
void Editor::setupTextField()
|
||||||
{
|
{
|
||||||
using Q = QskTextInput;
|
using Q = QskTextField;
|
||||||
|
using SK = QskTextFieldSkinlet;
|
||||||
|
|
||||||
setStrutSize( Q::Panel, -1.0, 56_dp );
|
setStrutSize( Q::Panel, -1.0, 56_dp );
|
||||||
setPadding( Q::Panel, { 12_dp, 8_dp, 12_dp, 8_dp } );
|
setPadding( Q::Panel, { 12_dp, 8_dp, 12_dp, 8_dp } );
|
||||||
setGradient( Q::Panel, m_pal.surfaceVariant );
|
setGradient( Q::Panel, m_pal.surfaceVariant );
|
||||||
|
setColor( Q::Panel | SK::Selected, m_pal.primary12 );
|
||||||
setBoxShape( Q::Panel, m_pal.shapeExtraSmallTop );
|
setBoxShape( Q::Panel, m_pal.shapeExtraSmallTop );
|
||||||
setBoxBorderMetrics( Q::Panel, { 0, 0, 0, 1_dp } );
|
setBoxBorderMetrics( Q::Panel, { 0, 0, 0, 1_dp } );
|
||||||
setBoxBorderColors( Q::Panel, m_pal.onSurfaceVariant );
|
setBoxBorderColors( Q::Panel, m_pal.onSurfaceVariant );
|
||||||
|
|
@ -476,11 +479,19 @@ void Editor::setupTextInput()
|
||||||
setFontRole( Q::Text, BodyMedium );
|
setFontRole( Q::Text, BodyMedium );
|
||||||
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
setAlignment( Q::Text, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
|
||||||
|
setAlignment( Q::PlaceholderText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
|
||||||
const auto disabledPanelColor = QskRgb::toTransparentF( m_pal.onSurface, 0.04 );
|
const auto disabledPanelColor = QskRgb::toTransparentF( m_pal.onSurface, 0.04 );
|
||||||
setGradient( Q::Panel | Q::Disabled, disabledPanelColor );
|
setGradient( Q::Panel | Q::Disabled, disabledPanelColor );
|
||||||
setBoxBorderColors( Q::Panel | Q::Disabled, m_pal.onSurface38 );
|
setBoxBorderColors( Q::Panel | Q::Disabled, m_pal.onSurface38 );
|
||||||
|
|
||||||
setColor( Q::Text | 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()
|
void Editor::setupProgressBar()
|
||||||
|
|
@ -1054,7 +1065,6 @@ void Editor::setupSwitchButton()
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
using Q = QskSwitchButton;
|
using Q = QskSwitchButton;
|
||||||
|
|
||||||
const QskStateCombination allStates ( QskStateCombination::CombinationNoState, QskAspect::AllStates );
|
|
||||||
|
|
||||||
setBoxShape( Q::Groove, 100, Qt::RelativeSize );
|
setBoxShape( Q::Groove, 100, Qt::RelativeSize );
|
||||||
const QSizeF strutSize( 52_dp, 32_dp );
|
const QSizeF strutSize( 52_dp, 32_dp );
|
||||||
|
|
@ -1070,7 +1080,7 @@ void Editor::setupSwitchButton()
|
||||||
setBoxBorderColors( Q::Groove, m_pal.outline );
|
setBoxBorderColors( Q::Groove, m_pal.outline );
|
||||||
setBoxBorderColors( Q::Groove | Q::Disabled, m_pal.onSurface12 );
|
setBoxBorderColors( Q::Groove | Q::Disabled, m_pal.onSurface12 );
|
||||||
|
|
||||||
setBoxBorderMetrics( Q::Groove | Q::Checked, 0, allStates );
|
setBoxBorderMetrics( Q::Groove | Q::Checked, 0 );
|
||||||
|
|
||||||
setBoxShape( Q::Handle, 100, Qt::RelativeSize );
|
setBoxShape( Q::Handle, 100, Qt::RelativeSize );
|
||||||
setStrutSize( Q::Handle, { 30_dp, 30_dp } );
|
setStrutSize( Q::Handle, { 30_dp, 30_dp } );
|
||||||
|
|
@ -1084,11 +1094,13 @@ void Editor::setupSwitchButton()
|
||||||
setStrutSize( Q::Icon, { 16_dp, 16_dp } );
|
setStrutSize( Q::Icon, { 16_dp, 16_dp } );
|
||||||
setPadding( Q::Icon, 6_dp );
|
setPadding( Q::Icon, 6_dp );
|
||||||
setSymbol( Q::Icon, symbol( "switchbutton-unchecked" ) );
|
setSymbol( Q::Icon, symbol( "switchbutton-unchecked" ) );
|
||||||
setSymbol( Q::Icon | Q::Checked, symbol( "switchbutton-checked" ), allStates );
|
setSymbol( Q::Icon | Q::Checked, symbol( "switchbutton-checked" ) );
|
||||||
|
|
||||||
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleSurfaceContainerHighest );
|
setGraphicRole( Q::Icon, QskMaterial3Skin::GraphicRoleSurfaceContainerHighest );
|
||||||
setGraphicRole( Q::Icon | Q::Checked, QskMaterial3Skin::GraphicRoleOnPrimaryContainer, allStates );
|
|
||||||
setGraphicRole( Q::Icon | Q::Disabled, QskMaterial3Skin::GraphicRoleSurfaceContainerHighest38, allStates );
|
setGraphicRole( Q::Icon | Q::Checked, QskMaterial3Skin::GraphicRoleOnPrimaryContainer );
|
||||||
setGraphicRole( Q::Icon | Q::Checked | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38, allStates );
|
setGraphicRole( Q::Icon | Q::Disabled, QskMaterial3Skin::GraphicRoleSurfaceContainerHighest38 );
|
||||||
|
setGraphicRole( Q::Icon | Q::Checked | Q::Disabled, QskMaterial3Skin::GraphicRoleOnSurface38 );
|
||||||
|
|
||||||
for ( auto state1 : { A::NoState, Q::Hovered, Q::Focused, Q::Pressed } )
|
for ( auto state1 : { A::NoState, Q::Hovered, Q::Focused, Q::Pressed } )
|
||||||
{
|
{
|
||||||
|
|
@ -1597,6 +1609,7 @@ QskMaterial3Skin::QskMaterial3Skin( QObject* parent )
|
||||||
{
|
{
|
||||||
declareSkinlet< QskProgressBar, QskMaterial3ProgressBarSkinlet >();
|
declareSkinlet< QskProgressBar, QskMaterial3ProgressBarSkinlet >();
|
||||||
declareSkinlet< QskSlider, QskMaterial3SliderSkinlet >();
|
declareSkinlet< QskSlider, QskMaterial3SliderSkinlet >();
|
||||||
|
declareSkinlet< QskTextField, QskMaterial3TextFieldSkinlet >();
|
||||||
}
|
}
|
||||||
|
|
||||||
QskMaterial3Skin::~QskMaterial3Skin()
|
QskMaterial3Skin::~QskMaterial3Skin()
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <QskGridBox.h>
|
#include <QskGridBox.h>
|
||||||
#include <QskSlider.h>
|
#include <QskSlider.h>
|
||||||
#include <QskTextInput.h>
|
#include <QskTextField.h>
|
||||||
#include <QskSpinBox.h>
|
#include <QskSpinBox.h>
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
@ -61,30 +61,32 @@ namespace
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputBox : public QskLinearBox
|
class TextInputBox : public QskLinearBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InputBox( QQuickItem* parent = nullptr )
|
TextInputBox( QQuickItem* parent = nullptr )
|
||||||
: QskLinearBox( Qt::Horizontal, parent )
|
: QskLinearBox( Qt::Horizontal, parent )
|
||||||
{
|
{
|
||||||
setSpacing( 20 );
|
setSpacing( 20 );
|
||||||
|
|
||||||
{
|
{
|
||||||
new QskTextInput( "Edit Me", this );
|
auto textField = new QskTextField( "Joe", this );
|
||||||
|
textField->setPlaceholderText( "<Name>" );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto input = new QskTextInput( "Only Read Me", this );
|
auto textField = new QskTextField( "Only Read Me", this );
|
||||||
input->setReadOnly( true );
|
textField->setReadOnly( true );
|
||||||
input->setSizePolicy( Qt::Horizontal, QskSizePolicy::MinimumExpanding );
|
textField->setSizePolicy( Qt::Horizontal, QskSizePolicy::MinimumExpanding );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto input = new QskTextInput( "12345", this );
|
auto textField = new QskTextField( "12345", this );
|
||||||
input->setMaxLength( 5 );
|
textField->setPlaceholderText( "<Password>" );
|
||||||
input->setEchoMode( QskTextInput::PasswordEchoOnEdit );
|
textField->setMaxLength( 5 );
|
||||||
|
textField->setEchoMode( QskTextField::PasswordEchoOnEdit );
|
||||||
#if 1
|
#if 1
|
||||||
input->setFixedWidth( 80 );
|
textField->setFixedWidth( 100 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,8 +119,8 @@ InputPage::InputPage( QQuickItem* parent )
|
||||||
auto spinBox = new QskSpinBox( 0.0, 100.0, 1.0 );
|
auto spinBox = new QskSpinBox( 0.0, 100.0, 1.0 );
|
||||||
spinBox->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
|
spinBox->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
|
||||||
|
|
||||||
auto inputBox = new InputBox();
|
auto textInputBox = new TextInputBox();
|
||||||
inputBox->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );
|
textInputBox->setSizePolicy( Qt::Vertical, QskSizePolicy::Fixed );
|
||||||
|
|
||||||
auto vBox = new QskLinearBox( Qt::Vertical );
|
auto vBox = new QskLinearBox( Qt::Vertical );
|
||||||
vBox->setSpacing( 30 );
|
vBox->setSpacing( 30 );
|
||||||
|
|
@ -127,7 +129,7 @@ InputPage::InputPage( QQuickItem* parent )
|
||||||
vBox->addItem( sliders[0].continous );
|
vBox->addItem( sliders[0].continous );
|
||||||
vBox->addItem( sliders[0].discrete );
|
vBox->addItem( sliders[0].discrete );
|
||||||
vBox->addItem( sliders[0].centered );
|
vBox->addItem( sliders[0].centered );
|
||||||
vBox->addItem( inputBox );
|
vBox->addItem( textInputBox );
|
||||||
vBox->addItem( spinBox );
|
vBox->addItem( spinBox );
|
||||||
|
|
||||||
auto mainBox = new QskLinearBox( Qt::Horizontal, this );
|
auto mainBox = new QskLinearBox( Qt::Horizontal, this );
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <QskGradient.h>
|
#include <QskGradient.h>
|
||||||
#include <QskGradientDirection.h>
|
#include <QskGradientDirection.h>
|
||||||
#include <QskLinearBox.h>
|
#include <QskLinearBox.h>
|
||||||
#include <QskTextInput.h>
|
#include <QskTextField.h>
|
||||||
#include <QskTextLabel.h>
|
#include <QskTextLabel.h>
|
||||||
#include <QskWindow.h>
|
#include <QskWindow.h>
|
||||||
#include <QskRgbValue.h>
|
#include <QskRgbValue.h>
|
||||||
|
|
@ -50,14 +50,14 @@ namespace
|
||||||
{
|
{
|
||||||
new QskTextLabel( label, this );
|
new QskTextLabel( label, this );
|
||||||
|
|
||||||
m_input = new QskTextInput( this );
|
m_textField = new QskTextField( this );
|
||||||
m_input->setValidator( new InputValidator( m_input ) );
|
m_textField->setValidator( new InputValidator( m_textField ) );
|
||||||
m_input->setText( QString::number( value ) );
|
m_textField->setText( QString::number( value ) );
|
||||||
|
|
||||||
const QFontMetricsF fm( m_input->font() );
|
const QFontMetricsF fm( m_textField->font() );
|
||||||
m_input->setFixedWidth( fm.horizontalAdvance( "-0.000" ) );
|
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(); } );
|
this, [ this ]( bool on ) { if ( !on ) Q_EMIT valueChanged(); } );
|
||||||
|
|
||||||
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||||
|
|
@ -65,14 +65,14 @@ namespace
|
||||||
|
|
||||||
qreal value() const
|
qreal value() const
|
||||||
{
|
{
|
||||||
return m_input->text().toDouble();
|
return m_textField->text().toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QskTextInput* m_input;
|
QskTextField* m_textField;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VectorBox : public QskLinearBox
|
class VectorBox : public QskLinearBox
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <QskInputPanel.h>
|
#include <QskInputPanel.h>
|
||||||
#include <QskLinearBox.h>
|
#include <QskLinearBox.h>
|
||||||
#include <QskListView.h>
|
#include <QskListView.h>
|
||||||
#include <QskTextInput.h>
|
#include <QskTextField.h>
|
||||||
|
|
||||||
#include <QskAspect.h>
|
#include <QskAspect.h>
|
||||||
#include <QskFunctions.h>
|
#include <QskFunctions.h>
|
||||||
|
|
@ -201,26 +201,26 @@ class InputBox : public QskLinearBox
|
||||||
setMargins( 10 );
|
setMargins( 10 );
|
||||||
setSpacing( 10 );
|
setSpacing( 10 );
|
||||||
|
|
||||||
auto* textInput1 = new QskTextInput( this );
|
auto* textField1 = new QskTextField( this );
|
||||||
textInput1->setText( "Press and edit Me." );
|
textField1->setText( "Press and edit Me." );
|
||||||
textInput1->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
textField1->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||||
|
|
||||||
auto* textInput2 = new QskTextInput( this );
|
auto* textField2 = new QskTextField( this );
|
||||||
textInput2->setText( "Press and edit Me." );
|
textField2->setText( "Press and edit Me." );
|
||||||
textInput2->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
textField2->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||||
textInput2->setActivationModes( QskTextInput::ActivationOnAll );
|
textField2->setActivationModes( QskTextField::ActivationOnAll );
|
||||||
|
|
||||||
auto* textInput3 = new QskTextInput( this );
|
auto* textField3 = new QskTextField( this );
|
||||||
textInput3->setReadOnly( true );
|
textField3->setReadOnly( true );
|
||||||
textInput3->setText( "Read Only information." );
|
textField3->setText( "Read Only information." );
|
||||||
textInput3->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
textField3->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||||
|
|
||||||
auto* textInput4 = new QskTextInput( this );
|
auto* textField4 = new QskTextField( this );
|
||||||
textInput4->setEchoMode( QskTextInput::Password );
|
textField4->setEchoMode( QskTextField::Password );
|
||||||
textInput4->setPasswordMaskDelay( 1000 );
|
textField4->setPasswordMaskDelay( 1000 );
|
||||||
textInput4->setMaxLength( 8 );
|
textField4->setMaxLength( 8 );
|
||||||
textInput4->setText( "12345678" );
|
textField4->setText( "12345678" );
|
||||||
textInput4->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
textField4->setSizePolicy( Qt::Horizontal, QskSizePolicy::Preferred );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,19 +22,17 @@ static inline QskTextColors qskTextColors(
|
||||||
|
|
||||||
QskSkinHintStatus status;
|
QskSkinHintStatus status;
|
||||||
|
|
||||||
QskTextColors c;
|
auto textColor = skinnable->color( aspect | A::TextColor, &status );
|
||||||
c.textColor = skinnable->color( aspect | A::TextColor, &status );
|
|
||||||
|
|
||||||
if ( status.aspect.subControl() != aspect.subControl() )
|
if ( status.aspect.subControl() != aspect.subControl() )
|
||||||
{
|
{
|
||||||
// using the same color as the one for the ticks
|
// using the same color as the one for the ticks
|
||||||
c.textColor = skinnable->color( aspect );
|
textColor = skinnable->color( aspect );
|
||||||
}
|
}
|
||||||
|
|
||||||
c.styleColor = skinnable->color( aspect | A::StyleColor );
|
return QskTextColors( textColor,
|
||||||
c.linkColor = skinnable->color( aspect | A::LinkColor );
|
skinnable->color( aspect | A::StyleColor ),
|
||||||
|
skinnable->color( aspect | A::LinkColor ) );
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QskAspect qskAxisAspect( QskPlot::Axis axis )
|
static inline QskAspect qskAxisAspect( QskPlot::Axis axis )
|
||||||
|
|
|
||||||
|
|
@ -280,8 +280,8 @@ list(APPEND HEADERS
|
||||||
controls/QskTabButtonSkinlet.h
|
controls/QskTabButtonSkinlet.h
|
||||||
controls/QskTabView.h
|
controls/QskTabView.h
|
||||||
controls/QskTabViewSkinlet.h
|
controls/QskTabViewSkinlet.h
|
||||||
controls/QskTextInput.h
|
controls/QskTextField.h
|
||||||
controls/QskTextInputSkinlet.h
|
controls/QskTextFieldSkinlet.h
|
||||||
controls/QskTextLabel.h
|
controls/QskTextLabel.h
|
||||||
controls/QskTextLabelSkinlet.h
|
controls/QskTextLabelSkinlet.h
|
||||||
controls/QskVariantAnimator.h
|
controls/QskVariantAnimator.h
|
||||||
|
|
@ -387,8 +387,8 @@ list(APPEND SOURCES
|
||||||
controls/QskTabButtonSkinlet.cpp
|
controls/QskTabButtonSkinlet.cpp
|
||||||
controls/QskTabView.cpp
|
controls/QskTabView.cpp
|
||||||
controls/QskTabViewSkinlet.cpp
|
controls/QskTabViewSkinlet.cpp
|
||||||
controls/QskTextInput.cpp
|
controls/QskTextField.cpp
|
||||||
controls/QskTextInputSkinlet.cpp
|
controls/QskTextFieldSkinlet.cpp
|
||||||
controls/QskTextLabel.cpp
|
controls/QskTextLabel.cpp
|
||||||
controls/QskTextLabelSkinlet.cpp
|
controls/QskTextLabelSkinlet.cpp
|
||||||
controls/QskVariantAnimator.cpp
|
controls/QskVariantAnimator.cpp
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ class QSK_EXPORT QskBoxBorderColors
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum
|
enum : quint8
|
||||||
{
|
{
|
||||||
// in order of Qt::Edge
|
// in order of Qt::Edge
|
||||||
Top = 0,
|
Top = 0,
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ QskBoxShapeMetrics QskBoxShapeMetrics::interpolated(
|
||||||
qskInterpolatedSize( m_radii[ 1 ], to.m_radii[ 1 ], ratio ),
|
qskInterpolatedSize( m_radii[ 1 ], to.m_radii[ 1 ], ratio ),
|
||||||
qskInterpolatedSize( m_radii[ 2 ], to.m_radii[ 2 ], ratio ),
|
qskInterpolatedSize( m_radii[ 2 ], to.m_radii[ 2 ], ratio ),
|
||||||
qskInterpolatedSize( m_radii[ 3 ], to.m_radii[ 3 ], ratio ),
|
qskInterpolatedSize( m_radii[ 3 ], to.m_radii[ 3 ], ratio ),
|
||||||
to.m_sizeMode, to.m_scalingMode );
|
to.sizeMode(), to.m_scalingMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QskBoxShapeMetrics::interpolate(
|
QVariant QskBoxShapeMetrics::interpolate(
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class QSK_EXPORT QskBoxShapeMetrics
|
||||||
The default setting is Symmetric.
|
The default setting is Symmetric.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum ScalingMode
|
enum ScalingMode : quint8
|
||||||
{
|
{
|
||||||
Symmetric,
|
Symmetric,
|
||||||
SymmetricByMaximum,
|
SymmetricByMaximum,
|
||||||
|
|
@ -144,7 +144,7 @@ class QSK_EXPORT QskBoxShapeMetrics
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF m_radii[ 4 ];
|
QSizeF m_radii[ 4 ];
|
||||||
Qt::SizeMode m_sizeMode : 2;
|
unsigned int m_sizeMode : 2;
|
||||||
ScalingMode m_scalingMode : 2;
|
ScalingMode m_scalingMode : 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -278,7 +278,7 @@ inline void QskBoxShapeMetrics::setSizeMode( Qt::SizeMode sizeMode ) noexcept
|
||||||
|
|
||||||
inline constexpr Qt::SizeMode QskBoxShapeMetrics::sizeMode() const noexcept
|
inline constexpr Qt::SizeMode QskBoxShapeMetrics::sizeMode() const noexcept
|
||||||
{
|
{
|
||||||
return m_sizeMode;
|
return static_cast< Qt::SizeMode >( m_sizeMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskBoxShapeMetrics::setScalingMode( ScalingMode scalingMode ) noexcept
|
inline void QskBoxShapeMetrics::setScalingMode( ScalingMode scalingMode ) noexcept
|
||||||
|
|
@ -312,7 +312,7 @@ inline constexpr QskBoxShapeMetrics QskBoxShapeMetrics::transposed() const noexc
|
||||||
return QskBoxShapeMetrics(
|
return QskBoxShapeMetrics(
|
||||||
m_radii[ 0 ].transposed(), m_radii[ 1 ].transposed(),
|
m_radii[ 0 ].transposed(), m_radii[ 1 ].transposed(),
|
||||||
m_radii[ 2 ].transposed(), m_radii[ 3 ].transposed(),
|
m_radii[ 2 ].transposed(), m_radii[ 3 ].transposed(),
|
||||||
m_sizeMode, m_scalingMode );
|
sizeMode(), m_scalingMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskFontRole
|
||||||
Q_PROPERTY( Emphasis emphasis READ emphasis WRITE setEmphasis )
|
Q_PROPERTY( Emphasis emphasis READ emphasis WRITE setEmphasis )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Category
|
enum Category : quint8
|
||||||
{
|
{
|
||||||
Caption,
|
Caption,
|
||||||
Body,
|
Body,
|
||||||
|
|
@ -28,7 +28,7 @@ class QSK_EXPORT QskFontRole
|
||||||
};
|
};
|
||||||
Q_ENUM( Category );
|
Q_ENUM( Category );
|
||||||
|
|
||||||
enum Emphasis
|
enum Emphasis : quint8
|
||||||
{
|
{
|
||||||
VeryLow,
|
VeryLow,
|
||||||
Low,
|
Low,
|
||||||
|
|
@ -54,8 +54,8 @@ class QSK_EXPORT QskFontRole
|
||||||
QskHashValue hash( QskHashValue seed = 0 ) const noexcept;
|
QskHashValue hash( QskHashValue seed = 0 ) const noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char m_category;
|
Category m_category;
|
||||||
unsigned char m_emphasis;
|
Emphasis m_emphasis;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr QskFontRole::QskFontRole( Category category, Emphasis emphasis ) noexcept
|
inline constexpr QskFontRole::QskFontRole( Category category, Emphasis emphasis ) noexcept
|
||||||
|
|
@ -81,7 +81,7 @@ inline void QskFontRole::setCategory( Category category ) noexcept
|
||||||
|
|
||||||
inline constexpr QskFontRole::Category QskFontRole::category() const noexcept
|
inline constexpr QskFontRole::Category QskFontRole::category() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< Category >( m_category );
|
return m_category;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskFontRole::setEmphasis( Emphasis emphasis ) noexcept
|
inline void QskFontRole::setEmphasis( Emphasis emphasis ) noexcept
|
||||||
|
|
@ -91,7 +91,7 @@ inline void QskFontRole::setEmphasis( Emphasis emphasis ) noexcept
|
||||||
|
|
||||||
inline constexpr QskFontRole::Emphasis QskFontRole::emphasis() const noexcept
|
inline constexpr QskFontRole::Emphasis QskFontRole::emphasis() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< Emphasis >( m_emphasis );
|
return m_emphasis;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QskHashValue qHash( const QskFontRole fontRole, QskHashValue seed = 0 ) noexcept
|
inline QskHashValue qHash( const QskFontRole fontRole, QskHashValue seed = 0 ) noexcept
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class QSK_EXPORT QskGradient
|
||||||
Q_CLASSINFO( "DefaultProperty", "stops" )
|
Q_CLASSINFO( "DefaultProperty", "stops" )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type : quint8
|
||||||
{
|
{
|
||||||
Stops,
|
Stops,
|
||||||
|
|
||||||
|
|
@ -50,7 +50,7 @@ class QSK_EXPORT QskGradient
|
||||||
};
|
};
|
||||||
Q_ENUM( Type )
|
Q_ENUM( Type )
|
||||||
|
|
||||||
enum SpreadMode
|
enum SpreadMode : quint8
|
||||||
{
|
{
|
||||||
PadSpread,
|
PadSpread,
|
||||||
ReflectSpread,
|
ReflectSpread,
|
||||||
|
|
@ -58,7 +58,7 @@ class QSK_EXPORT QskGradient
|
||||||
};
|
};
|
||||||
Q_ENUM( SpreadMode )
|
Q_ENUM( SpreadMode )
|
||||||
|
|
||||||
enum StretchMode
|
enum StretchMode : quint8
|
||||||
{
|
{
|
||||||
NoStretch,
|
NoStretch,
|
||||||
StretchToSize
|
StretchToSize
|
||||||
|
|
@ -181,8 +181,8 @@ class QSK_EXPORT QskGradient
|
||||||
qreal m_values[5] = {};
|
qreal m_values[5] = {};
|
||||||
|
|
||||||
unsigned int m_type : 3;
|
unsigned int m_type : 3;
|
||||||
unsigned int m_spreadMode : 3;
|
SpreadMode m_spreadMode : 3;
|
||||||
unsigned int m_stretchMode : 3;
|
StretchMode m_stretchMode : 3;
|
||||||
|
|
||||||
mutable bool m_isDirty : 1;
|
mutable bool m_isDirty : 1;
|
||||||
mutable bool m_isValid : 1;
|
mutable bool m_isValid : 1;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class QByteArray;
|
||||||
class QSK_EXPORT QskMetaInvokable
|
class QSK_EXPORT QskMetaInvokable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type : quint8
|
||||||
{
|
{
|
||||||
Invalid = 0,
|
Invalid = 0,
|
||||||
|
|
||||||
|
|
@ -93,7 +93,7 @@ class QSK_EXPORT QskMetaInvokable
|
||||||
MetaData m_metaData;
|
MetaData m_metaData;
|
||||||
};
|
};
|
||||||
|
|
||||||
int m_type : 3;
|
Type m_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline QskMetaInvokable::QskMetaInvokable()
|
inline QskMetaInvokable::QskMetaInvokable()
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace Qsk
|
||||||
{
|
{
|
||||||
Q_NAMESPACE_EXPORT( QSK_EXPORT )
|
Q_NAMESPACE_EXPORT( QSK_EXPORT )
|
||||||
|
|
||||||
enum Policy
|
enum Policy : quint8
|
||||||
{
|
{
|
||||||
Maybe,
|
Maybe,
|
||||||
Always,
|
Always,
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Qsk
|
||||||
};
|
};
|
||||||
Q_ENUM_NS( Policy )
|
Q_ENUM_NS( Policy )
|
||||||
|
|
||||||
enum Direction
|
enum Direction : quint8
|
||||||
{
|
{
|
||||||
LeftToRight,
|
LeftToRight,
|
||||||
RightToLeft,
|
RightToLeft,
|
||||||
|
|
@ -30,7 +30,7 @@ namespace Qsk
|
||||||
};
|
};
|
||||||
Q_ENUM_NS( Direction )
|
Q_ENUM_NS( Direction )
|
||||||
|
|
||||||
enum TextStyle
|
enum TextStyle : quint8
|
||||||
{
|
{
|
||||||
Normal,
|
Normal,
|
||||||
Outline,
|
Outline,
|
||||||
|
|
@ -39,7 +39,7 @@ namespace Qsk
|
||||||
};
|
};
|
||||||
Q_ENUM_NS( TextStyle )
|
Q_ENUM_NS( TextStyle )
|
||||||
|
|
||||||
enum Visibility
|
enum Visibility : quint8
|
||||||
{
|
{
|
||||||
Visible = 1 << 0,
|
Visible = 1 << 0,
|
||||||
Hidden = 1 << 1
|
Hidden = 1 << 1
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class QObject;
|
||||||
class QSK_EXPORT QskObjectCounter
|
class QSK_EXPORT QskObjectCounter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum ObjectType
|
enum ObjectType : quint8
|
||||||
{
|
{
|
||||||
Objects,
|
Objects,
|
||||||
Items
|
Items
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class QSK_EXPORT QskPlacementPolicy
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum Policy
|
enum Policy : quint8
|
||||||
{
|
{
|
||||||
Ignore,
|
Ignore,
|
||||||
Reserve,
|
Reserve,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class QSK_EXPORT QskShadowMetrics
|
||||||
Q_PROPERTY( ShapeMode shapeMode READ shapeMode WRITE setShapeMode )
|
Q_PROPERTY( ShapeMode shapeMode READ shapeMode WRITE setShapeMode )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ShapeMode
|
enum ShapeMode : quint8
|
||||||
{
|
{
|
||||||
Aligned = 0, // The shape is related to some external definition
|
Aligned = 0, // The shape is related to some external definition
|
||||||
|
|
||||||
|
|
@ -86,7 +86,7 @@ class QSK_EXPORT QskShadowMetrics
|
||||||
qreal m_spreadRadius = 0.0;
|
qreal m_spreadRadius = 0.0;
|
||||||
qreal m_blurRadius = 0.0;
|
qreal m_blurRadius = 0.0;
|
||||||
quint8 m_sizeMode = Qt::AbsoluteSize;
|
quint8 m_sizeMode = Qt::AbsoluteSize;
|
||||||
quint8 m_shapeMode = QskShadowMetrics::Aligned;
|
ShapeMode m_shapeMode = QskShadowMetrics::Aligned;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr QskShadowMetrics::QskShadowMetrics( const QPointF& offset ) noexcept
|
inline constexpr QskShadowMetrics::QskShadowMetrics( const QPointF& offset ) noexcept
|
||||||
|
|
@ -170,7 +170,7 @@ inline void QskShadowMetrics::setShapeMode( ShapeMode shapeMode ) noexcept
|
||||||
|
|
||||||
inline constexpr QskShadowMetrics::ShapeMode QskShadowMetrics::shapeMode() const noexcept
|
inline constexpr QskShadowMetrics::ShapeMode QskShadowMetrics::shapeMode() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< ShapeMode >( m_shapeMode );
|
return m_shapeMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskShadowMetrics::setOffsetX( qreal dx ) noexcept
|
inline void QskShadowMetrics::setOffsetX( qreal dx ) noexcept
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class QSK_EXPORT QskSizePolicy
|
||||||
Q_PROPERTY( Policy vertical READ verticalPolicy WRITE setVerticalPolicy )
|
Q_PROPERTY( Policy vertical READ verticalPolicy WRITE setVerticalPolicy )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Flag
|
enum Flag : quint8
|
||||||
{
|
{
|
||||||
GrowFlag = 1 << 0,
|
GrowFlag = 1 << 0,
|
||||||
ExpandFlag = 1 << 1,
|
ExpandFlag = 1 << 1,
|
||||||
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskSizePolicy
|
||||||
ConstrainedFlag = 1 << 4
|
ConstrainedFlag = 1 << 4
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Policy
|
enum Policy : quint8
|
||||||
{
|
{
|
||||||
Fixed = 0,
|
Fixed = 0,
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ class QSK_EXPORT QskSizePolicy
|
||||||
ConstrainedExpanding = ConstrainedFlag | Expanding
|
ConstrainedExpanding = ConstrainedFlag | Expanding
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ConstraintType
|
enum ConstraintType : quint8
|
||||||
{
|
{
|
||||||
Unconstrained = 0,
|
Unconstrained = 0,
|
||||||
|
|
||||||
|
|
@ -85,8 +85,8 @@ class QSK_EXPORT QskSizePolicy
|
||||||
void transpose() noexcept;
|
void transpose() noexcept;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned char m_horizontalPolicy = Ignored;
|
Policy m_horizontalPolicy = Ignored;
|
||||||
unsigned char m_verticalPolicy = Ignored;
|
Policy m_verticalPolicy = Ignored;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr QskSizePolicy::QskSizePolicy(
|
inline constexpr QskSizePolicy::QskSizePolicy(
|
||||||
|
|
@ -111,38 +111,37 @@ inline constexpr bool QskSizePolicy::operator!=(
|
||||||
|
|
||||||
inline void QskSizePolicy::setHorizontalPolicy( Policy policy ) noexcept
|
inline void QskSizePolicy::setHorizontalPolicy( Policy policy ) noexcept
|
||||||
{
|
{
|
||||||
m_horizontalPolicy = static_cast< unsigned char >( policy );
|
m_horizontalPolicy = policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskSizePolicy::Policy QskSizePolicy::horizontalPolicy() const noexcept
|
inline constexpr QskSizePolicy::Policy QskSizePolicy::horizontalPolicy() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< Policy >( m_horizontalPolicy );
|
return m_horizontalPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskSizePolicy::setVerticalPolicy( Policy policy ) noexcept
|
inline void QskSizePolicy::setVerticalPolicy( Policy policy ) noexcept
|
||||||
{
|
{
|
||||||
m_verticalPolicy = static_cast< unsigned char >( policy );
|
m_verticalPolicy = policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskSizePolicy::Policy QskSizePolicy::verticalPolicy() const noexcept
|
inline constexpr QskSizePolicy::Policy QskSizePolicy::verticalPolicy() const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< Policy >( m_verticalPolicy );
|
return m_verticalPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr QskSizePolicy::Policy QskSizePolicy::policy(
|
inline constexpr QskSizePolicy::Policy QskSizePolicy::policy(
|
||||||
Qt::Orientation orientation ) const noexcept
|
Qt::Orientation orientation ) const noexcept
|
||||||
{
|
{
|
||||||
return static_cast< Policy >(
|
return ( orientation == Qt::Horizontal ) ? m_horizontalPolicy : m_verticalPolicy;
|
||||||
( orientation == Qt::Horizontal ) ? m_horizontalPolicy : m_verticalPolicy );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskSizePolicy::setPolicy(
|
inline void QskSizePolicy::setPolicy(
|
||||||
Qt::Orientation orientation, Policy policy ) noexcept
|
Qt::Orientation orientation, Policy policy ) noexcept
|
||||||
{
|
{
|
||||||
if ( orientation == Qt::Horizontal )
|
if ( orientation == Qt::Horizontal )
|
||||||
m_horizontalPolicy = static_cast< unsigned char >( policy );
|
m_horizontalPolicy = policy;
|
||||||
else
|
else
|
||||||
m_verticalPolicy = static_cast< unsigned char >( policy );
|
m_verticalPolicy = policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr bool QskSizePolicy::isConstrained(
|
inline constexpr bool QskSizePolicy::isConstrained(
|
||||||
|
|
@ -153,7 +152,7 @@ inline constexpr bool QskSizePolicy::isConstrained(
|
||||||
|
|
||||||
inline constexpr QskSizePolicy QskSizePolicy::transposed() const noexcept
|
inline constexpr QskSizePolicy QskSizePolicy::transposed() const noexcept
|
||||||
{
|
{
|
||||||
return QskSizePolicy( verticalPolicy(), horizontalPolicy() );
|
return QskSizePolicy( m_verticalPolicy, m_horizontalPolicy );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
class QSK_EXPORT QskStateCombination
|
class QSK_EXPORT QskStateCombination
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type : quint8
|
||||||
{
|
{
|
||||||
Combination,
|
Combination,
|
||||||
CombinationNoState
|
CombinationNoState
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,38 @@
|
||||||
|
|
||||||
QskHashValue QskTextColors::hash( QskHashValue seed ) const noexcept
|
QskHashValue QskTextColors::hash( QskHashValue seed ) const noexcept
|
||||||
{
|
{
|
||||||
const QRgb rgb[] = { textColor.rgba(), styleColor.rgba(), linkColor.rgba() };
|
const QRgb rgb[] =
|
||||||
|
{
|
||||||
|
m_textColor.rgba(),
|
||||||
|
m_styleColor.isValid() ? m_styleColor.rgba() : m_textColor.rgba(),
|
||||||
|
m_linkColor.isValid() ? m_linkColor.rgba() : m_textColor.rgba()
|
||||||
|
};
|
||||||
|
|
||||||
return qHashBits( rgb, sizeof( rgb ), seed );
|
return qHashBits( rgb, sizeof( rgb ), seed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskTextColors::setTextColor( const QColor& color )
|
||||||
|
{
|
||||||
|
m_textColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskTextColors::setStyleColor( const QColor& color )
|
||||||
|
{
|
||||||
|
m_styleColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskTextColors::setLinkColor( const QColor& color )
|
||||||
|
{
|
||||||
|
m_linkColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
QskTextColors QskTextColors::interpolated(
|
QskTextColors QskTextColors::interpolated(
|
||||||
const QskTextColors& to, qreal ratio ) const
|
const QskTextColors& to, qreal ratio ) const
|
||||||
{
|
{
|
||||||
QskTextColors colors;
|
QskTextColors colors;
|
||||||
colors.textColor = QskRgb::interpolated( textColor, to.textColor, ratio );
|
colors.m_textColor = QskRgb::interpolated( m_textColor, to.m_textColor, ratio );
|
||||||
colors.styleColor = QskRgb::interpolated( styleColor, to.styleColor, ratio );
|
colors.m_styleColor = QskRgb::interpolated( m_styleColor, to.m_styleColor, ratio );
|
||||||
colors.linkColor = QskRgb::interpolated( linkColor, to.linkColor, ratio );
|
colors.m_linkColor = QskRgb::interpolated( m_linkColor, to.m_linkColor, ratio );
|
||||||
|
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
@ -50,13 +71,23 @@ QDebug operator<<( QDebug debug, const QskTextColors& colors )
|
||||||
debug << "TextColors" << '(';
|
debug << "TextColors" << '(';
|
||||||
|
|
||||||
debug << " T";
|
debug << " T";
|
||||||
qskDebugColor( debug, colors.textColor );
|
|
||||||
|
|
||||||
debug << ", S";
|
if ( colors.textColor().isValid() )
|
||||||
qskDebugColor( debug, colors.styleColor );
|
qskDebugColor( debug, colors.textColor() );
|
||||||
|
else
|
||||||
|
debug << "(invalid)";
|
||||||
|
|
||||||
debug << ", L";
|
if ( colors.styleColor().isValid() )
|
||||||
qskDebugColor( debug, colors.linkColor );
|
{
|
||||||
|
debug << ", S";
|
||||||
|
qskDebugColor( debug, colors.styleColor() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( colors.linkColor().isValid() )
|
||||||
|
{
|
||||||
|
debug << ", L";
|
||||||
|
qskDebugColor( debug, colors.linkColor() );
|
||||||
|
}
|
||||||
|
|
||||||
debug << " )";
|
debug << " )";
|
||||||
|
|
||||||
|
|
@ -64,3 +95,5 @@ QDebug operator<<( QDebug debug, const QskTextColors& colors )
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "moc_QskTextColors.cpp"
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,31 @@ class QVariant;
|
||||||
|
|
||||||
class QSK_EXPORT QskTextColors
|
class QSK_EXPORT QskTextColors
|
||||||
{
|
{
|
||||||
|
Q_GADGET
|
||||||
|
|
||||||
|
Q_PROPERTY( QColor textColor READ textColor WRITE setTextColor )
|
||||||
|
Q_PROPERTY( QColor styleColor READ styleColor WRITE setStyleColor )
|
||||||
|
Q_PROPERTY( QColor linkColor READ linkColor WRITE setLinkColor )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QskTextColors( const QColor& text = QColor(),
|
QskTextColors( const QColor& text = QColor(),
|
||||||
const QColor& style = QColor(), const QColor& link = QColor() );
|
const QColor& style = QColor(), const QColor& link = QColor() );
|
||||||
|
|
||||||
|
QColor textColor() const;
|
||||||
|
void setTextColor( const QColor& );
|
||||||
|
void setTextColor( QRgb );
|
||||||
|
void setTextColor( Qt::GlobalColor );
|
||||||
|
|
||||||
|
QColor styleColor() const;
|
||||||
|
void setStyleColor( const QColor& );
|
||||||
|
void setStyleColor( QRgb );
|
||||||
|
void setStyleColor( Qt::GlobalColor );
|
||||||
|
|
||||||
|
QColor linkColor() const;
|
||||||
|
void setLinkColor( const QColor& );
|
||||||
|
void setLinkColor( QRgb );
|
||||||
|
void setLinkColor( Qt::GlobalColor );
|
||||||
|
|
||||||
QskTextColors interpolated( const QskTextColors&, qreal value ) const;
|
QskTextColors interpolated( const QskTextColors&, qreal value ) const;
|
||||||
|
|
||||||
static QVariant interpolate( const QskTextColors&,
|
static QVariant interpolate( const QskTextColors&,
|
||||||
|
|
@ -27,19 +48,65 @@ class QSK_EXPORT QskTextColors
|
||||||
|
|
||||||
QskHashValue hash( QskHashValue seed = 0 ) const noexcept;
|
QskHashValue hash( QskHashValue seed = 0 ) const noexcept;
|
||||||
|
|
||||||
QColor textColor;
|
private:
|
||||||
QColor styleColor;
|
QColor m_textColor;
|
||||||
QColor linkColor;
|
QColor m_styleColor;
|
||||||
|
QColor m_linkColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline QskTextColors::QskTextColors(
|
inline QskTextColors::QskTextColors(
|
||||||
const QColor& text, const QColor& style, const QColor& link )
|
const QColor& text, const QColor& style, const QColor& link )
|
||||||
: textColor( text )
|
: m_textColor( text )
|
||||||
, styleColor( style )
|
, m_styleColor( style )
|
||||||
, linkColor( link )
|
, m_linkColor( link )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QColor QskTextColors::textColor() const
|
||||||
|
{
|
||||||
|
return m_textColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QColor QskTextColors::linkColor() const
|
||||||
|
{
|
||||||
|
return m_linkColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QColor QskTextColors::styleColor() const
|
||||||
|
{
|
||||||
|
return m_styleColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskTextColors::setTextColor( QRgb rgb )
|
||||||
|
{
|
||||||
|
setTextColor( QColor::fromRgba( rgb ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskTextColors::setTextColor( Qt::GlobalColor color )
|
||||||
|
{
|
||||||
|
setTextColor( QColor( color ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskTextColors::setStyleColor( QRgb rgb )
|
||||||
|
{
|
||||||
|
setStyleColor( QColor::fromRgba( rgb ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskTextColors::setStyleColor( Qt::GlobalColor color )
|
||||||
|
{
|
||||||
|
setStyleColor( QColor( color ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskTextColors::setLinkColor( QRgb rgb )
|
||||||
|
{
|
||||||
|
setLinkColor( QColor::fromRgba( rgb ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void QskTextColors::setLinkColor( Qt::GlobalColor color )
|
||||||
|
{
|
||||||
|
setLinkColor( QColor( color ) );
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
|
||||||
QSK_EXPORT QDebug operator<<( QDebug, const QskTextColors& );
|
QSK_EXPORT QDebug operator<<( QDebug, const QskTextColors& );
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ QskTextOptions::TextFormat QskTextOptions::effectiveFormat( const QString& text
|
||||||
|
|
||||||
if ( m_format == QskTextOptions::AutoText )
|
if ( m_format == QskTextOptions::AutoText )
|
||||||
return Qt::mightBeRichText( text ) ? StyledText : PlainText;
|
return Qt::mightBeRichText( text ) ? StyledText : PlainText;
|
||||||
else
|
|
||||||
return m_format;
|
return m_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
QskHashValue QskTextOptions::hash( QskHashValue seed ) const noexcept
|
QskHashValue QskTextOptions::hash( QskHashValue seed ) const noexcept
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class QSK_EXPORT QskTextOptions
|
||||||
Q_PROPERTY( int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount )
|
Q_PROPERTY( int maximumLineCount READ maximumLineCount WRITE setMaximumLineCount )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum FontSizeMode
|
enum FontSizeMode : quint8
|
||||||
{
|
{
|
||||||
FixedSize,
|
FixedSize,
|
||||||
HorizontalFit,
|
HorizontalFit,
|
||||||
|
|
@ -33,7 +33,7 @@ class QSK_EXPORT QskTextOptions
|
||||||
};
|
};
|
||||||
Q_ENUM( FontSizeMode )
|
Q_ENUM( FontSizeMode )
|
||||||
|
|
||||||
enum WrapMode
|
enum WrapMode : quint8
|
||||||
{
|
{
|
||||||
NoWrap = QTextOption::NoWrap,
|
NoWrap = QTextOption::NoWrap,
|
||||||
WordWrap = QTextOption::WordWrap,
|
WordWrap = QTextOption::WordWrap,
|
||||||
|
|
@ -42,11 +42,12 @@ class QSK_EXPORT QskTextOptions
|
||||||
};
|
};
|
||||||
Q_ENUM( WrapMode )
|
Q_ENUM( WrapMode )
|
||||||
|
|
||||||
enum TextFormat
|
enum TextFormat : quint8
|
||||||
{
|
{
|
||||||
PlainText = Qt::PlainText,
|
PlainText = Qt::PlainText,
|
||||||
RichText = Qt::RichText,
|
RichText = Qt::RichText,
|
||||||
AutoText = Qt::AutoText,
|
AutoText = Qt::AutoText,
|
||||||
|
MarkdownText = Qt::MarkdownText,
|
||||||
StyledText = 4 // taken from QQuickText::StyledText
|
StyledText = 4 // taken from QQuickText::StyledText
|
||||||
};
|
};
|
||||||
Q_ENUM( TextFormat )
|
Q_ENUM( TextFormat )
|
||||||
|
|
@ -84,7 +85,7 @@ class QSK_EXPORT QskTextOptions
|
||||||
FontSizeMode m_fontSizeMode : 2;
|
FontSizeMode m_fontSizeMode : 2;
|
||||||
WrapMode m_wrapMode : 4;
|
WrapMode m_wrapMode : 4;
|
||||||
TextFormat m_format : 3;
|
TextFormat m_format : 3;
|
||||||
Qt::TextElideMode m_elideMode : 2;
|
unsigned int m_elideMode : 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline constexpr QskTextOptions::QskTextOptions() noexcept
|
inline constexpr QskTextOptions::QskTextOptions() noexcept
|
||||||
|
|
@ -113,12 +114,13 @@ inline void QskTextOptions::setElideMode( Qt::TextElideMode elideMode ) noexcept
|
||||||
|
|
||||||
constexpr inline Qt::TextElideMode QskTextOptions::elideMode() const noexcept
|
constexpr inline Qt::TextElideMode QskTextOptions::elideMode() const noexcept
|
||||||
{
|
{
|
||||||
return m_elideMode;
|
return static_cast< Qt::TextElideMode >( m_elideMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline Qt::TextElideMode QskTextOptions::effectiveElideMode() const noexcept
|
constexpr inline Qt::TextElideMode QskTextOptions::effectiveElideMode() const noexcept
|
||||||
{
|
{
|
||||||
return ( m_wrapMode != QskTextOptions::NoWrap ) ? Qt::ElideNone : m_elideMode;
|
return ( wrapMode() != QskTextOptions::NoWrap ) ?
|
||||||
|
Qt::ElideNone : static_cast< Qt::TextElideMode >( m_elideMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void QskTextOptions::setWrapMode( WrapMode wrapMode ) noexcept
|
inline void QskTextOptions::setWrapMode( WrapMode wrapMode ) noexcept
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class QSK_EXPORT QskTickmarks
|
||||||
Q_PROPERTY( QVector< qreal > minorTicks READ minorTicks WRITE setMinorTicks )
|
Q_PROPERTY( QVector< qreal > minorTicks READ minorTicks WRITE setMinorTicks )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum TickType
|
enum TickType : quint8
|
||||||
{
|
{
|
||||||
MinorTick,
|
MinorTick,
|
||||||
MediumTick,
|
MediumTick,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
class QSK_EXPORT QskAnimationHint
|
class QSK_EXPORT QskAnimationHint
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum UpdateFlag
|
enum UpdateFlag : quint8
|
||||||
{
|
{
|
||||||
UpdateAuto = 0, // depending on the animated aspect
|
UpdateAuto = 0, // depending on the animated aspect
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskBoxSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskCheckBoxSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
BoxRole,
|
BoxRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskComboBoxSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
IconRole,
|
IconRole,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskDrawerSkinlet : public QskPopupSkinlet
|
||||||
using Inherited = QskPopupSkinlet;
|
using Inherited = QskPopupSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
ContentsRole = Inherited::RoleCount,
|
ContentsRole = Inherited::RoleCount,
|
||||||
PanelRole,
|
PanelRole,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class QKeyEvent;
|
||||||
class QSK_EXPORT QskEvent : public QEvent
|
class QSK_EXPORT QskEvent : public QEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type : int
|
||||||
{
|
{
|
||||||
NoEvent = 53800,
|
NoEvent = 53800,
|
||||||
|
|
||||||
|
|
@ -161,7 +161,7 @@ class QSK_EXPORT QskGestureEvent : public QskEvent
|
||||||
class QSK_EXPORT QskAnimatorEvent : public QskEvent
|
class QSK_EXPORT QskAnimatorEvent : public QskEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum State
|
enum State : quint8
|
||||||
{
|
{
|
||||||
Started,
|
Started,
|
||||||
Terminated
|
Terminated
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskFocusIndicatorSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
FrameRole,
|
FrameRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class QSK_EXPORT QskGesture
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type : qint16
|
||||||
{
|
{
|
||||||
NoType = -1,
|
NoType = -1,
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@ class QSK_EXPORT QskGesture
|
||||||
};
|
};
|
||||||
Q_ENUM( Type )
|
Q_ENUM( Type )
|
||||||
|
|
||||||
enum State
|
enum State : quint8
|
||||||
{
|
{
|
||||||
NoGesture,
|
NoGesture,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class QSK_EXPORT QskGestureRecognizer : public QObject
|
||||||
using Inherited = QObject;
|
using Inherited = QObject;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum State
|
enum State : quint8
|
||||||
{
|
{
|
||||||
Idle,
|
Idle,
|
||||||
Pending,
|
Pending,
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class QSK_EXPORT QskGraphicLabel : public QskControl
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Graphic )
|
QSK_SUBCONTROLS( Panel, Graphic )
|
||||||
|
|
||||||
enum FillMode
|
enum FillMode : quint8
|
||||||
{
|
{
|
||||||
Stretch,
|
Stretch,
|
||||||
PreserveAspectFit,
|
PreserveAspectFit,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskGraphicLabelSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
GraphicRole,
|
GraphicRole,
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class QSK_EXPORT QskItem : public QQuickItem
|
||||||
using Inherited = QQuickItem;
|
using Inherited = QQuickItem;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum UpdateFlag
|
enum UpdateFlag : quint16
|
||||||
{
|
{
|
||||||
DeferredUpdate = 1 << 0,
|
DeferredUpdate = 1 << 0,
|
||||||
DeferredPolish = 1 << 1,
|
DeferredPolish = 1 << 1,
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class QSK_EXPORT QskListView : public QskScrollView
|
||||||
QSK_SUBCONTROLS( Cell, Text, Graphic )
|
QSK_SUBCONTROLS( Cell, Text, Graphic )
|
||||||
QSK_STATES( Selected )
|
QSK_STATES( Selected )
|
||||||
|
|
||||||
enum SelectionMode
|
enum SelectionMode : quint8
|
||||||
{
|
{
|
||||||
NoSelection,
|
NoSelection,
|
||||||
SingleSelection,
|
SingleSelection,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class QSK_EXPORT QskListViewSkinlet : public QskScrollViewSkinlet
|
||||||
using Inherited = QskScrollViewSkinlet;
|
using Inherited = QskScrollViewSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
TextRole = Inherited::RoleCount,
|
TextRole = Inherited::RoleCount,
|
||||||
GraphicRole,
|
GraphicRole,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class QSK_EXPORT QskMenuSkinlet : public QskPopupSkinlet
|
||||||
using Inherited = QskPopupSkinlet;
|
using Inherited = QskPopupSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
ContentsRole = Inherited::RoleCount,
|
ContentsRole = Inherited::RoleCount,
|
||||||
PanelRole,
|
PanelRole,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskPageIndicatorSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
BulletsRole,
|
BulletsRole,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskPopup : public QskControl
|
||||||
QSK_SUBCONTROLS( Overlay )
|
QSK_SUBCONTROLS( Overlay )
|
||||||
QSK_STATES( Closed )
|
QSK_STATES( Closed )
|
||||||
|
|
||||||
enum PopupFlag
|
enum PopupFlag : quint8
|
||||||
{
|
{
|
||||||
DeleteOnClose = 1 << 0,
|
DeleteOnClose = 1 << 0,
|
||||||
CloseOnPressOutside = 1 << 1
|
CloseOnPressOutside = 1 << 1
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskPopupSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
OverlayRole,
|
OverlayRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskProgressIndicatorSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
GrooveRole,
|
GrooveRole,
|
||||||
FillRole,
|
FillRole,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class QSK_EXPORT QskProgressRing : public QskProgressIndicator
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Groove, Fill )
|
QSK_SUBCONTROLS( Groove, Fill )
|
||||||
|
|
||||||
enum Size
|
enum Size : qint8
|
||||||
{
|
{
|
||||||
SmallSize = -1,
|
SmallSize = -1,
|
||||||
NormalSize = 0,
|
NormalSize = 0,
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Splash, Text, Icon )
|
QSK_SUBCONTROLS( Panel, Splash, Text, Icon )
|
||||||
|
|
||||||
enum Emphasis
|
enum Emphasis : qint8
|
||||||
{
|
{
|
||||||
VeryLowEmphasis = -2,
|
VeryLowEmphasis = -2,
|
||||||
LowEmphasis = -1,
|
LowEmphasis = -1,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskPushButtonSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
SplashRole,
|
SplashRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskRadioBoxSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
ButtonRole,
|
ButtonRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskScrollViewSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
ViewportRole,
|
ViewportRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskSegmentedBarSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
SegmentRole,
|
SegmentRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskSeparatorSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@
|
||||||
#include "QskTextLabel.h"
|
#include "QskTextLabel.h"
|
||||||
#include "QskTextLabelSkinlet.h"
|
#include "QskTextLabelSkinlet.h"
|
||||||
|
|
||||||
#include "QskTextInput.h"
|
#include "QskTextField.h"
|
||||||
#include "QskTextInputSkinlet.h"
|
#include "QskTextFieldSkinlet.h"
|
||||||
|
|
||||||
#include "QskStatusIndicator.h"
|
#include "QskStatusIndicator.h"
|
||||||
#include "QskStatusIndicatorSkinlet.h"
|
#include "QskStatusIndicatorSkinlet.h"
|
||||||
|
|
@ -205,7 +205,7 @@ QskSkin::QskSkin( QObject* parent )
|
||||||
declareSkinlet< QskTabButton, QskTabButtonSkinlet >();
|
declareSkinlet< QskTabButton, QskTabButtonSkinlet >();
|
||||||
declareSkinlet< QskTabView, QskTabViewSkinlet >();
|
declareSkinlet< QskTabView, QskTabViewSkinlet >();
|
||||||
declareSkinlet< QskTextLabel, QskTextLabelSkinlet >();
|
declareSkinlet< QskTextLabel, QskTextLabelSkinlet >();
|
||||||
declareSkinlet< QskTextInput, QskTextInputSkinlet >();
|
declareSkinlet< QskTextField, QskTextFieldSkinlet >();
|
||||||
declareSkinlet< QskProgressBar, QskProgressBarSkinlet >();
|
declareSkinlet< QskProgressBar, QskProgressBarSkinlet >();
|
||||||
declareSkinlet< QskProgressRing, QskProgressRingSkinlet >();
|
declareSkinlet< QskProgressRing, QskProgressRingSkinlet >();
|
||||||
declareSkinlet< QskRadioBox, QskRadioBoxSkinlet >();
|
declareSkinlet< QskRadioBox, QskRadioBoxSkinlet >();
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class QSK_EXPORT QskSkin : public QObject
|
||||||
public:
|
public:
|
||||||
#if 1
|
#if 1
|
||||||
// Use Qt::ColorScheme once minimum version is Qt 6.5
|
// Use Qt::ColorScheme once minimum version is Qt 6.5
|
||||||
enum ColorScheme
|
enum ColorScheme : quint8
|
||||||
{
|
{
|
||||||
UnknownScheme,
|
UnknownScheme,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ namespace
|
||||||
class UpdateInfo
|
class UpdateInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum UpdateMode
|
enum UpdateMode : quint8
|
||||||
{
|
{
|
||||||
Polish = 1,
|
Polish = 1,
|
||||||
Update = 2
|
Update = 2
|
||||||
|
|
@ -128,7 +128,7 @@ namespace
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer< QskControl > control;
|
QPointer< QskControl > control;
|
||||||
int updateModes;
|
quint8 updateModes = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class HintAnimator : public QskHintAnimator
|
class HintAnimator : public QskHintAnimator
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ template< typename Key, typename T > class QHash;
|
||||||
class QSK_EXPORT QskSkinTransition
|
class QSK_EXPORT QskSkinTransition
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type : quint8
|
||||||
{
|
{
|
||||||
Color = 1,
|
Color = 1,
|
||||||
Metric = 2,
|
Metric = 2,
|
||||||
|
|
|
||||||
|
|
@ -183,17 +183,15 @@ static inline QskTextColors qskTextColors(
|
||||||
|
|
||||||
QskSkinHintStatus status;
|
QskSkinHintStatus status;
|
||||||
|
|
||||||
QskTextColors c;
|
auto textColor = skinnable->color( subControl, &status );
|
||||||
c.textColor = skinnable->color( subControl, &status );
|
|
||||||
#if 1
|
#if 1
|
||||||
if ( !status.isValid() )
|
if ( !status.isValid() )
|
||||||
c.textColor = skinnable->color( subControl | QskAspect::TextColor );
|
textColor = skinnable->color( subControl | QskAspect::TextColor );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
c.styleColor = skinnable->color( subControl | QskAspect::StyleColor );
|
return QskTextColors( textColor,
|
||||||
c.linkColor = skinnable->color( subControl | QskAspect::LinkColor );
|
skinnable->color( subControl | QskAspect::StyleColor ),
|
||||||
|
skinnable->color( subControl | QskAspect::LinkColor ) );
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QQuickWindow* qskWindowOfSkinnable( const QskSkinnable* skinnable )
|
static inline QQuickWindow* qskWindowOfSkinnable( const QskSkinnable* skinnable )
|
||||||
|
|
@ -678,24 +676,34 @@ QSGNode* QskSkinlet::updateTextNode(
|
||||||
const QskSkinnable* skinnable, QSGNode* node,
|
const QskSkinnable* skinnable, QSGNode* node,
|
||||||
const QRectF& rect, Qt::Alignment alignment,
|
const QRectF& rect, Qt::Alignment alignment,
|
||||||
const QString& text, QskAspect::Subcontrol subControl )
|
const QString& text, QskAspect::Subcontrol subControl )
|
||||||
|
{
|
||||||
|
const auto textOptions = skinnable->textOptionsHint( subControl );
|
||||||
|
|
||||||
|
return updateTextNode( skinnable, node, rect, alignment,
|
||||||
|
textOptions, text, subControl );
|
||||||
|
}
|
||||||
|
|
||||||
|
QSGNode* QskSkinlet::updateTextNode( const QskSkinnable* skinnable,
|
||||||
|
QSGNode* node, const QRectF& rect,
|
||||||
|
Qt::Alignment alignment, const QskTextOptions& textOptions,
|
||||||
|
const QString& text, QskAspect::Subcontrol subControl )
|
||||||
{
|
{
|
||||||
if ( text.isEmpty() || rect.isEmpty() )
|
if ( text.isEmpty() || rect.isEmpty() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const auto textColors = qskTextColors( skinnable, subControl );
|
const auto colors = qskTextColors( skinnable, subControl );
|
||||||
const auto textOptions = skinnable->textOptionsHint( subControl );
|
|
||||||
|
|
||||||
auto textStyle = Qsk::Normal;
|
auto style = Qsk::Normal;
|
||||||
if ( textColors.styleColor.alpha() == 0 )
|
if ( colors.styleColor().isValid() )
|
||||||
{
|
{
|
||||||
textStyle = skinnable->flagHint< Qsk::TextStyle >(
|
style = skinnable->flagHint< Qsk::TextStyle >(
|
||||||
subControl | QskAspect::Style, Qsk::Normal );
|
subControl | QskAspect::Style, Qsk::Normal );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto font = skinnable->effectiveFont( subControl );
|
const auto font = skinnable->effectiveFont( subControl );
|
||||||
|
|
||||||
return qskUpdateTextNode( skinnable, node, rect, alignment,
|
return qskUpdateTextNode( skinnable, node, rect, alignment,
|
||||||
text, font, textOptions, textColors, textStyle );
|
text, font, textOptions, colors, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskSkinlet::updateTextNode(
|
QSGNode* QskSkinlet::updateTextNode(
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class QSK_EXPORT QskSkinlet
|
||||||
static QSGNode* updateLineNode( const QskSkinnable*, QSGNode*,
|
static QSGNode* updateLineNode( const QskSkinnable*, QSGNode*,
|
||||||
const QLineF&, QskAspect::Subcontrol );
|
const QLineF&, QskAspect::Subcontrol );
|
||||||
|
|
||||||
static QSGNode* updateLinesNode( const QskSkinnable*,
|
static QSGNode* updateLinesNode( const QskSkinnable*,
|
||||||
QSGNode*, const QVector< QLineF >&, QskAspect::Subcontrol );
|
QSGNode*, const QVector< QLineF >&, QskAspect::Subcontrol );
|
||||||
|
|
||||||
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
||||||
|
|
@ -120,6 +120,10 @@ class QSK_EXPORT QskSkinlet
|
||||||
const QRectF&, Qt::Alignment, const QString&, const QFont&,
|
const QRectF&, Qt::Alignment, const QString&, const QFont&,
|
||||||
const QskTextOptions&, const QskTextColors&, Qsk::TextStyle );
|
const QskTextOptions&, const QskTextColors&, Qsk::TextStyle );
|
||||||
|
|
||||||
|
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
||||||
|
const QRectF&, Qt::Alignment, const QskTextOptions&,
|
||||||
|
const QString&, QskAspect::Subcontrol );
|
||||||
|
|
||||||
// keeping the aspect ratio
|
// keeping the aspect ratio
|
||||||
static QSGNode* updateGraphicNode( const QskSkinnable*, QSGNode*,
|
static QSGNode* updateGraphicNode( const QskSkinnable*, QSGNode*,
|
||||||
const QskGraphic&, const QskColorFilter&, const QRectF&,
|
const QskGraphic&, const QskColorFilter&, const QRectF&,
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class QskSkinStateChanger;
|
||||||
class QSK_EXPORT QskSkinHintStatus
|
class QSK_EXPORT QskSkinHintStatus
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum Source
|
enum Source : quint8
|
||||||
{
|
{
|
||||||
NoSource = 0,
|
NoSource = 0,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class QSK_EXPORT QskSliderSkinlet : public QskSkinlet
|
||||||
public:
|
public:
|
||||||
QSK_STATES( Filled )
|
QSK_STATES( Filled )
|
||||||
|
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
GrooveRole,
|
GrooveRole,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class QSK_EXPORT QskSpinBox : public QskBoundedValueInput
|
||||||
|
|
||||||
QSK_STATES( Decreasing, Increasing )
|
QSK_STATES( Decreasing, Increasing )
|
||||||
|
|
||||||
enum Decoration
|
enum Decoration : quint8
|
||||||
{
|
{
|
||||||
NoDecoration,
|
NoDecoration,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class QSK_EXPORT QskSpinBoxSkinlet : public QskSkinlet
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE QskSpinBoxSkinlet( QskSkin* = nullptr );
|
Q_INVOKABLE QskSpinBoxSkinlet( QskSkin* = nullptr );
|
||||||
|
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
TextPanelRole,
|
TextPanelRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskStatusIndicatorSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
GraphicRole,
|
GraphicRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class QSK_EXPORT QskSubWindow : public QskPopup
|
||||||
using Inherited = QskPopup;
|
using Inherited = QskPopup;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Decoration
|
enum Decoration : quint16
|
||||||
{
|
{
|
||||||
NoDecoration = 0,
|
NoDecoration = 0,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskSubWindowAreaSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskSubWindowSkinlet : public QskPopupSkinlet
|
||||||
using Inherited = QskPopupSkinlet;
|
using Inherited = QskPopupSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole = QskPopupSkinlet::RoleCount,
|
PanelRole = QskPopupSkinlet::RoleCount,
|
||||||
TitleBarRole,
|
TitleBarRole,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskSwitchButton : public QskAbstractButton
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Groove, Handle, Icon )
|
QSK_SUBCONTROLS( Groove, Handle, Icon )
|
||||||
|
|
||||||
enum IconMode
|
enum IconMode : quint8
|
||||||
{
|
{
|
||||||
NoIcon,
|
NoIcon,
|
||||||
ShowIconWhenSelected,
|
ShowIconWhenSelected,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskSwitchButtonSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
GrooveRole,
|
GrooveRole,
|
||||||
HandleRole,
|
HandleRole,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskTabButtonSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskTabViewSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PageRole,
|
PageRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#include "QskTextInput.h"
|
#include "QskTextField.h"
|
||||||
|
#include "QskTextFieldSkinlet.h"
|
||||||
#include "QskFontRole.h"
|
#include "QskFontRole.h"
|
||||||
#include "QskQuick.h"
|
#include "QskQuick.h"
|
||||||
|
|
||||||
|
|
@ -12,19 +13,14 @@ QSK_QT_PRIVATE_BEGIN
|
||||||
#include <private/qquicktextinput_p_p.h>
|
#include <private/qquicktextinput_p_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskTextInput, Panel )
|
QSK_SUBCONTROL( QskTextField, Panel )
|
||||||
QSK_SUBCONTROL( QskTextInput, Text )
|
QSK_SUBCONTROL( QskTextField, Text )
|
||||||
|
QSK_SUBCONTROL( QskTextField, PlaceholderText )
|
||||||
|
|
||||||
#if 1
|
QSK_SYSTEM_STATE( QskTextField, ReadOnly, QskAspect::FirstSystemState << 1 )
|
||||||
// shouldn't this be a Selected state, TODO ...
|
QSK_SYSTEM_STATE( QskTextField, Editing, QskAspect::FirstSystemState << 2 )
|
||||||
QSK_SUBCONTROL( QskTextInput, PanelSelected )
|
|
||||||
QSK_SUBCONTROL( QskTextInput, TextSelected )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskTextInput, ReadOnly, QskAspect::FirstSystemState << 1 )
|
static inline void qskPropagateReadOnly( QskTextField* input )
|
||||||
QSK_SYSTEM_STATE( QskTextInput, Editing, QskAspect::FirstSystemState << 2 )
|
|
||||||
|
|
||||||
static inline void qskPropagateReadOnly( QskTextInput* input )
|
|
||||||
{
|
{
|
||||||
Q_EMIT input->readOnlyChanged( input->isReadOnly() );
|
Q_EMIT input->readOnlyChanged( input->isReadOnly() );
|
||||||
|
|
||||||
|
|
@ -33,49 +29,49 @@ static inline void qskPropagateReadOnly( QskTextInput* input )
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void qskBindSignals(
|
static inline void qskBindSignals(
|
||||||
const QQuickTextInput* wrappedInput, QskTextInput* input )
|
const QQuickTextInput* input, QskTextField* field )
|
||||||
{
|
{
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::textChanged,
|
QObject::connect( input, &QQuickTextInput::textChanged,
|
||||||
input, [ input ] { Q_EMIT input->textChanged( input->text() ); } );
|
field, [ field ] { Q_EMIT field->textChanged( field->text() ); } );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::displayTextChanged,
|
QObject::connect( input, &QQuickTextInput::displayTextChanged,
|
||||||
input, [ input ] { Q_EMIT input->displayTextChanged( input->displayText() ); } );
|
field, [ field ] { Q_EMIT field->displayTextChanged( field->displayText() ); } );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::textEdited,
|
QObject::connect( input, &QQuickTextInput::textEdited,
|
||||||
input, [ input ] { Q_EMIT input->textEdited( input->text() ); } );
|
field, [ field ] { Q_EMIT field->textEdited( field->text() ); } );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::validatorChanged,
|
QObject::connect( input, &QQuickTextInput::validatorChanged,
|
||||||
input, &QskTextInput::validatorChanged );
|
field, &QskTextField::validatorChanged );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::inputMaskChanged,
|
QObject::connect( input, &QQuickTextInput::inputMaskChanged,
|
||||||
input, &QskTextInput::inputMaskChanged );
|
field, &QskTextField::inputMaskChanged );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::readOnlyChanged,
|
QObject::connect( input, &QQuickTextInput::readOnlyChanged,
|
||||||
input, [ input ] { qskPropagateReadOnly( input ); } );
|
field, [ field ] { qskPropagateReadOnly( field ); } );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::overwriteModeChanged,
|
QObject::connect( input, &QQuickTextInput::overwriteModeChanged,
|
||||||
input, &QskTextInput::overwriteModeChanged );
|
field, &QskTextField::overwriteModeChanged );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::maximumLengthChanged,
|
QObject::connect( input, &QQuickTextInput::maximumLengthChanged,
|
||||||
input, &QskTextInput::maximumLengthChanged );
|
field, &QskTextField::maximumLengthChanged );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::wrapModeChanged,
|
QObject::connect( input, &QQuickTextInput::wrapModeChanged,
|
||||||
input, [ input ] { Q_EMIT input->wrapModeChanged( input->wrapMode() ); } );
|
field, [ field ] { Q_EMIT field->wrapModeChanged( field->wrapMode() ); } );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::echoModeChanged,
|
QObject::connect( input, &QQuickTextInput::echoModeChanged,
|
||||||
input, [ input ] { Q_EMIT input->echoModeChanged( input->echoMode() ); } );
|
field, [ field ] { Q_EMIT field->echoModeChanged( field->echoMode() ); } );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::passwordCharacterChanged,
|
QObject::connect( input, &QQuickTextInput::passwordCharacterChanged,
|
||||||
input, &QskTextInput::passwordCharacterChanged );
|
field, &QskTextField::passwordCharacterChanged );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickTextInput::passwordMaskDelayChanged,
|
QObject::connect( input, &QQuickTextInput::passwordMaskDelayChanged,
|
||||||
input, &QskTextInput::passwordMaskDelayChanged );
|
field, &QskTextField::passwordMaskDelayChanged );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickItem::implicitWidthChanged,
|
QObject::connect( input, &QQuickItem::implicitWidthChanged,
|
||||||
input, &QskControl::resetImplicitSize );
|
field, &QskControl::resetImplicitSize );
|
||||||
|
|
||||||
QObject::connect( wrappedInput, &QQuickItem::implicitHeightChanged,
|
QObject::connect( input, &QQuickItem::implicitHeightChanged,
|
||||||
input, &QskControl::resetImplicitSize );
|
field, &QskControl::resetImplicitSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
|
@ -85,7 +81,7 @@ namespace
|
||||||
using Inherited = QQuickTextInput;
|
using Inherited = QQuickTextInput;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TextInput( QskTextInput* );
|
TextInput( QskTextField* );
|
||||||
|
|
||||||
void setEditing( bool on );
|
void setEditing( bool on );
|
||||||
|
|
||||||
|
|
@ -200,8 +196,8 @@ namespace
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TextInput::TextInput( QskTextInput* textInput )
|
TextInput::TextInput( QskTextField* textField )
|
||||||
: QQuickTextInput( textInput )
|
: QQuickTextInput( textField )
|
||||||
{
|
{
|
||||||
classBegin();
|
classBegin();
|
||||||
|
|
||||||
|
|
@ -237,22 +233,22 @@ namespace
|
||||||
|
|
||||||
void TextInput::updateMetrics()
|
void TextInput::updateMetrics()
|
||||||
{
|
{
|
||||||
auto input = static_cast< const QskTextInput* >( parentItem() );
|
auto textField = static_cast< const QskTextField* >( parentItem() );
|
||||||
|
|
||||||
setAlignment( input->alignment() );
|
setAlignment( textField->alignment() );
|
||||||
setFont( input->font() );
|
setFont( textField->font() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextInput::updateColors()
|
void TextInput::updateColors()
|
||||||
{
|
{
|
||||||
auto input = static_cast< const QskTextInput* >( parentItem() );
|
auto textField = static_cast< const QskTextField* >( parentItem() );
|
||||||
auto d = QQuickTextInputPrivate::get( this );
|
auto d = QQuickTextInputPrivate::get( this );
|
||||||
|
|
||||||
bool isDirty = false;
|
bool isDirty = false;
|
||||||
|
|
||||||
QColor color;
|
QColor color;
|
||||||
|
|
||||||
color = input->color( QskTextInput::Text );
|
color = textField->color( QskTextField::Text );
|
||||||
if ( d->color != color )
|
if ( d->color != color )
|
||||||
{
|
{
|
||||||
d->color = color;
|
d->color = color;
|
||||||
|
|
@ -261,14 +257,14 @@ namespace
|
||||||
|
|
||||||
if ( d->hasSelectedText() )
|
if ( d->hasSelectedText() )
|
||||||
{
|
{
|
||||||
color = input->color( QskTextInput::PanelSelected );
|
color = textField->color( QskTextField::Panel | QskTextFieldSkinlet::Selected );
|
||||||
if ( d->selectionColor != color )
|
if ( d->selectionColor != color )
|
||||||
{
|
{
|
||||||
d->selectionColor = color;
|
d->selectionColor = color;
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = input->color( QskTextInput::TextSelected );
|
color = textField->color( QskTextField::Text | QskTextFieldSkinlet::Selected );
|
||||||
if ( d->selectedTextColor != color )
|
if ( d->selectedTextColor != color )
|
||||||
{
|
{
|
||||||
d->selectedTextColor = color;
|
d->selectedTextColor = color;
|
||||||
|
|
@ -285,17 +281,17 @@ namespace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class QskTextInput::PrivateData
|
class QskTextField::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextInput* textInput;
|
TextInput* textInput;
|
||||||
QString description; // f.e. used as prompt in QskInputPanel
|
QString placeholderText;
|
||||||
|
|
||||||
unsigned int activationModes : 3;
|
unsigned int activationModes : 3;
|
||||||
bool hasPanel : 1;
|
bool hasPanel : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
QskTextInput::QskTextInput( QQuickItem* parent )
|
QskTextField::QskTextField( QQuickItem* parent )
|
||||||
: Inherited( parent )
|
: Inherited( parent )
|
||||||
, m_data( new PrivateData() )
|
, m_data( new PrivateData() )
|
||||||
{
|
{
|
||||||
|
|
@ -325,17 +321,17 @@ QskTextInput::QskTextInput( QQuickItem* parent )
|
||||||
initSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Fixed );
|
initSizePolicy( QskSizePolicy::Expanding, QskSizePolicy::Fixed );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextInput::QskTextInput( const QString& text, QQuickItem* parent )
|
QskTextField::QskTextField( const QString& text, QQuickItem* parent )
|
||||||
: QskTextInput( parent )
|
: QskTextField( parent )
|
||||||
{
|
{
|
||||||
m_data->textInput->setText( text );
|
m_data->textInput->setText( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextInput::~QskTextInput()
|
QskTextField::~QskTextField()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setPanel( bool on )
|
void QskTextField::setPanel( bool on )
|
||||||
{
|
{
|
||||||
if ( on != m_data->hasPanel )
|
if ( on != m_data->hasPanel )
|
||||||
{
|
{
|
||||||
|
|
@ -347,12 +343,12 @@ void QskTextInput::setPanel( bool on )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::hasPanel() const
|
bool QskTextField::hasPanel() const
|
||||||
{
|
{
|
||||||
return m_data->hasPanel;
|
return m_data->hasPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::event( QEvent* event )
|
bool QskTextField::event( QEvent* event )
|
||||||
{
|
{
|
||||||
if ( event->type() == QEvent::ShortcutOverride )
|
if ( event->type() == QEvent::ShortcutOverride )
|
||||||
{
|
{
|
||||||
|
|
@ -366,7 +362,7 @@ bool QskTextInput::event( QEvent* event )
|
||||||
return Inherited::event( event );
|
return Inherited::event( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::keyPressEvent( QKeyEvent* event )
|
void QskTextField::keyPressEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
if ( isEditing() )
|
if ( isEditing() )
|
||||||
{
|
{
|
||||||
|
|
@ -418,12 +414,12 @@ void QskTextInput::keyPressEvent( QKeyEvent* event )
|
||||||
Inherited::keyPressEvent( event );
|
Inherited::keyPressEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::keyReleaseEvent( QKeyEvent* event )
|
void QskTextField::keyReleaseEvent( QKeyEvent* event )
|
||||||
{
|
{
|
||||||
Inherited::keyReleaseEvent( event );
|
Inherited::keyReleaseEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::mousePressEvent( QMouseEvent* event )
|
void QskTextField::mousePressEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
m_data->textInput->handleEvent( event );
|
m_data->textInput->handleEvent( event );
|
||||||
|
|
||||||
|
|
@ -431,12 +427,12 @@ void QskTextInput::mousePressEvent( QMouseEvent* event )
|
||||||
setEditing( true );
|
setEditing( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::mouseMoveEvent( QMouseEvent* event )
|
void QskTextField::mouseMoveEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
m_data->textInput->handleEvent( event );
|
m_data->textInput->handleEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::mouseReleaseEvent( QMouseEvent* event )
|
void QskTextField::mouseReleaseEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
m_data->textInput->handleEvent( event );
|
m_data->textInput->handleEvent( event );
|
||||||
|
|
||||||
|
|
@ -444,17 +440,17 @@ void QskTextInput::mouseReleaseEvent( QMouseEvent* event )
|
||||||
setEditing( true );
|
setEditing( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::mouseDoubleClickEvent( QMouseEvent* event )
|
void QskTextField::mouseDoubleClickEvent( QMouseEvent* event )
|
||||||
{
|
{
|
||||||
m_data->textInput->handleEvent( event );
|
m_data->textInput->handleEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::inputMethodEvent( QInputMethodEvent* event )
|
void QskTextField::inputMethodEvent( QInputMethodEvent* event )
|
||||||
{
|
{
|
||||||
m_data->textInput->handleEvent( event );
|
m_data->textInput->handleEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::focusInEvent( QFocusEvent* event )
|
void QskTextField::focusInEvent( QFocusEvent* event )
|
||||||
{
|
{
|
||||||
if ( m_data->activationModes & ActivationOnFocus )
|
if ( m_data->activationModes & ActivationOnFocus )
|
||||||
{
|
{
|
||||||
|
|
@ -475,7 +471,7 @@ void QskTextInput::focusInEvent( QFocusEvent* event )
|
||||||
Inherited::focusInEvent( event );
|
Inherited::focusInEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::focusOutEvent( QFocusEvent* event )
|
void QskTextField::focusOutEvent( QFocusEvent* event )
|
||||||
{
|
{
|
||||||
switch ( event->reason() )
|
switch ( event->reason() )
|
||||||
{
|
{
|
||||||
|
|
@ -494,70 +490,48 @@ void QskTextInput::focusOutEvent( QFocusEvent* event )
|
||||||
Inherited::focusOutEvent( event );
|
Inherited::focusOutEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF QskTextInput::layoutSizeHint( Qt::SizeHint which, const QSizeF& ) const
|
void QskTextField::updateLayout()
|
||||||
{
|
{
|
||||||
if ( which != Qt::PreferredSize )
|
m_data->textInput->updateMetrics();
|
||||||
return QSizeF();
|
qskSetItemGeometry( m_data->textInput, subControlRect( Text ) );
|
||||||
|
|
||||||
auto input = m_data->textInput;
|
|
||||||
|
|
||||||
input->updateMetrics();
|
|
||||||
|
|
||||||
QSizeF hint( input->implicitWidth(), input->implicitHeight() );
|
|
||||||
|
|
||||||
if ( m_data->hasPanel )
|
|
||||||
{
|
|
||||||
hint = outerBoxSize( Panel, hint );
|
|
||||||
hint = hint.expandedTo( strutSizeHint( Panel ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return hint;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::updateLayout()
|
void QskTextField::updateNode( QSGNode* node )
|
||||||
{
|
|
||||||
auto input = m_data->textInput;
|
|
||||||
|
|
||||||
input->updateMetrics();
|
|
||||||
qskSetItemGeometry( input, subControlRect( Text ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void QskTextInput::updateNode( QSGNode* node )
|
|
||||||
{
|
{
|
||||||
m_data->textInput->updateColors();
|
m_data->textInput->updateColors();
|
||||||
Inherited::updateNode( node );
|
Inherited::updateNode( node );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskTextInput::text() const
|
QString QskTextField::text() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->text();
|
return m_data->textInput->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setText( const QString& text )
|
void QskTextField::setText( const QString& text )
|
||||||
{
|
{
|
||||||
m_data->textInput->setText( text );
|
m_data->textInput->setText( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setDescription( const QString& text )
|
void QskTextField::setPlaceholderText( const QString& text )
|
||||||
{
|
{
|
||||||
if ( m_data->description != text )
|
if ( m_data->placeholderText != text )
|
||||||
{
|
{
|
||||||
m_data->description = text;
|
m_data->placeholderText = text;
|
||||||
Q_EMIT descriptionChanged( text );
|
Q_EMIT placeholderTextChanged( text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskTextInput::description() const
|
QString QskTextField::placeholderText() const
|
||||||
{
|
{
|
||||||
return m_data->description;
|
return m_data->placeholderText;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 )
|
if ( static_cast< ActivationModes >( m_data->activationModes ) != modes )
|
||||||
{
|
{
|
||||||
|
|
@ -566,13 +540,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;
|
const auto queries = Qt::ImCursorRectangle | Qt::ImFont | Qt::ImAnchorRectangle;
|
||||||
qskUpdateInputMethod( input, queries );
|
qskUpdateInputMethod( input, queries );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setFontRole( const QskFontRole& role )
|
void QskTextField::setFontRole( const QskFontRole& role )
|
||||||
{
|
{
|
||||||
if ( setFontRoleHint( Text, role ) )
|
if ( setFontRoleHint( Text, role ) )
|
||||||
{
|
{
|
||||||
|
|
@ -581,7 +555,7 @@ void QskTextInput::setFontRole( const QskFontRole& role )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::resetFontRole()
|
void QskTextField::resetFontRole()
|
||||||
{
|
{
|
||||||
if ( resetFontRoleHint( Text ) )
|
if ( resetFontRoleHint( Text ) )
|
||||||
{
|
{
|
||||||
|
|
@ -590,12 +564,12 @@ void QskTextInput::resetFontRole()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QskFontRole QskTextInput::fontRole() const
|
QskFontRole QskTextField::fontRole() const
|
||||||
{
|
{
|
||||||
return fontRoleHint( Text );
|
return fontRoleHint( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setAlignment( Qt::Alignment alignment )
|
void QskTextField::setAlignment( Qt::Alignment alignment )
|
||||||
{
|
{
|
||||||
if ( setAlignmentHint( Text, alignment ) )
|
if ( setAlignmentHint( Text, alignment ) )
|
||||||
{
|
{
|
||||||
|
|
@ -604,7 +578,7 @@ void QskTextInput::setAlignment( Qt::Alignment alignment )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::resetAlignment()
|
void QskTextField::resetAlignment()
|
||||||
{
|
{
|
||||||
if ( resetAlignmentHint( Text ) )
|
if ( resetAlignmentHint( Text ) )
|
||||||
{
|
{
|
||||||
|
|
@ -613,34 +587,34 @@ void QskTextInput::resetAlignment()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::Alignment QskTextInput::alignment() const
|
Qt::Alignment QskTextField::alignment() const
|
||||||
{
|
{
|
||||||
return alignmentHint( Text, Qt::AlignLeft | Qt::AlignTop );
|
return alignmentHint( Text, Qt::AlignLeft | Qt::AlignTop );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setWrapMode( QskTextOptions::WrapMode wrapMode )
|
void QskTextField::setWrapMode( QskTextOptions::WrapMode wrapMode )
|
||||||
{
|
{
|
||||||
m_data->textInput->setWrapMode(
|
m_data->textInput->setWrapMode(
|
||||||
static_cast< QQuickTextInput::WrapMode >( wrapMode ) );
|
static_cast< QQuickTextInput::WrapMode >( wrapMode ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions::WrapMode QskTextInput::wrapMode() const
|
QskTextOptions::WrapMode QskTextField::wrapMode() const
|
||||||
{
|
{
|
||||||
return static_cast< QskTextOptions::WrapMode >(
|
return static_cast< QskTextOptions::WrapMode >(
|
||||||
m_data->textInput->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();
|
return m_data->textInput->isReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setReadOnly( bool on )
|
void QskTextField::setReadOnly( bool on )
|
||||||
{
|
{
|
||||||
auto input = m_data->textInput;
|
auto input = m_data->textInput;
|
||||||
|
|
||||||
|
|
@ -661,7 +635,7 @@ void QskTextInput::setReadOnly( bool on )
|
||||||
setSkinStateFlag( ReadOnly, on );
|
setSkinStateFlag( ReadOnly, on );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setEditing( bool on )
|
void QskTextField::setEditing( bool on )
|
||||||
{
|
{
|
||||||
if ( isReadOnly() || on == isEditing() )
|
if ( isReadOnly() || on == isEditing() )
|
||||||
return;
|
return;
|
||||||
|
|
@ -691,63 +665,63 @@ void QskTextInput::setEditing( bool on )
|
||||||
Q_EMIT editingChanged( on );
|
Q_EMIT editingChanged( on );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::isEditing() const
|
bool QskTextField::isEditing() const
|
||||||
{
|
{
|
||||||
return hasSkinState( Editing );
|
return hasSkinState( Editing );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::ensureVisible( int position )
|
void QskTextField::ensureVisible( int position )
|
||||||
{
|
{
|
||||||
m_data->textInput->ensureVisible( position );
|
m_data->textInput->ensureVisible( position );
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskTextInput::cursorPosition() const
|
int QskTextField::cursorPosition() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->cursorPosition();
|
return m_data->textInput->cursorPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setCursorPosition( int pos )
|
void QskTextField::setCursorPosition( int pos )
|
||||||
{
|
{
|
||||||
m_data->textInput->setCursorPosition( pos );
|
m_data->textInput->setCursorPosition( pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskTextInput::maxLength() const
|
int QskTextField::maxLength() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->maxLength();
|
return m_data->textInput->maxLength();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setMaxLength( int length )
|
void QskTextField::setMaxLength( int length )
|
||||||
{
|
{
|
||||||
m_data->textInput->setMaxLength( length );
|
m_data->textInput->setMaxLength( length );
|
||||||
}
|
}
|
||||||
|
|
||||||
QValidator* QskTextInput::validator() const
|
QValidator* QskTextField::validator() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->validator();
|
return m_data->textInput->validator();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setValidator( QValidator* validator )
|
void QskTextField::setValidator( QValidator* validator )
|
||||||
{
|
{
|
||||||
m_data->textInput->setValidator( validator );
|
m_data->textInput->setValidator( validator );
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskTextInput::inputMask() const
|
QString QskTextField::inputMask() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->inputMask();
|
return m_data->textInput->inputMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setInputMask( const QString& mask )
|
void QskTextField::setInputMask( const QString& mask )
|
||||||
{
|
{
|
||||||
m_data->textInput->setInputMask( mask );
|
m_data->textInput->setInputMask( mask );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextInput::EchoMode QskTextInput::echoMode() const
|
QskTextField::EchoMode QskTextField::echoMode() const
|
||||||
{
|
{
|
||||||
const auto mode = m_data->textInput->echoMode();
|
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() )
|
if ( mode != echoMode() )
|
||||||
{
|
{
|
||||||
|
|
@ -758,75 +732,75 @@ void QskTextInput::setEchoMode( EchoMode mode )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskTextInput::passwordCharacter() const
|
QString QskTextField::passwordCharacter() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->passwordCharacter();
|
return m_data->textInput->passwordCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setPasswordCharacter( const QString& text )
|
void QskTextField::setPasswordCharacter( const QString& text )
|
||||||
{
|
{
|
||||||
m_data->textInput->setPasswordCharacter( text );
|
m_data->textInput->setPasswordCharacter( text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::resetPasswordCharacter()
|
void QskTextField::resetPasswordCharacter()
|
||||||
{
|
{
|
||||||
m_data->textInput->setPasswordCharacter(
|
m_data->textInput->setPasswordCharacter(
|
||||||
QGuiApplication::styleHints()->passwordMaskCharacter() );
|
QGuiApplication::styleHints()->passwordMaskCharacter() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskTextInput::passwordMaskDelay() const
|
int QskTextField::passwordMaskDelay() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->passwordMaskDelay();
|
return m_data->textInput->passwordMaskDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setPasswordMaskDelay( int ms )
|
void QskTextField::setPasswordMaskDelay( int ms )
|
||||||
{
|
{
|
||||||
m_data->textInput->setPasswordMaskDelay( ms );
|
m_data->textInput->setPasswordMaskDelay( ms );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::resetPasswordMaskDelay()
|
void QskTextField::resetPasswordMaskDelay()
|
||||||
{
|
{
|
||||||
m_data->textInput->resetPasswordMaskDelay();
|
m_data->textInput->resetPasswordMaskDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskTextInput::displayText() const
|
QString QskTextField::displayText() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->displayText();
|
return m_data->textInput->displayText();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QskTextInput::preeditText() const
|
QString QskTextField::preeditText() const
|
||||||
{
|
{
|
||||||
const auto d = QQuickTextInputPrivate::get( m_data->textInput );
|
const auto d = QQuickTextInputPrivate::get( m_data->textInput );
|
||||||
return d->m_textLayout.preeditAreaText();
|
return d->m_textLayout.preeditAreaText();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::overwriteMode() const
|
bool QskTextField::overwriteMode() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->overwriteMode();
|
return m_data->textInput->overwriteMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setOverwriteMode( bool overwrite )
|
void QskTextField::setOverwriteMode( bool overwrite )
|
||||||
{
|
{
|
||||||
m_data->textInput->setOverwriteMode( overwrite );
|
m_data->textInput->setOverwriteMode( overwrite );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::hasAcceptableInput() const
|
bool QskTextField::hasAcceptableInput() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->hasAcceptableInput();
|
return m_data->textInput->hasAcceptableInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::fixup()
|
bool QskTextField::fixup()
|
||||||
{
|
{
|
||||||
return m_data->textInput->fixup();
|
return m_data->textInput->fixup();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QskTextInput::inputMethodQuery(
|
QVariant QskTextField::inputMethodQuery(
|
||||||
Qt::InputMethodQuery property ) const
|
Qt::InputMethodQuery property ) const
|
||||||
{
|
{
|
||||||
return inputMethodQuery( property, QVariant() );
|
return inputMethodQuery( property, QVariant() );
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QskTextInput::inputMethodQuery(
|
QVariant QskTextField::inputMethodQuery(
|
||||||
Qt::InputMethodQuery query, const QVariant& argument ) const
|
Qt::InputMethodQuery query, const QVariant& argument ) const
|
||||||
{
|
{
|
||||||
switch ( query )
|
switch ( query )
|
||||||
|
|
@ -860,22 +834,22 @@ QVariant QskTextInput::inputMethodQuery(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::canUndo() const
|
bool QskTextField::canUndo() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->canUndo();
|
return m_data->textInput->canUndo();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskTextInput::canRedo() const
|
bool QskTextField::canRedo() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->canRedo();
|
return m_data->textInput->canRedo();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::InputMethodHints QskTextInput::inputMethodHints() const
|
Qt::InputMethodHints QskTextField::inputMethodHints() const
|
||||||
{
|
{
|
||||||
return m_data->textInput->inputMethodHints();
|
return m_data->textInput->inputMethodHints();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setInputMethodHints( Qt::InputMethodHints hints )
|
void QskTextField::setInputMethodHints( Qt::InputMethodHints hints )
|
||||||
{
|
{
|
||||||
if ( m_data->textInput->inputMethodHints() != hints )
|
if ( m_data->textInput->inputMethodHints() != hints )
|
||||||
{
|
{
|
||||||
|
|
@ -884,7 +858,7 @@ void QskTextInput::setInputMethodHints( Qt::InputMethodHints hints )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextInput::setupFrom( const QQuickItem* item )
|
void QskTextField::setupFrom( const QQuickItem* item )
|
||||||
{
|
{
|
||||||
if ( item == nullptr )
|
if ( item == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
@ -892,7 +866,7 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||||
// finding attributes from the input hints of item
|
// finding attributes from the input hints of item
|
||||||
|
|
||||||
int maxCharacters = 32767;
|
int maxCharacters = 32767;
|
||||||
QskTextInput::EchoMode echoMode = QskTextInput::Normal;
|
QskTextField::EchoMode echoMode = QskTextField::Normal;
|
||||||
|
|
||||||
Qt::InputMethodQueries queries = Qt::ImQueryAll;
|
Qt::InputMethodQueries queries = Qt::ImQueryAll;
|
||||||
queries &= ~Qt::ImEnabled;
|
queries &= ~Qt::ImEnabled;
|
||||||
|
|
@ -906,7 +880,7 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||||
event.value( Qt::ImHints ).toInt() );
|
event.value( Qt::ImHints ).toInt() );
|
||||||
|
|
||||||
if ( hints & Qt::ImhHiddenText )
|
if ( hints & Qt::ImhHiddenText )
|
||||||
echoMode = QskTextInput::NoEcho;
|
echoMode = QskTextField::NoEcho;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( event.queries() & Qt::ImMaximumTextLength )
|
if ( event.queries() & Qt::ImMaximumTextLength )
|
||||||
|
|
@ -944,7 +918,7 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||||
int passwordMaskDelay = -1;
|
int passwordMaskDelay = -1;
|
||||||
QString passwordCharacter;
|
QString passwordCharacter;
|
||||||
|
|
||||||
if ( echoMode == QskTextInput::NoEcho )
|
if ( echoMode == QskTextField::NoEcho )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Qt::ImhHiddenText does not provide information
|
Qt::ImhHiddenText does not provide information
|
||||||
|
|
@ -967,8 +941,8 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||||
if ( value.canConvert< int >() )
|
if ( value.canConvert< int >() )
|
||||||
{
|
{
|
||||||
const auto mode = value.toInt();
|
const auto mode = value.toInt();
|
||||||
if ( mode == QskTextInput::Password )
|
if ( mode == QskTextField::Password )
|
||||||
echoMode = QskTextInput::Password;
|
echoMode = QskTextField::Password;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -985,4 +959,4 @@ void QskTextInput::setupFrom( const QQuickItem* item )
|
||||||
setEchoMode( echoMode );
|
setEchoMode( echoMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_QskTextInput.cpp"
|
#include "moc_QskTextField.cpp"
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef QSK_TEXT_INPUT_H
|
#ifndef QSK_TEXT_FIELD_H
|
||||||
#define QSK_TEXT_INPUT_H
|
#define QSK_TEXT_FIELD_H
|
||||||
|
|
||||||
#include "QskControl.h"
|
#include "QskControl.h"
|
||||||
#include "QskTextOptions.h"
|
#include "QskTextOptions.h"
|
||||||
|
|
@ -12,14 +12,14 @@
|
||||||
class QValidator;
|
class QValidator;
|
||||||
class QskFontRole;
|
class QskFontRole;
|
||||||
|
|
||||||
class QSK_EXPORT QskTextInput : public QskControl
|
class QSK_EXPORT QskTextField : public QskControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged USER true)
|
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged USER true)
|
||||||
|
|
||||||
Q_PROPERTY( QString description READ description
|
Q_PROPERTY( QString placeholderText READ placeholderText
|
||||||
WRITE setDescription NOTIFY descriptionChanged )
|
WRITE setPlaceholderText NOTIFY placeholderTextChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QskFontRole fontRole READ fontRole
|
Q_PROPERTY( QskFontRole fontRole READ fontRole
|
||||||
WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged )
|
WRITE setFontRole RESET resetFontRole NOTIFY fontRoleChanged )
|
||||||
|
|
@ -55,10 +55,10 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, Text, PanelSelected, TextSelected )
|
QSK_SUBCONTROLS( Panel, Text, PlaceholderText )
|
||||||
QSK_STATES( ReadOnly, Editing )
|
QSK_STATES( ReadOnly, Editing )
|
||||||
|
|
||||||
enum ActivationMode
|
enum ActivationMode : quint8
|
||||||
{
|
{
|
||||||
NoActivation,
|
NoActivation,
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||||
Q_ENUM( ActivationMode )
|
Q_ENUM( ActivationMode )
|
||||||
Q_DECLARE_FLAGS( ActivationModes, ActivationMode )
|
Q_DECLARE_FLAGS( ActivationModes, ActivationMode )
|
||||||
|
|
||||||
enum EchoMode
|
enum EchoMode : quint8
|
||||||
{
|
{
|
||||||
Normal,
|
Normal,
|
||||||
NoEcho,
|
NoEcho,
|
||||||
|
|
@ -83,17 +83,17 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||||
|
|
||||||
Q_ENUM( EchoMode )
|
Q_ENUM( EchoMode )
|
||||||
|
|
||||||
QskTextInput( QQuickItem* parent = nullptr );
|
QskTextField( QQuickItem* parent = nullptr );
|
||||||
QskTextInput( const QString& text, QQuickItem* parent = nullptr );
|
QskTextField( const QString& text, QQuickItem* parent = nullptr );
|
||||||
|
|
||||||
~QskTextInput() override;
|
~QskTextField() override;
|
||||||
|
|
||||||
void setupFrom( const QQuickItem* );
|
void setupFrom( const QQuickItem* );
|
||||||
|
|
||||||
QString text() const;
|
QString text() const;
|
||||||
|
|
||||||
void setDescription( const QString& );
|
void setPlaceholderText( const QString& );
|
||||||
QString description() const;
|
QString placeholderText() const;
|
||||||
|
|
||||||
void setPanel( bool );
|
void setPanel( bool );
|
||||||
bool hasPanel() const;
|
bool hasPanel() const;
|
||||||
|
|
@ -177,7 +177,7 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||||
void displayTextChanged( const QString& );
|
void displayTextChanged( const QString& );
|
||||||
|
|
||||||
void textEdited( const QString& );
|
void textEdited( const QString& );
|
||||||
void descriptionChanged( const QString& );
|
void placeholderTextChanged( const QString& );
|
||||||
|
|
||||||
void fontRoleChanged();
|
void fontRoleChanged();
|
||||||
void alignmentChanged();
|
void alignmentChanged();
|
||||||
|
|
@ -209,8 +209,6 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||||
void keyPressEvent( QKeyEvent* ) override;
|
void keyPressEvent( QKeyEvent* ) override;
|
||||||
void keyReleaseEvent( QKeyEvent* ) override;
|
void keyReleaseEvent( QKeyEvent* ) override;
|
||||||
|
|
||||||
QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
|
||||||
|
|
||||||
void updateLayout() override;
|
void updateLayout() override;
|
||||||
void updateNode( QSGNode* ) override;
|
void updateNode( QSGNode* ) override;
|
||||||
|
|
||||||
|
|
@ -219,7 +217,7 @@ class QSK_EXPORT QskTextInput : public QskControl
|
||||||
std::unique_ptr< PrivateData > m_data;
|
std::unique_ptr< PrivateData > m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QskTextInput::ActivationModes )
|
Q_DECLARE_OPERATORS_FOR_FLAGS( QskTextField::ActivationModes )
|
||||||
Q_DECLARE_METATYPE( QskTextInput::ActivationModes )
|
Q_DECLARE_METATYPE( QskTextField::ActivationModes )
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -0,0 +1,109 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* QSkinny - Copyright (C) The authors
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "QskTextFieldSkinlet.h"
|
||||||
|
#include "QskTextField.h"
|
||||||
|
|
||||||
|
#include <qfontmetrics.h>
|
||||||
|
|
||||||
|
using Q = QskTextField;
|
||||||
|
|
||||||
|
QSK_SYSTEM_STATE( QskTextFieldSkinlet, Selected, QskAspect::FirstUserState >> 1 )
|
||||||
|
|
||||||
|
QskTextFieldSkinlet::QskTextFieldSkinlet( QskSkin* skin )
|
||||||
|
: Inherited( skin )
|
||||||
|
{
|
||||||
|
setNodeRoles( { PanelRole, PlaceholderTextRole, } );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskTextFieldSkinlet::~QskTextFieldSkinlet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QRectF QskTextFieldSkinlet::subControlRect( const QskSkinnable* skinnable,
|
||||||
|
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
||||||
|
{
|
||||||
|
if ( subControl == Q::Panel )
|
||||||
|
{
|
||||||
|
return contentsRect;
|
||||||
|
}
|
||||||
|
else if ( subControl == Q::Text )
|
||||||
|
{
|
||||||
|
return skinnable->subControlContentsRect( contentsRect, Q::Panel );
|
||||||
|
}
|
||||||
|
else if ( subControl == Q::PlaceholderText )
|
||||||
|
{
|
||||||
|
const auto textField = static_cast< const QskTextField* >( skinnable );
|
||||||
|
if( textField->text().isEmpty() )
|
||||||
|
return subControlRect( skinnable, contentsRect, Q::Text );
|
||||||
|
|
||||||
|
return QRectF();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||||
|
}
|
||||||
|
|
||||||
|
QSGNode* QskTextFieldSkinlet::updateSubNode(
|
||||||
|
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||||
|
{
|
||||||
|
const auto textField = static_cast< const QskTextField* >( skinnable );
|
||||||
|
|
||||||
|
switch ( nodeRole )
|
||||||
|
{
|
||||||
|
case PanelRole:
|
||||||
|
{
|
||||||
|
if ( !textField->hasPanel() )
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
return updateBoxNode( skinnable, node, Q::Panel );
|
||||||
|
}
|
||||||
|
case PlaceholderTextRole:
|
||||||
|
{
|
||||||
|
if ( textField->text().isEmpty()
|
||||||
|
&& !textField->placeholderText().isEmpty() )
|
||||||
|
{
|
||||||
|
const auto subControl = Q::PlaceholderText;
|
||||||
|
|
||||||
|
QskSkinHintStatus status;
|
||||||
|
|
||||||
|
auto options = skinnable->textOptionsHint( subControl, &status );
|
||||||
|
if ( !status.isValid() )
|
||||||
|
options.setElideMode( Qt::ElideRight );
|
||||||
|
|
||||||
|
return updateTextNode( skinnable, node,
|
||||||
|
textField->subControlRect( subControl ),
|
||||||
|
textField->alignmentHint( subControl, Qt::AlignLeft ),
|
||||||
|
options, textField->placeholderText(), subControl );
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
|
}
|
||||||
|
|
||||||
|
QSizeF QskTextFieldSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
|
Qt::SizeHint which, const QSizeF& ) const
|
||||||
|
{
|
||||||
|
if ( which != Qt::PreferredSize )
|
||||||
|
return QSizeF();
|
||||||
|
|
||||||
|
const auto textField = static_cast< const QskTextField* >( skinnable );
|
||||||
|
|
||||||
|
const QFontMetricsF fm( textField->effectiveFont( Q::Text ) );
|
||||||
|
|
||||||
|
auto hint = fm.size( Qt::TextSingleLine | Qt::TextExpandTabs, textField->text() );
|
||||||
|
|
||||||
|
if ( textField->hasPanel() )
|
||||||
|
{
|
||||||
|
hint = textField->outerBoxSize( Q::Panel, hint );
|
||||||
|
hint = hint.expandedTo( textField->strutSizeHint( Q::Panel ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return hint;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_QskTextFieldSkinlet.cpp"
|
||||||
|
|
@ -3,30 +3,36 @@
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef QSK_TEXT_INPUT_SKINLET_H
|
#ifndef QSK_TEXT_FIELD_SKINLET_H
|
||||||
#define QSK_TEXT_INPUT_SKINLET_H
|
#define QSK_TEXT_FIELD_SKINLET_H
|
||||||
|
|
||||||
#include "QskSkinlet.h"
|
#include "QskSkinlet.h"
|
||||||
|
|
||||||
class QSK_EXPORT QskTextInputSkinlet : public QskSkinlet
|
class QSK_EXPORT QskTextFieldSkinlet : public QskSkinlet
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
|
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
QSK_STATES( Selected )
|
||||||
|
|
||||||
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
|
PlaceholderTextRole,
|
||||||
RoleCount
|
RoleCount
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_INVOKABLE QskTextInputSkinlet( QskSkin* = nullptr );
|
Q_INVOKABLE QskTextFieldSkinlet( QskSkin* = nullptr );
|
||||||
~QskTextInputSkinlet() override;
|
~QskTextFieldSkinlet() override;
|
||||||
|
|
||||||
QRectF subControlRect( const QskSkinnable*,
|
QRectF subControlRect( const QskSkinnable*,
|
||||||
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
const QRectF& rect, QskAspect::Subcontrol ) const override;
|
||||||
|
|
||||||
|
QSizeF sizeHint( const QskSkinnable*,
|
||||||
|
Qt::SizeHint, const QSizeF& ) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSGNode* updateSubNode( const QskSkinnable*,
|
QSGNode* updateSubNode( const QskSkinnable*,
|
||||||
quint8 nodeRole, QSGNode* ) const override;
|
quint8 nodeRole, QSGNode* ) const override;
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
/******************************************************************************
|
|
||||||
* QSkinny - Copyright (C) The authors
|
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include "QskTextInputSkinlet.h"
|
|
||||||
#include "QskTextInput.h"
|
|
||||||
|
|
||||||
QskTextInputSkinlet::QskTextInputSkinlet( QskSkin* skin )
|
|
||||||
: Inherited( skin )
|
|
||||||
{
|
|
||||||
setNodeRoles( { PanelRole } );
|
|
||||||
}
|
|
||||||
|
|
||||||
QskTextInputSkinlet::~QskTextInputSkinlet()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QRectF QskTextInputSkinlet::subControlRect( const QskSkinnable* skinnable,
|
|
||||||
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
|
|
||||||
{
|
|
||||||
if ( subControl == QskTextInput::Panel )
|
|
||||||
{
|
|
||||||
return contentsRect;
|
|
||||||
}
|
|
||||||
else if ( subControl == QskTextInput::Text )
|
|
||||||
{
|
|
||||||
return skinnable->subControlContentsRect( contentsRect, QskTextInput::Panel );
|
|
||||||
}
|
|
||||||
|
|
||||||
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
|
||||||
}
|
|
||||||
|
|
||||||
QSGNode* QskTextInputSkinlet::updateSubNode(
|
|
||||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
|
||||||
{
|
|
||||||
switch ( nodeRole )
|
|
||||||
{
|
|
||||||
case PanelRole:
|
|
||||||
{
|
|
||||||
const auto input = static_cast< const QskTextInput* >( skinnable );
|
|
||||||
if ( !input->hasPanel() )
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
return updateBoxNode( skinnable, node, QskTextInput::Panel );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_QskTextInputSkinlet.cpp"
|
|
||||||
|
|
@ -15,7 +15,7 @@ class QSK_EXPORT QskTextLabelSkinlet : public QskSkinlet
|
||||||
using Inherited = QskSkinlet;
|
using Inherited = QskSkinlet;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
PanelRole,
|
PanelRole,
|
||||||
TextRole,
|
TextRole,
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class QSK_EXPORT QskWindow : public QQuickWindow
|
||||||
using Inherited = QQuickWindow;
|
using Inherited = QQuickWindow;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum EventAcceptance
|
enum EventAcceptance : quint8
|
||||||
{
|
{
|
||||||
EventProcessed = 0,
|
EventProcessed = 0,
|
||||||
EventPropagationStopped = 1
|
EventPropagationStopped = 1
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class QSK_EXPORT QskDialog : public QObject
|
||||||
WRITE setTransientParent NOTIFY transientParentChanged )
|
WRITE setTransientParent NOTIFY transientParentChanged )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Policy
|
enum Policy : quint8
|
||||||
{
|
{
|
||||||
EmbeddedBox,
|
EmbeddedBox,
|
||||||
EmbeddedWindow, // not yet implemented, do we need it ?
|
EmbeddedWindow, // not yet implemented, do we need it ?
|
||||||
|
|
@ -41,7 +41,7 @@ class QSK_EXPORT QskDialog : public QObject
|
||||||
Q_ENUM( Policy )
|
Q_ENUM( Policy )
|
||||||
|
|
||||||
// a.k.a QMessageBox::StandardButton or QPlatformDialogHelper::StandardButton
|
// a.k.a QMessageBox::StandardButton or QPlatformDialogHelper::StandardButton
|
||||||
enum Action
|
enum Action : quint32
|
||||||
{
|
{
|
||||||
NoAction = 0,
|
NoAction = 0,
|
||||||
Ok = 1 << 10,
|
Ok = 1 << 10,
|
||||||
|
|
@ -68,7 +68,7 @@ class QSK_EXPORT QskDialog : public QObject
|
||||||
Q_DECLARE_FLAGS( Actions, Action )
|
Q_DECLARE_FLAGS( Actions, Action )
|
||||||
|
|
||||||
// a.k.a QMessageBox::ButtonRole
|
// a.k.a QMessageBox::ButtonRole
|
||||||
enum ActionRole
|
enum ActionRole : qint8
|
||||||
{
|
{
|
||||||
InvalidRole = -1,
|
InvalidRole = -1,
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ class QSK_EXPORT QskDialog : public QObject
|
||||||
Q_ENUM( ActionRole )
|
Q_ENUM( ActionRole )
|
||||||
|
|
||||||
// for building the mask in QskSkin::dialogButtonLayout
|
// for building the mask in QskSkin::dialogButtonLayout
|
||||||
enum ButtonLayoutFlag
|
enum ButtonLayoutFlag : quint32
|
||||||
{
|
{
|
||||||
// from QPlatformDialogHelper::ButtonRole
|
// from QPlatformDialogHelper::ButtonRole
|
||||||
ActionMask = 0x0FFFFFFF,
|
ActionMask = 0x0FFFFFFF,
|
||||||
|
|
@ -98,7 +98,7 @@ class QSK_EXPORT QskDialog : public QObject
|
||||||
Reverse = 1 << 30
|
Reverse = 1 << 30
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DialogCode
|
enum DialogCode : quint8
|
||||||
{
|
{
|
||||||
Rejected = 0,
|
Rejected = 0,
|
||||||
Accepted
|
Accepted
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ void QskDialogButtonBox::setActions( QskDialog::Actions actions )
|
||||||
m_data->buttons[ i ].clear();
|
m_data->buttons[ i ].clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( int i = QskDialog::Ok; i <= QskDialog::RestoreDefaults; i <<= 1 )
|
for ( uint i = QskDialog::Ok; i <= QskDialog::RestoreDefaults; i <<= 1 )
|
||||||
{
|
{
|
||||||
const auto action = static_cast< QskDialog::Action >( i );
|
const auto action = static_cast< QskDialog::Action >( i );
|
||||||
if ( action & actions )
|
if ( action & actions )
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ class QSK_EXPORT QskGraphic : public QPaintDevice
|
||||||
using Inherited = QPaintDevice;
|
using Inherited = QPaintDevice;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum RenderHint
|
enum RenderHint : quint8
|
||||||
{
|
{
|
||||||
RenderPensUnscaled = 0x1
|
RenderPensUnscaled = 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QFlags< RenderHint > RenderHints;
|
typedef QFlags< RenderHint > RenderHints;
|
||||||
|
|
||||||
enum CommandType
|
enum CommandType : quint8
|
||||||
{
|
{
|
||||||
VectorData = 1 << 0,
|
VectorData = 1 << 0,
|
||||||
RasterData = 1 << 1,
|
RasterData = 1 << 1,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ class QSK_EXPORT QskPainterCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//! Type of the paint command
|
//! Type of the paint command
|
||||||
enum Type
|
enum Type : qint8
|
||||||
{
|
{
|
||||||
//! Invalid command
|
//! Invalid command
|
||||||
Invalid = -1,
|
Invalid = -1,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace QskStandardSymbol
|
||||||
{
|
{
|
||||||
Q_NAMESPACE_EXPORT( QSK_EXPORT )
|
Q_NAMESPACE_EXPORT( QSK_EXPORT )
|
||||||
|
|
||||||
enum Type
|
enum Type : qint16
|
||||||
{
|
{
|
||||||
NoSymbol = -1,
|
NoSymbol = -1,
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include "QskInputPanelBox.h"
|
#include "QskInputPanelBox.h"
|
||||||
#include "QskInputPredictionBar.h"
|
#include "QskInputPredictionBar.h"
|
||||||
#include "QskLinearBox.h"
|
#include "QskLinearBox.h"
|
||||||
#include "QskTextInput.h"
|
#include "QskTextField.h"
|
||||||
#include "QskTextLabel.h"
|
#include "QskTextLabel.h"
|
||||||
#include "QskVirtualKeyboard.h"
|
#include "QskVirtualKeyboard.h"
|
||||||
|
|
||||||
|
|
@ -15,11 +15,11 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
class TextInputProxy final : public QskTextInput
|
class TextFieldProxy final : public QskTextField
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextInputProxy( QskInputPanelBox* panelBox, QQuickItem* parentItem = nullptr )
|
TextFieldProxy( QskInputPanelBox* panelBox, QQuickItem* parentItem = nullptr )
|
||||||
: QskTextInput( parentItem )
|
: QskTextField( parentItem )
|
||||||
, m_panelBox( panelBox )
|
, m_panelBox( panelBox )
|
||||||
{
|
{
|
||||||
setObjectName( QStringLiteral( "InputBoxProxy" ) );
|
setObjectName( QStringLiteral( "InputBoxProxy" ) );
|
||||||
|
|
@ -32,10 +32,10 @@ namespace
|
||||||
QskAspect::Subcontrol substitutedSubcontrol(
|
QskAspect::Subcontrol substitutedSubcontrol(
|
||||||
QskAspect::Subcontrol subControl ) const override
|
QskAspect::Subcontrol subControl ) const override
|
||||||
{
|
{
|
||||||
if ( subControl == QskTextInput::Panel )
|
if ( subControl == QskTextField::Panel )
|
||||||
return m_panelBox->effectiveSubcontrol( QskInputPanelBox::ProxyPanel );
|
return m_panelBox->effectiveSubcontrol( QskInputPanelBox::ProxyPanel );
|
||||||
|
|
||||||
if ( subControl == QskTextInput::Text )
|
if ( subControl == QskTextField::Text )
|
||||||
return m_panelBox->effectiveSubcontrol( QskInputPanelBox::ProxyText );
|
return m_panelBox->effectiveSubcontrol( QskInputPanelBox::ProxyText );
|
||||||
|
|
||||||
return subControl;
|
return subControl;
|
||||||
|
|
@ -65,7 +65,7 @@ class QskInputPanelBox::PrivateData
|
||||||
|
|
||||||
QskLinearBox* layout;
|
QskLinearBox* layout;
|
||||||
QskTextLabel* prompt;
|
QskTextLabel* prompt;
|
||||||
TextInputProxy* inputProxy;
|
TextFieldProxy* inputProxy;
|
||||||
QskInputPredictionBar* predictionBar;
|
QskInputPredictionBar* predictionBar;
|
||||||
QskVirtualKeyboard* keyboard;
|
QskVirtualKeyboard* keyboard;
|
||||||
|
|
||||||
|
|
@ -81,7 +81,7 @@ QskInputPanelBox::QskInputPanelBox( QQuickItem* parent )
|
||||||
m_data->prompt = new QskTextLabel();
|
m_data->prompt = new QskTextLabel();
|
||||||
m_data->prompt->setVisible( false );
|
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->inputProxy->setVisible(
|
||||||
m_data->panelHints & QskInputPanelBox::InputProxy );
|
m_data->panelHints & QskInputPanelBox::InputProxy );
|
||||||
|
|
||||||
|
|
@ -184,10 +184,10 @@ QskAspect::Subcontrol QskInputPanelBox::substitutedSubcontrol(
|
||||||
#if 1
|
#if 1
|
||||||
// TODO ...
|
// TODO ...
|
||||||
if ( subControl == QskInputPanelBox::ProxyPanel )
|
if ( subControl == QskInputPanelBox::ProxyPanel )
|
||||||
return QskTextInput::Panel;
|
return QskTextField::Panel;
|
||||||
|
|
||||||
if ( subControl == QskInputPanelBox::ProxyText )
|
if ( subControl == QskInputPanelBox::ProxyText )
|
||||||
return QskTextInput::Text;
|
return QskTextField::Text;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return subControl;
|
return subControl;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class QSK_EXPORT QskInputPanelBox : public QskBox
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, ProxyPanel, ProxyText )
|
QSK_SUBCONTROLS( Panel, ProxyPanel, ProxyText )
|
||||||
|
|
||||||
enum PanelHint
|
enum PanelHint : quint8
|
||||||
{
|
{
|
||||||
InputProxy = 1 << 0,
|
InputProxy = 1 << 0,
|
||||||
Prediction = 1 << 1
|
Prediction = 1 << 1
|
||||||
|
|
|
||||||
|
|
@ -51,17 +51,19 @@ class QSK_EXPORT QskVirtualKeyboard : public QskBox
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Panel, ButtonPanel, ButtonText )
|
QSK_SUBCONTROLS( Panel, ButtonPanel, ButtonText )
|
||||||
|
|
||||||
enum Mode
|
enum Mode : qint8
|
||||||
{
|
{
|
||||||
CurrentMode = -1,
|
CurrentMode = -1,
|
||||||
|
|
||||||
LowercaseMode,
|
LowercaseMode,
|
||||||
UppercaseMode,
|
UppercaseMode,
|
||||||
SpecialCharacterMode,
|
SpecialCharacterMode,
|
||||||
|
|
||||||
ModeCount
|
ModeCount
|
||||||
};
|
};
|
||||||
Q_ENUM( Mode )
|
Q_ENUM( Mode )
|
||||||
|
|
||||||
enum KeyType
|
enum KeyType : quint8
|
||||||
{
|
{
|
||||||
NormalType,
|
NormalType,
|
||||||
EnterType,
|
EnterType,
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class QskLayoutChain
|
||||||
QskLayoutMetrics metrics;
|
QskLayoutMetrics metrics;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FillMode
|
enum FillMode : quint8
|
||||||
{
|
{
|
||||||
Leading = 1 << 0,
|
Leading = 1 << 0,
|
||||||
Trailing = 1 << 1
|
Trailing = 1 << 1
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class QSK_EXPORT QskLayoutEngine2D
|
||||||
protected:
|
protected:
|
||||||
QRectF geometryAt( const QskLayoutElement*, const QRect& grid ) const;
|
QRectF geometryAt( const QskLayoutElement*, const QRect& grid ) const;
|
||||||
|
|
||||||
enum
|
enum : quint8
|
||||||
{
|
{
|
||||||
ElementCache = 1 << 0,
|
ElementCache = 1 << 0,
|
||||||
LayoutCache = 1 << 1
|
LayoutCache = 1 << 1
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,7 @@ void QskStackBoxAnimator2::setOrientation( Qt::Orientation orientation )
|
||||||
|
|
||||||
Qt::Orientation QskStackBoxAnimator2::orientation() const
|
Qt::Orientation QskStackBoxAnimator2::orientation() const
|
||||||
{
|
{
|
||||||
return m_orientation;
|
return static_cast< Qt::Orientation >( m_orientation );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskStackBoxAnimator2::setInverted( bool on )
|
void QskStackBoxAnimator2::setInverted( bool on )
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class QSK_EXPORT QskStackBoxAnimator2 : public QskStackBoxAnimator
|
||||||
void done() override;
|
void done() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Qt::Orientation m_orientation : 2;
|
unsigned int m_orientation : 2;
|
||||||
bool m_inverted : 1;
|
bool m_inverted : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum NodeRole
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
If possible border + filling will be displayed by ArcRole
|
If possible border + filling will be displayed by ArcRole
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
enum Role
|
enum NodeRole : quint8
|
||||||
{
|
{
|
||||||
ShadowRole,
|
ShadowRole,
|
||||||
ShadowFillRole,
|
ShadowFillRole,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class QSK_EXPORT QskFillNode : public QSGGeometryNode
|
||||||
using Inherited = QSGGeometryNode;
|
using Inherited = QSGGeometryNode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Coloring
|
enum Coloring : quint8
|
||||||
{
|
{
|
||||||
Monochrome,
|
Monochrome,
|
||||||
Polychrome,
|
Polychrome,
|
||||||
|
|
@ -30,7 +30,7 @@ class QSK_EXPORT QskFillNode : public QSGGeometryNode
|
||||||
Conic
|
Conic
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Hint
|
enum Hint : quint8
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Colors might be defined in the material ( QskGradientMaterial,
|
Colors might be defined in the material ( QskGradientMaterial,
|
||||||
|
|
@ -46,7 +46,7 @@ class QSK_EXPORT QskFillNode : public QSGGeometryNode
|
||||||
The default setting is to use colored points where possible. Note, that
|
The default setting is to use colored points where possible. Note, that
|
||||||
this is what is also done in the Qt/Quick classes.
|
this is what is also done in the Qt/Quick classes.
|
||||||
*/
|
*/
|
||||||
PreferColoredGeometry = 1
|
PreferColoredGeometry = 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_ENUM( Hint )
|
Q_ENUM( Hint )
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class QSK_EXPORT QskGraduationNode : public QskBasicLinesNode
|
||||||
using Inherited = QskBasicLinesNode;
|
using Inherited = QskBasicLinesNode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Alignment
|
enum Alignment : quint8
|
||||||
{
|
{
|
||||||
Leading,
|
Leading,
|
||||||
Centered,
|
Centered,
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class QSK_EXPORT QskGraduationRenderer
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Flag
|
enum Flag : quint8
|
||||||
{
|
{
|
||||||
Backbone = 1 << 0,
|
Backbone = 1 << 0,
|
||||||
CenteredTickmarks = 1 << 1,
|
CenteredTickmarks = 1 << 1,
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class QSK_EXPORT QskPaintedNode : public QSGNode
|
||||||
OpenGL might be ignored depending on the backend used by the
|
OpenGL might be ignored depending on the backend used by the
|
||||||
application.
|
application.
|
||||||
*/
|
*/
|
||||||
enum RenderHint
|
enum RenderHint : quint8
|
||||||
{
|
{
|
||||||
Raster,
|
Raster,
|
||||||
OpenGL
|
OpenGL
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue