QskTextOptions as skin hints
This commit is contained in:
parent
45be53c08a
commit
896145ac11
@ -177,17 +177,17 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
|
|||||||
{
|
{
|
||||||
const QString valueText = QString::number( display->value(), 'f', 0 )
|
const QString valueText = QString::number( display->value(), 'f', 0 )
|
||||||
+ QStringLiteral( " %" );
|
+ QStringLiteral( " %" );
|
||||||
return updateTextNode( skinnable, node, valueText, {},
|
return updateTextNode( skinnable, node, valueText,
|
||||||
LightDisplay::ValueText );
|
LightDisplay::ValueText );
|
||||||
}
|
}
|
||||||
case LeftLabelRole:
|
case LeftLabelRole:
|
||||||
{
|
{
|
||||||
return updateTextNode( skinnable, node, QStringLiteral( "0 " ), {},
|
return updateTextNode( skinnable, node, QStringLiteral( "0 " ),
|
||||||
LightDisplay::LeftLabel );
|
LightDisplay::LeftLabel );
|
||||||
}
|
}
|
||||||
case RightLabelRole:
|
case RightLabelRole:
|
||||||
{
|
{
|
||||||
return updateTextNode( skinnable, node, QStringLiteral( " 100" ), {},
|
return updateTextNode( skinnable, node, QStringLiteral( " 100" ),
|
||||||
LightDisplay::RightLabel );
|
LightDisplay::RightLabel );
|
||||||
}
|
}
|
||||||
case KnobRole:
|
case KnobRole:
|
||||||
|
@ -97,15 +97,13 @@ QSGNode* MyToggleButtonSkinlet::updateSubNode(
|
|||||||
case CheckedLabelRole:
|
case CheckedLabelRole:
|
||||||
{
|
{
|
||||||
return updateTextNode(
|
return updateTextNode(
|
||||||
button, node, button->text( true ),
|
button, node, button->text( true ), Q::CheckedText );
|
||||||
button->textOptions(), Q::CheckedText );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case UncheckedLabelRole:
|
case UncheckedLabelRole:
|
||||||
{
|
{
|
||||||
return updateTextNode(
|
return updateTextNode(
|
||||||
button, node, button->text( false ),
|
button, node, button->text( false ), Q::UncheckedText );
|
||||||
button->textOptions(), Q::UncheckedText );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
case CheckedGraphicRole:
|
case CheckedGraphicRole:
|
||||||
|
@ -216,6 +216,7 @@ void Editor::setupCheckBox()
|
|||||||
setColor( Q::Indicator | Q::Checked | Q::Disabled, m_pal.onSurface38 );
|
setColor( Q::Indicator | Q::Checked | Q::Disabled, m_pal.onSurface38 );
|
||||||
|
|
||||||
setColor( Q::Text, m_pal.onBackground );
|
setColor( Q::Text, m_pal.onBackground );
|
||||||
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupBox()
|
void Editor::setupBox()
|
||||||
@ -422,11 +423,13 @@ void Editor::setupSegmentedBar()
|
|||||||
// Text
|
// Text
|
||||||
|
|
||||||
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
|
||||||
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
setColor( Q::Text, m_pal.onSurface );
|
setColor( Q::Text, m_pal.onSurface );
|
||||||
setColor( Q::Text | Q::Selected, m_pal.onSecondaryContainer );
|
setColor( Q::Text | Q::Selected, m_pal.onSecondaryContainer );
|
||||||
|
|
||||||
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -519,6 +522,8 @@ void Editor::setupPushButton()
|
|||||||
setColor( Q::Text, m_pal.onPrimary );
|
setColor( Q::Text, m_pal.onPrimary );
|
||||||
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
|
||||||
|
|
||||||
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
setAnimation( Q::Panel | A::Color, qskDuration );
|
setAnimation( Q::Panel | A::Color, qskDuration );
|
||||||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||||
setAnimation( Q::Ripple | A::Color, qskDuration );
|
setAnimation( Q::Ripple | A::Color, qskDuration );
|
||||||
@ -875,6 +880,8 @@ void Editor::setupSubWindow()
|
|||||||
setColor( Q::TitleBarText, m_pal.onSurface );
|
setColor( Q::TitleBarText, m_pal.onSurface );
|
||||||
setAlignment( Q::TitleBarText, Qt::AlignCenter );
|
setAlignment( Q::TitleBarText, Qt::AlignCenter );
|
||||||
|
|
||||||
|
setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } )
|
for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } )
|
||||||
setAnimation( subControl | A::Color, qskDuration );
|
setAnimation( subControl | A::Color, qskDuration );
|
||||||
|
|
||||||
|
@ -323,6 +323,8 @@ void Editor::setupCheckBox()
|
|||||||
setColor( Q::Indicator, m_pal.darker200 );
|
setColor( Q::Indicator, m_pal.darker200 );
|
||||||
setColor( Q::Indicator | Q::Checked, m_pal.lighter135 );
|
setColor( Q::Indicator | Q::Checked, m_pal.lighter135 );
|
||||||
|
|
||||||
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
setFlagHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
setFlagHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||||
setColor( Q::Text, m_pal.themeForeground );
|
setColor( Q::Text, m_pal.themeForeground );
|
||||||
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
|
setColor( Q::Text | Q::Disabled, m_pal.darker200 );
|
||||||
@ -531,6 +533,8 @@ void Editor::setupSegmentedBar()
|
|||||||
{
|
{
|
||||||
// Text
|
// Text
|
||||||
|
|
||||||
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
setColor( Q::Text, m_pal.themeForeground );
|
setColor( Q::Text, m_pal.themeForeground );
|
||||||
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
setColor( Q::Text | Q::Selected, m_pal.highlightedText );
|
||||||
|
|
||||||
@ -599,6 +603,9 @@ void Editor::setupPushButton()
|
|||||||
setAnimation( Q::Panel | A::Metric, qskDuration );
|
setAnimation( Q::Panel | A::Metric, qskDuration );
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
|
|
||||||
|
setTextOptions( Q::Text, Qt::ElideMiddle, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
setFlagHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
setFlagHint( Q::Text | Q::Disabled | A::Style, Qsk::Sunken );
|
||||||
setAlignment( Q::Text, Qt::AlignCenter );
|
setAlignment( Q::Text, Qt::AlignCenter );
|
||||||
|
|
||||||
@ -989,6 +996,9 @@ void Editor::setupSubWindow()
|
|||||||
setBoxShape( Q::TitleBarPanel, radius, radius, 0, 0, Qt::AbsoluteSize );
|
setBoxShape( Q::TitleBarPanel, radius, radius, 0, 0, Qt::AbsoluteSize );
|
||||||
|
|
||||||
// TitleBarText
|
// TitleBarText
|
||||||
|
|
||||||
|
setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
setFontRole( Q::TitleBarText, QskSkin::SmallFont );
|
setFontRole( Q::TitleBarText, QskSkin::SmallFont );
|
||||||
setColor( Q::TitleBarText | Q::Focused, m_pal.highlightedText );
|
setColor( Q::TitleBarText | Q::Focused, m_pal.highlightedText );
|
||||||
setColor( Q::TitleBarText, m_pal.themeForeground );
|
setColor( Q::TitleBarText, m_pal.themeForeground );
|
||||||
|
@ -46,6 +46,8 @@ class QSK_EXPORT QskAspect
|
|||||||
Alignment,
|
Alignment,
|
||||||
Direction,
|
Direction,
|
||||||
Style,
|
Style,
|
||||||
|
Option,
|
||||||
|
|
||||||
GraphicRole,
|
GraphicRole,
|
||||||
FontRole,
|
FontRole,
|
||||||
|
|
||||||
|
@ -6,6 +6,13 @@
|
|||||||
#include "QskTextOptions.h"
|
#include "QskTextOptions.h"
|
||||||
#include <qtextdocument.h>
|
#include <qtextdocument.h>
|
||||||
|
|
||||||
|
static void qskRegisterTextOptions()
|
||||||
|
{
|
||||||
|
qRegisterMetaType< QskTextOptions >();
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_CONSTRUCTOR_FUNCTION( qskRegisterTextOptions )
|
||||||
|
|
||||||
int QskTextOptions::textFlags() const noexcept
|
int QskTextOptions::textFlags() const noexcept
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
@ -146,11 +146,8 @@ QSGNode* QskCheckBoxSkinlet::updateTextNode(
|
|||||||
const auto rect = checkBox->subControlRect( Q::Text );
|
const auto rect = checkBox->subControlRect( Q::Text );
|
||||||
const auto alignH = checkBox->layoutMirroring() ? Qt::AlignRight : Qt::AlignLeft;
|
const auto alignH = checkBox->layoutMirroring() ? Qt::AlignRight : Qt::AlignLeft;
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
|
||||||
textOptions.setElideMode( Qt::ElideMiddle );
|
|
||||||
|
|
||||||
return QskSkinlet::updateTextNode( checkBox, node, rect, alignH | Qt::AlignVCenter,
|
return QskSkinlet::updateTextNode( checkBox, node, rect, alignH | Qt::AlignVCenter,
|
||||||
checkBox->text(), textOptions, QskCheckBox::Text );
|
checkBox->text(), QskCheckBox::Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSizeF QskCheckBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
|
QSizeF QskCheckBoxSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
|
@ -29,7 +29,6 @@ class QskListView::PrivateData
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
|
||||||
bool preferredWidthFromColumns : 1;
|
bool preferredWidthFromColumns : 1;
|
||||||
bool alternatingRowColors : 1;
|
bool alternatingRowColors : 1;
|
||||||
SelectionMode selectionMode : 4;
|
SelectionMode selectionMode : 4;
|
||||||
@ -81,18 +80,16 @@ bool QskListView::alternatingRowColors() const
|
|||||||
|
|
||||||
void QskListView::setTextOptions( const QskTextOptions& textOptions )
|
void QskListView::setTextOptions( const QskTextOptions& textOptions )
|
||||||
{
|
{
|
||||||
if ( textOptions != m_data->textOptions )
|
if ( setTextOptionsHint( Text, textOptions ) )
|
||||||
{
|
{
|
||||||
m_data->textOptions = textOptions;
|
|
||||||
updateScrollableSize();
|
updateScrollableSize();
|
||||||
|
|
||||||
Q_EMIT textOptionsChanged();
|
Q_EMIT textOptionsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions QskListView::textOptions() const
|
QskTextOptions QskListView::textOptions() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions;
|
return textOptionsHint( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskListView::setSelectedRow( int row )
|
void QskListView::setSelectedRow( int row )
|
||||||
|
@ -476,7 +476,7 @@ QSGNode* QskListViewSkinlet::updateCellNode( const QskListView* listView,
|
|||||||
newNode = contentNode;
|
newNode = contentNode;
|
||||||
|
|
||||||
newNode = updateTextNode( listView, newNode, rect, alignment,
|
newNode = updateTextNode( listView, newNode, rect, alignment,
|
||||||
value.toString(), listView->textOptions(), QskListView::Text );
|
value.toString(), QskListView::Text );
|
||||||
|
|
||||||
if ( newNode )
|
if ( newNode )
|
||||||
setNodeRole( newNode, TextRole );
|
setNodeRole( newNode, TextRole );
|
||||||
|
@ -60,7 +60,6 @@ class QskMenu::PrivateData
|
|||||||
QVector< Option > options;
|
QVector< Option > options;
|
||||||
QVector< int > separators;
|
QVector< int > separators;
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
|
||||||
QPointF origin;
|
QPointF origin;
|
||||||
|
|
||||||
// current/selected are not well defined yet, TODO ...
|
// current/selected are not well defined yet, TODO ...
|
||||||
@ -188,16 +187,12 @@ QVariantList QskMenu::optionAt( int index ) const
|
|||||||
|
|
||||||
void QskMenu::setTextOptions( const QskTextOptions& textOptions )
|
void QskMenu::setTextOptions( const QskTextOptions& textOptions )
|
||||||
{
|
{
|
||||||
if( textOptions != m_data->textOptions )
|
setTextOptionsHint( Text, textOptions );
|
||||||
{
|
|
||||||
m_data->textOptions = textOptions;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions QskMenu::textOptions() const
|
QskTextOptions QskMenu::textOptions() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions;
|
return textOptionsHint( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskMenu::setCurrentIndex( int index )
|
void QskMenu::setCurrentIndex( int index )
|
||||||
|
@ -525,8 +525,8 @@ QSGNode* QskMenuSkinlet::updateSampleNode( const QskSkinnable* skinnable,
|
|||||||
const auto alignment = menu->alignmentHint(
|
const auto alignment = menu->alignmentHint(
|
||||||
subControl, Qt::AlignVCenter | Qt::AlignLeft );
|
subControl, Qt::AlignVCenter | Qt::AlignLeft );
|
||||||
|
|
||||||
return QskSkinlet::updateTextNode( menu, node, rect, alignment,
|
return QskSkinlet::updateTextNode( menu, node, rect,
|
||||||
text, menu->textOptions(), Q::Text );
|
alignment, text, Q::Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( subControl == Q::Separator )
|
if ( subControl == Q::Separator )
|
||||||
|
@ -29,7 +29,6 @@ class QskPushButton::PrivateData
|
|||||||
, isCheckable( false )
|
, isCheckable( false )
|
||||||
, isGraphicSourceDirty( false )
|
, isGraphicSourceDirty( false )
|
||||||
{
|
{
|
||||||
textOptions.setElideMode( Qt::ElideMiddle );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ensureGraphic( const QskPushButton* button )
|
void ensureGraphic( const QskPushButton* button )
|
||||||
@ -44,7 +43,6 @@ class QskPushButton::PrivateData
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
QskTextOptions textOptions;
|
|
||||||
|
|
||||||
QUrl graphicSource;
|
QUrl graphicSource;
|
||||||
QskGraphic graphic;
|
QskGraphic graphic;
|
||||||
@ -118,22 +116,21 @@ QString QskPushButton::text() const
|
|||||||
return m_data->text;
|
return m_data->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskPushButton::setTextOptions( const QskTextOptions& options )
|
void QskPushButton::setTextOptions( const QskTextOptions& textOptions )
|
||||||
{
|
{
|
||||||
if ( options != m_data->textOptions )
|
if ( setTextOptionsHint( Text, textOptions ) )
|
||||||
{
|
|
||||||
m_data->textOptions = options;
|
|
||||||
|
|
||||||
resetImplicitSize();
|
|
||||||
update();
|
|
||||||
|
|
||||||
Q_EMIT textOptionsChanged();
|
Q_EMIT textOptionsChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QskTextOptions QskPushButton::textOptions() const
|
QskTextOptions QskPushButton::textOptions() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions;
|
return textOptionsHint( Text );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskPushButton::resetTextOptions()
|
||||||
|
{
|
||||||
|
if ( resetTextOptionsHint( Text ) )
|
||||||
|
Q_EMIT textOptionsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont QskPushButton::font() const
|
QFont QskPushButton::font() const
|
||||||
|
@ -21,7 +21,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
|||||||
Q_PROPERTY( QFont font READ font )
|
Q_PROPERTY( QFont font READ font )
|
||||||
|
|
||||||
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
||||||
WRITE setTextOptions NOTIFY textOptionsChanged )
|
WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QUrl graphicSource READ graphicSource
|
Q_PROPERTY( QUrl graphicSource READ graphicSource
|
||||||
WRITE setGraphicSource NOTIFY graphicSourceChanged FINAL )
|
WRITE setGraphicSource NOTIFY graphicSourceChanged FINAL )
|
||||||
@ -60,6 +60,7 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
|
|||||||
|
|
||||||
void setTextOptions( const QskTextOptions& );
|
void setTextOptions( const QskTextOptions& );
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
void resetTextOptions();
|
||||||
|
|
||||||
void setGraphicStrutSize( const QSizeF& );
|
void setGraphicStrutSize( const QSizeF& );
|
||||||
QSizeF graphicStrutSize() const;
|
QSizeF graphicStrutSize() const;
|
||||||
|
@ -243,8 +243,8 @@ QSGNode* QskPushButtonSkinlet::updateTextNode(
|
|||||||
|
|
||||||
const auto alignment = button->alignmentHint( Q::Text, Qt::AlignCenter );
|
const auto alignment = button->alignmentHint( Q::Text, Qt::AlignCenter );
|
||||||
|
|
||||||
return QskSkinlet::updateTextNode( button, node, rect, alignment,
|
return QskSkinlet::updateTextNode( button, node, rect,
|
||||||
button->text(), button->textOptions(), Q::Text );
|
alignment, button->text(), Q::Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskPushButtonSkinlet::updateRippleNode(
|
QSGNode* QskPushButtonSkinlet::updateRippleNode(
|
||||||
|
@ -60,7 +60,6 @@ class QskSegmentedBar::PrivateData
|
|||||||
PrivateData( Qt::Orientation orientation )
|
PrivateData( Qt::Orientation orientation )
|
||||||
: orientation( orientation )
|
: orientation( orientation )
|
||||||
{
|
{
|
||||||
textOptions.setElideMode( Qt::ElideMiddle );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void addOption( QskSegmentedBar* bar, const Option& option )
|
void addOption( QskSegmentedBar* bar, const Option& option )
|
||||||
@ -78,8 +77,6 @@ class QskSegmentedBar::PrivateData
|
|||||||
|
|
||||||
QVector< Option > options;
|
QVector< Option > options;
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
|
||||||
|
|
||||||
int selectedIndex = -1;
|
int selectedIndex = -1;
|
||||||
int currentIndex = -1;
|
int currentIndex = -1;
|
||||||
|
|
||||||
@ -132,16 +129,12 @@ Qt::Orientation QskSegmentedBar::orientation() const
|
|||||||
|
|
||||||
void QskSegmentedBar::setTextOptions( const QskTextOptions& textOptions )
|
void QskSegmentedBar::setTextOptions( const QskTextOptions& textOptions )
|
||||||
{
|
{
|
||||||
if( textOptions != m_data->textOptions )
|
setTextOptionsHint( Text, textOptions );
|
||||||
{
|
|
||||||
m_data->textOptions = textOptions;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions QskSegmentedBar::textOptions() const
|
QskTextOptions QskSegmentedBar::textOptions() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions;
|
return textOptionsHint( Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
int QskSegmentedBar::addText( const QString& text )
|
int QskSegmentedBar::addText( const QString& text )
|
||||||
|
@ -331,7 +331,7 @@ QSGNode* QskSegmentedBarSkinlet::updateSampleNode( const QskSkinnable* skinnable
|
|||||||
const auto text = value.value< QString >();
|
const auto text = value.value< QString >();
|
||||||
|
|
||||||
return QskSkinlet::updateTextNode( bar, node,
|
return QskSkinlet::updateTextNode( bar, node,
|
||||||
rect, alignment, text, bar->textOptions(), Q::Text );
|
rect, alignment, text, Q::Text );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -120,6 +120,11 @@ namespace
|
|||||||
{
|
{
|
||||||
return aspect | QskAspect::Shadow;
|
return aspect | QskAspect::Shadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline QskAspect aspectOption( QskAspect aspect )
|
||||||
|
{
|
||||||
|
return aspect | QskAspect::Option;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QskSkinHintTableEditor::QskSkinHintTableEditor( QskSkinHintTable* table )
|
QskSkinHintTableEditor::QskSkinHintTableEditor( QskSkinHintTable* table )
|
||||||
@ -572,3 +577,31 @@ QskArcMetrics QskSkinHintTableEditor::arcMetrics( QskAspect aspect ) const
|
|||||||
{
|
{
|
||||||
return metricHint< QskArcMetrics >( aspectShape( aspect ) );
|
return metricHint< QskArcMetrics >( aspectShape( aspect ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QskSkinHintTableEditor::setTextOptions( QskAspect aspect,
|
||||||
|
Qt::TextElideMode elideMode, QskTextOptions::WrapMode wrapMode,
|
||||||
|
QskStateCombination combination )
|
||||||
|
{
|
||||||
|
QskTextOptions options;
|
||||||
|
options.setElideMode( elideMode );
|
||||||
|
options.setWrapMode( wrapMode );
|
||||||
|
|
||||||
|
setTextOptions( aspect, options, combination );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskSkinHintTableEditor::setTextOptions( QskAspect aspect,
|
||||||
|
const QskTextOptions& textOptions, QskStateCombination combination )
|
||||||
|
{
|
||||||
|
setFlagHint( aspectOption( aspect ), textOptions, combination );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QskSkinHintTableEditor::removeTextOptions(
|
||||||
|
QskAspect aspect, QskStateCombination combination )
|
||||||
|
{
|
||||||
|
return removeFlagHint( aspectOption( aspect ), combination );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskTextOptions QskSkinHintTableEditor::textOptions( QskAspect aspect ) const
|
||||||
|
{
|
||||||
|
return flagHint< QskTextOptions >( aspectOption( aspect ) );
|
||||||
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "QskSkinHintTable.h"
|
#include "QskSkinHintTable.h"
|
||||||
#include "QskAnimationHint.h"
|
#include "QskAnimationHint.h"
|
||||||
#include "QskStateCombination.h"
|
#include "QskStateCombination.h"
|
||||||
|
#include "QskTextOptions.h"
|
||||||
|
|
||||||
#include <qcolor.h>
|
#include <qcolor.h>
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
@ -272,6 +273,18 @@ class QSK_EXPORT QskSkinHintTableEditor
|
|||||||
|
|
||||||
QskArcMetrics arcMetrics( QskAspect ) const;
|
QskArcMetrics arcMetrics( QskAspect ) const;
|
||||||
|
|
||||||
|
// text options flag
|
||||||
|
|
||||||
|
void setTextOptions( QskAspect,
|
||||||
|
Qt::TextElideMode, QskTextOptions::WrapMode,
|
||||||
|
QskStateCombination = QskStateCombination() );
|
||||||
|
|
||||||
|
void setTextOptions( QskAspect,
|
||||||
|
const QskTextOptions&, QskStateCombination = QskStateCombination() );
|
||||||
|
|
||||||
|
bool removeTextOptions( QskAspect, QskStateCombination = QskStateCombination() );
|
||||||
|
QskTextOptions textOptions( QskAspect ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QskSkinHintTable* m_table = nullptr;
|
QskSkinHintTable* m_table = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -587,13 +587,13 @@ QSGNode* QskSkinlet::updateTextNode( const QskSkinnable* skinnable,
|
|||||||
QSGNode* QskSkinlet::updateTextNode(
|
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, const QskTextOptions& textOptions,
|
const QString& text, QskAspect::Subcontrol subControl )
|
||||||
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 textColors = qskTextColors( skinnable, subControl );
|
||||||
|
const auto textOptions = skinnable->textOptionsHint( subControl );
|
||||||
|
|
||||||
auto textStyle = Qsk::Normal;
|
auto textStyle = Qsk::Normal;
|
||||||
if ( textColors.styleColor.alpha() == 0 )
|
if ( textColors.styleColor.alpha() == 0 )
|
||||||
@ -610,14 +610,13 @@ QSGNode* QskSkinlet::updateTextNode(
|
|||||||
|
|
||||||
QSGNode* QskSkinlet::updateTextNode(
|
QSGNode* QskSkinlet::updateTextNode(
|
||||||
const QskSkinnable* skinnable, QSGNode* node,
|
const QskSkinnable* skinnable, QSGNode* node,
|
||||||
const QString& text, const QskTextOptions& textOptions,
|
const QString& text, QskAspect::Subcontrol subControl ) const
|
||||||
QskAspect::Subcontrol subControl ) const
|
|
||||||
{
|
{
|
||||||
const auto rect = qskSubControlRect( this, skinnable, subControl );
|
const auto rect = qskSubControlRect( this, skinnable, subControl );
|
||||||
const auto alignment = skinnable->alignmentHint( subControl, Qt::AlignLeft );
|
const auto alignment = skinnable->alignmentHint( subControl, Qt::AlignLeft );
|
||||||
|
|
||||||
return updateTextNode( skinnable, node,
|
return updateTextNode( skinnable, node,
|
||||||
rect, alignment, text, textOptions, subControl );
|
rect, alignment, text, subControl );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGNode* QskSkinlet::updateGraphicNode(
|
QSGNode* QskSkinlet::updateGraphicNode(
|
||||||
|
@ -107,8 +107,7 @@ class QSK_EXPORT QskSkinlet
|
|||||||
QskAspect::Subcontrol );
|
QskAspect::Subcontrol );
|
||||||
|
|
||||||
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
||||||
const QRectF&, Qt::Alignment, const QString&, const QskTextOptions&,
|
const QRectF&, Qt::Alignment, const QString&, QskAspect::Subcontrol );
|
||||||
QskAspect::Subcontrol );
|
|
||||||
|
|
||||||
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
static QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
||||||
const QRectF&, Qt::Alignment, const QString&, const QFont&,
|
const QRectF&, Qt::Alignment, const QString&, const QFont&,
|
||||||
@ -154,7 +153,7 @@ class QSK_EXPORT QskSkinlet
|
|||||||
QskAspect::Subcontrol ) const;
|
QskAspect::Subcontrol ) const;
|
||||||
|
|
||||||
QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
QSGNode* updateTextNode( const QskSkinnable*, QSGNode*,
|
||||||
const QString&, const QskTextOptions&, QskAspect::Subcontrol ) const;
|
const QString&, QskAspect::Subcontrol ) const;
|
||||||
|
|
||||||
QSGNode* updateGraphicNode( const QskSkinnable*, QSGNode*,
|
QSGNode* updateGraphicNode( const QskSkinnable*, QSGNode*,
|
||||||
const QskGraphic&, QskAspect::Subcontrol,
|
const QskGraphic&, QskAspect::Subcontrol,
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "QskShadowMetrics.h"
|
#include "QskShadowMetrics.h"
|
||||||
#include "QskBoxHints.h"
|
#include "QskBoxHints.h"
|
||||||
#include "QskGradient.h"
|
#include "QskGradient.h"
|
||||||
|
#include "QskTextOptions.h"
|
||||||
|
|
||||||
#include <qfont.h>
|
#include <qfont.h>
|
||||||
#include <qfontmetrics.h>
|
#include <qfontmetrics.h>
|
||||||
@ -651,6 +652,25 @@ qreal QskSkinnable::spacingHint(
|
|||||||
return qskMetric< qreal >( this, aspect | QskAspect::Spacing, status );
|
return qskMetric< qreal >( this, aspect | QskAspect::Spacing, status );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QskSkinnable::setTextOptionsHint(
|
||||||
|
const QskAspect aspect, const QskTextOptions& options )
|
||||||
|
{
|
||||||
|
return setSkinHint( aspect | QskAspect::Flag | QskAspect::Option,
|
||||||
|
QVariant::fromValue( options ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QskSkinnable::resetTextOptionsHint( const QskAspect aspect )
|
||||||
|
{
|
||||||
|
return resetFlagHint( aspect | QskAspect::Option );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskTextOptions QskSkinnable::textOptionsHint(
|
||||||
|
const QskAspect aspect, QskSkinHintStatus* status ) const
|
||||||
|
{
|
||||||
|
return effectiveSkinHint(
|
||||||
|
aspect | QskAspect::Flag | QskAspect::Option, status ).value< QskTextOptions >();
|
||||||
|
}
|
||||||
|
|
||||||
bool QskSkinnable::setFontRoleHint( const QskAspect aspect, int role )
|
bool QskSkinnable::setFontRoleHint( const QskAspect aspect, int role )
|
||||||
{
|
{
|
||||||
return qskSetFlag( this, aspect | QskAspect::FontRole, role );
|
return qskSetFlag( this, aspect | QskAspect::FontRole, role );
|
||||||
|
@ -29,6 +29,7 @@ class QskBoxShapeMetrics;
|
|||||||
class QskBoxBorderMetrics;
|
class QskBoxBorderMetrics;
|
||||||
class QskBoxBorderColors;
|
class QskBoxBorderColors;
|
||||||
class QskShadowMetrics;
|
class QskShadowMetrics;
|
||||||
|
class QskTextOptions;
|
||||||
class QskBoxHints;
|
class QskBoxHints;
|
||||||
class QskGradient;
|
class QskGradient;
|
||||||
|
|
||||||
@ -233,6 +234,10 @@ class QSK_EXPORT QskSkinnable
|
|||||||
bool resetAlignmentHint( QskAspect );
|
bool resetAlignmentHint( QskAspect );
|
||||||
Qt::Alignment alignmentHint( QskAspect, Qt::Alignment = Qt::Alignment() ) const;
|
Qt::Alignment alignmentHint( QskAspect, Qt::Alignment = Qt::Alignment() ) const;
|
||||||
|
|
||||||
|
bool setTextOptionsHint( QskAspect, const QskTextOptions& );
|
||||||
|
bool resetTextOptionsHint( QskAspect );
|
||||||
|
QskTextOptions textOptionsHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||||
|
|
||||||
bool setFontRoleHint( QskAspect, int role );
|
bool setFontRoleHint( QskAspect, int role );
|
||||||
bool resetFontRoleHint( QskAspect );
|
bool resetFontRoleHint( QskAspect );
|
||||||
int fontRoleHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
int fontRoleHint( QskAspect, QskSkinHintStatus* = nullptr ) const;
|
||||||
|
@ -32,11 +32,9 @@ class QskSubWindow::PrivateData
|
|||||||
PrivateData()
|
PrivateData()
|
||||||
: isWindowIconSourceDirty( false )
|
: isWindowIconSourceDirty( false )
|
||||||
{
|
{
|
||||||
windowTitleTextOptions.setElideMode( Qt::ElideRight );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString windowTitle;
|
QString windowTitle;
|
||||||
QskTextOptions windowTitleTextOptions;
|
|
||||||
|
|
||||||
QUrl windowIconSource;
|
QUrl windowIconSource;
|
||||||
QskGraphic windowIcon;
|
QskGraphic windowIcon;
|
||||||
@ -110,18 +108,13 @@ QString QskSubWindow::windowTitle() const
|
|||||||
|
|
||||||
void QskSubWindow::setWindowTitleTextOptions( const QskTextOptions& options )
|
void QskSubWindow::setWindowTitleTextOptions( const QskTextOptions& options )
|
||||||
{
|
{
|
||||||
if ( options != m_data->windowTitleTextOptions )
|
if ( setTextOptionsHint( TitleBarText, options ) )
|
||||||
{
|
|
||||||
m_data->windowTitleTextOptions = options;
|
|
||||||
|
|
||||||
update();
|
|
||||||
Q_EMIT windowTitleTextOptionsChanged();
|
Q_EMIT windowTitleTextOptionsChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QskTextOptions QskSubWindow::windowTitleTextOptions() const
|
QskTextOptions QskSubWindow::windowTitleTextOptions() const
|
||||||
{
|
{
|
||||||
return m_data->windowTitleTextOptions;
|
return textOptionsHint( TitleBarText );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskSubWindow::setWindowIconSource( const QString& url )
|
void QskSubWindow::setWindowIconSource( const QString& url )
|
||||||
|
@ -88,8 +88,8 @@ QSGNode* QskSubWindowSkinlet::updateSubNode(
|
|||||||
|
|
||||||
if ( ( decorations & Q::TitleBar ) && ( decorations & Q::Title ) )
|
if ( ( decorations & Q::TitleBar ) && ( decorations & Q::Title ) )
|
||||||
{
|
{
|
||||||
return updateTextNode( subWindow, node, subWindow->windowTitle(),
|
return updateTextNode( subWindow, node,
|
||||||
subWindow->windowTitleTextOptions(), Q::TitleBarText );
|
subWindow->windowTitle(), Q::TitleBarText );
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -29,7 +29,6 @@ class QskTabButton::PrivateData
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
QskTextOptions textOptions;
|
|
||||||
QPointer< QskTabBar > tabBar;
|
QPointer< QskTabBar > tabBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -77,18 +76,21 @@ QString QskTabButton::text() const
|
|||||||
return m_data->text;
|
return m_data->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTabButton::setTextOptions( const QskTextOptions& options )
|
void QskTabButton::setTextOptions( const QskTextOptions& textOptions )
|
||||||
{
|
{
|
||||||
if ( options != m_data->textOptions )
|
if ( setTextOptionsHint( Text, textOptions ) )
|
||||||
{
|
|
||||||
m_data->textOptions = options;
|
|
||||||
Q_EMIT textOptionsChanged();
|
Q_EMIT textOptionsChanged();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
QskTextOptions QskTabButton::textOptions() const
|
QskTextOptions QskTabButton::textOptions() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions;
|
return textOptionsHint( Text );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskTabButton::resetTextOptions()
|
||||||
|
{
|
||||||
|
if ( resetTextOptionsHint( Text ) )
|
||||||
|
Q_EMIT textOptionsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QRectF QskTabButton::layoutRectForSize( const QSizeF& size ) const
|
QRectF QskTabButton::layoutRectForSize( const QSizeF& size ) const
|
||||||
|
@ -18,7 +18,7 @@ class QSK_EXPORT QskTabButton : public QskAbstractButton
|
|||||||
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged FINAL )
|
Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
||||||
WRITE setTextOptions NOTIFY textOptionsChanged )
|
WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
|
||||||
|
|
||||||
using Inherited = QskAbstractButton;
|
using Inherited = QskAbstractButton;
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ class QSK_EXPORT QskTabButton : public QskAbstractButton
|
|||||||
|
|
||||||
void setTextOptions( const QskTextOptions& );
|
void setTextOptions( const QskTextOptions& );
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
void resetTextOptions();
|
||||||
|
|
||||||
QRectF layoutRectForSize( const QSizeF& ) const override;
|
QRectF layoutRectForSize( const QSizeF& ) const override;
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ QSGNode* QskTabButtonSkinlet::updateSubNode(
|
|||||||
|
|
||||||
case TextRole:
|
case TextRole:
|
||||||
{
|
{
|
||||||
return updateTextNode( tabButton, node, tabButton->text(),
|
return updateTextNode( tabButton, node,
|
||||||
tabButton->textOptions(), QskTabButton::Text );
|
tabButton->text(), QskTabButton::Text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,27 +13,15 @@ QSK_SUBCONTROL( QskTextLabel, Text )
|
|||||||
class QskTextLabel::PrivateData
|
class QskTextLabel::PrivateData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PrivateData( const QString& txt )
|
PrivateData( const QString& txt, QskTextOptions::TextFormat textFormat )
|
||||||
: text( txt )
|
: text( txt )
|
||||||
|
, effectiveTextFormat( textFormat )
|
||||||
, hasPanel( false )
|
, hasPanel( false )
|
||||||
{
|
{
|
||||||
effectiveTextFormat = textOptions.format();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QskTextOptions::TextFormat effectiveFormat() const
|
|
||||||
{
|
|
||||||
if ( textOptions.format() != QskTextOptions::AutoText )
|
|
||||||
return textOptions.format();
|
|
||||||
|
|
||||||
if ( effectiveTextFormat == QskTextOptions::AutoText )
|
|
||||||
effectiveTextFormat = textOptions.effectiveFormat( text );
|
|
||||||
|
|
||||||
return effectiveTextFormat;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
QskTextOptions textOptions;
|
|
||||||
mutable QskTextOptions::TextFormat effectiveTextFormat;
|
mutable QskTextOptions::TextFormat effectiveTextFormat;
|
||||||
|
|
||||||
bool hasPanel : 1;
|
bool hasPanel : 1;
|
||||||
@ -46,7 +34,7 @@ QskTextLabel::QskTextLabel( QQuickItem* parent )
|
|||||||
|
|
||||||
QskTextLabel::QskTextLabel( const QString& text, QQuickItem* parent )
|
QskTextLabel::QskTextLabel( const QString& text, QQuickItem* parent )
|
||||||
: Inherited( parent )
|
: Inherited( parent )
|
||||||
, m_data( new PrivateData( text ) )
|
, m_data( new PrivateData( text, textOptions().format() ) )
|
||||||
{
|
{
|
||||||
initSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Fixed );
|
initSizePolicy( QskSizePolicy::Minimum, QskSizePolicy::Fixed );
|
||||||
}
|
}
|
||||||
@ -79,7 +67,7 @@ void QskTextLabel::setText( const QString& text )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_data->text = text;
|
m_data->text = text;
|
||||||
m_data->effectiveTextFormat = m_data->textOptions.format();
|
m_data->effectiveTextFormat = textOptions().format();
|
||||||
|
|
||||||
resetImplicitSize();
|
resetImplicitSize();
|
||||||
update();
|
update();
|
||||||
@ -92,11 +80,10 @@ QString QskTextLabel::text() const
|
|||||||
return m_data->text;
|
return m_data->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextLabel::setTextOptions( const QskTextOptions& options )
|
void QskTextLabel::setTextOptions( const QskTextOptions& textOptions )
|
||||||
|
{
|
||||||
|
if ( setTextOptionsHint( Text, textOptions ) )
|
||||||
{
|
{
|
||||||
if ( options == m_data->textOptions )
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// we are killing user settings of the policy this way ??
|
// we are killing user settings of the policy this way ??
|
||||||
|
|
||||||
@ -106,23 +93,25 @@ void QskTextLabel::setTextOptions( const QskTextOptions& options )
|
|||||||
setSizePolicy( policy, sizePolicy().verticalPolicy() );
|
setSizePolicy( policy, sizePolicy().verticalPolicy() );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_data->effectiveTextFormat = options.format();
|
m_data->effectiveTextFormat = textOptions.format();
|
||||||
m_data->textOptions = options;
|
Q_EMIT textOptionsChanged( textOptions );
|
||||||
|
}
|
||||||
resetImplicitSize();
|
|
||||||
update();
|
|
||||||
|
|
||||||
Q_EMIT textOptionsChanged( options );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions QskTextLabel::textOptions() const
|
QskTextOptions QskTextLabel::textOptions() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions;
|
return textOptionsHint( Text );
|
||||||
|
}
|
||||||
|
|
||||||
|
void QskTextLabel::resetTextOptions()
|
||||||
|
{
|
||||||
|
if ( resetTextOptionsHint( Text ) )
|
||||||
|
Q_EMIT textOptionsChanged( textOptions() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextLabel::setTextFormat( QskTextOptions::TextFormat format )
|
void QskTextLabel::setTextFormat( QskTextOptions::TextFormat format )
|
||||||
{
|
{
|
||||||
auto options = m_data->textOptions;
|
auto options = textOptions();
|
||||||
options.setFormat( format );
|
options.setFormat( format );
|
||||||
|
|
||||||
setTextOptions( options );
|
setTextOptions( options );
|
||||||
@ -130,31 +119,38 @@ void QskTextLabel::setTextFormat( QskTextOptions::TextFormat format )
|
|||||||
|
|
||||||
QskTextOptions::TextFormat QskTextLabel::textFormat() const
|
QskTextOptions::TextFormat QskTextLabel::textFormat() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions.format();
|
return textOptions().format();
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions::TextFormat QskTextLabel::effectiveTextFormat() const
|
QskTextOptions::TextFormat QskTextLabel::effectiveTextFormat() const
|
||||||
{
|
{
|
||||||
return m_data->effectiveFormat();
|
const auto options = textOptions();
|
||||||
|
|
||||||
|
if ( options.format() != QskTextOptions::AutoText )
|
||||||
|
return options.format();
|
||||||
|
|
||||||
|
if ( m_data->effectiveTextFormat == QskTextOptions::AutoText )
|
||||||
|
m_data->effectiveTextFormat = options.effectiveFormat( m_data->text );
|
||||||
|
|
||||||
|
return m_data->effectiveTextFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextLabel::setWrapMode( QskTextOptions::WrapMode wrapMode )
|
void QskTextLabel::setWrapMode( QskTextOptions::WrapMode wrapMode )
|
||||||
{
|
{
|
||||||
auto options = m_data->textOptions;
|
auto options = textOptions();
|
||||||
options.setWrapMode( wrapMode );
|
options.setWrapMode( wrapMode );
|
||||||
|
|
||||||
setTextOptions( options );
|
setTextOptions( options );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskTextOptions::WrapMode QskTextLabel::wrapMode() const
|
QskTextOptions::WrapMode QskTextLabel::wrapMode() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions.wrapMode();
|
return textOptions().wrapMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextLabel::setElideMode( Qt::TextElideMode elideMode )
|
void QskTextLabel::setElideMode( Qt::TextElideMode elideMode )
|
||||||
{
|
{
|
||||||
auto options = m_data->textOptions;
|
auto options = textOptions();
|
||||||
options.setElideMode( elideMode );
|
options.setElideMode( elideMode );
|
||||||
|
|
||||||
setTextOptions( options );
|
setTextOptions( options );
|
||||||
@ -162,7 +158,7 @@ void QskTextLabel::setElideMode( Qt::TextElideMode elideMode )
|
|||||||
|
|
||||||
Qt::TextElideMode QskTextLabel::elideMode() const
|
Qt::TextElideMode QskTextLabel::elideMode() const
|
||||||
{
|
{
|
||||||
return m_data->textOptions.elideMode();
|
return textOptions().elideMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskTextLabel::setFontRole( int role )
|
void QskTextLabel::setFontRole( int role )
|
||||||
|
@ -24,7 +24,7 @@ class QSK_EXPORT QskTextLabel : public QskControl
|
|||||||
WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged )
|
WRITE setTextColor RESET resetTextColor NOTIFY textColorChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
Q_PROPERTY( QskTextOptions textOptions READ textOptions
|
||||||
WRITE setTextOptions NOTIFY textOptionsChanged )
|
WRITE setTextOptions RESET resetTextOptions NOTIFY textOptionsChanged )
|
||||||
|
|
||||||
Q_PROPERTY( Qt::Alignment alignment READ alignment
|
Q_PROPERTY( Qt::Alignment alignment READ alignment
|
||||||
WRITE setAlignment NOTIFY alignmentChanged )
|
WRITE setAlignment NOTIFY alignmentChanged )
|
||||||
@ -54,6 +54,7 @@ class QSK_EXPORT QskTextLabel : public QskControl
|
|||||||
|
|
||||||
void setTextOptions( const QskTextOptions& );
|
void setTextOptions( const QskTextOptions& );
|
||||||
QskTextOptions textOptions() const;
|
QskTextOptions textOptions() const;
|
||||||
|
void resetTextOptions();
|
||||||
|
|
||||||
void setTextFormat( QskTextOptions::TextFormat );
|
void setTextFormat( QskTextOptions::TextFormat );
|
||||||
QskTextOptions::TextFormat textFormat() const;
|
QskTextOptions::TextFormat textFormat() const;
|
||||||
|
@ -60,7 +60,7 @@ QSGNode* QskTextLabelSkinlet::updateSubNode(
|
|||||||
case TextRole:
|
case TextRole:
|
||||||
{
|
{
|
||||||
return updateTextNode( label, node,
|
return updateTextNode( label, node,
|
||||||
label->text(), label->textOptions(), QskTextLabel::Text );
|
label->text(), QskTextLabel::Text );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user