uncrustified

This commit is contained in:
Uwe Rathmann 2022-03-23 11:54:34 +01:00
parent 7f5d289808
commit 1cc0dff8d5
27 changed files with 1514 additions and 607 deletions

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,7 @@ namespace
connect( this, &QskTabView::currentIndexChanged, connect( this, &QskTabView::currentIndexChanged,
this, &TabView::updateViewPanel ); this, &TabView::updateViewPanel );
} }
protected: protected:
void aboutToShow() override void aboutToShow() override
@ -48,7 +48,7 @@ namespace
We should have a better way to set individual colors We should have a better way to set individual colors
for each tab page background for each tab page background
*/ */
if ( auto page = dynamic_cast< const ::Page* >( currentItem() ) ) if ( auto page = dynamic_cast< const ::Page* >( currentItem() ) )
setGradientHint( QskTabView::Page, page->gradient() ); setGradientHint( QskTabView::Page, page->gradient() );
} }

View File

@ -165,14 +165,15 @@ bool LightDisplay::arcContainsPoint( const QRectF& rect, const QPointF& point )
const int tolerance = 20; const int tolerance = 20;
// 1. check angle // 1. check angle
QPointF circlePos( point.x() - rect.center().x(), QPointF circlePos(
rect.center().y() - point.y() ); point.x() - rect.center().x(),
rect.center().y() - point.y() );
const qreal angle = angleFromPoint( rect, point ); const qreal angle = angleFromPoint( rect, point );
const bool angleWithinRange = angleInRange( metrics, angle ) const bool angleWithinRange = angleInRange( metrics, angle )
|| angleDiff( angle, metrics.startAngle() ) <= tolerance || angleDiff( angle, metrics.startAngle() ) <= tolerance
|| angleDiff( angle, metrics.endAngle() ) <= tolerance; || angleDiff( angle, metrics.endAngle() ) <= tolerance;
// 2. check whether point is on arc // 2. check whether point is on arc
const qreal radiusMax = rect.width() / 2; const qreal radiusMax = rect.width() / 2;
@ -181,7 +182,7 @@ bool LightDisplay::arcContainsPoint( const QRectF& rect, const QPointF& point )
const qreal polarRadius = qSqrt( qPow( circlePos.x(), 2 ) + qPow( circlePos.y(), 2 ) ); const qreal polarRadius = qSqrt( qPow( circlePos.x(), 2 ) + qPow( circlePos.y(), 2 ) );
const bool pointOnArc = ( polarRadius + tolerance ) > radiusMin const bool pointOnArc = ( polarRadius + tolerance ) > radiusMin
&& ( polarRadius - tolerance ) < radiusMax; && ( polarRadius - tolerance ) < radiusMax;
bool ret = angleWithinRange && pointOnArc; bool ret = angleWithinRange && pointOnArc;

View File

@ -33,15 +33,15 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
QRectF rect = contentsRect; QRectF rect = contentsRect;
const qreal ticksSpacing = 4; // space between the ticks and the arc const qreal ticksSpacing = 4; // space between the ticks and the arc
if( subControl == LightDisplay::Groove if( subControl == LightDisplay::Groove || subControl == LightDisplay::Panel )
|| subControl == LightDisplay::Panel )
{ {
QSizeF textSize = textLabelsSize( display ); QSizeF textSize = textLabelsSize( display );
QskArcMetrics arcMetrics = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ); QskArcMetrics arcMetrics = display->arcMetricsHint( LightDisplay::ColdAndWarmArc );
const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing; const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing;
const qreal x = textSize.width() + arcMetrics.width() + ticksWidth; const qreal x = textSize.width() + arcMetrics.width() + ticksWidth;
const qreal w = contentsRect.width() - ( 2 * ( textSize.width() + arcMetrics.width() + ticksWidth ) ); const qreal w = contentsRect.width() -
( 2 * ( textSize.width() + arcMetrics.width() + ticksWidth ) );
const qreal y = arcMetrics.width() + ticksWidth; const qreal y = arcMetrics.width() + ticksWidth;
const qreal h = contentsRect.height() - 2 * ( arcMetrics.width() + ticksWidth ); const qreal h = contentsRect.height() - 2 * ( arcMetrics.width() + ticksWidth );
@ -52,24 +52,24 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
} }
else if( subControl == LightDisplay::ColdAndWarmArc ) else if( subControl == LightDisplay::ColdAndWarmArc )
{ {
const QRectF panelRect = subControlRect( skinnable, contentsRect, const QRectF panelRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel );
LightDisplay::Panel );
auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width(); auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width();
auto rect = panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } ); auto rect = panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } );
return rect; return rect;
} }
else if( subControl == LightDisplay::Tickmarks ) else if( subControl == LightDisplay::Tickmarks )
{ {
const QRectF arcRect = subControlRect( skinnable, contentsRect, const QRectF arcRect = subControlRect(
LightDisplay::ColdAndWarmArc ); skinnable, contentsRect, LightDisplay::ColdAndWarmArc );
const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing; const qreal ticksWidth = display->arcMetricsHint(
const QRectF rect = arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } ); LightDisplay::Tickmarks ).width() + ticksSpacing;
const QRectF rect =
arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } );
return rect; return rect;
} }
else if( subControl == LightDisplay::ValueText ) else if( subControl == LightDisplay::ValueText )
{ {
QRectF valueTextRect = subControlRect( skinnable, contentsRect, QRectF valueTextRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel );
LightDisplay::Panel );
const QFontMetricsF fm( skinnable->effectiveFont( subControl ) ); const QFontMetricsF fm( skinnable->effectiveFont( subControl ) );
const qreal fontWidth = fm.width( QStringLiteral( "100 %" ) ); const qreal fontWidth = fm.width( QStringLiteral( "100 %" ) );
const QPointF center = valueTextRect.center(); const QPointF center = valueTextRect.center();
@ -175,7 +175,7 @@ QSGNode* LightDisplaySkinlet::updateSubNode(
int tickLineWidth = display->metric( LightDisplay::Tickmarks ); int tickLineWidth = display->metric( LightDisplay::Tickmarks );
ticksNode->update( color, ticksRect, arcMetrics, boundaries, ticksNode->update( color, ticksRect, arcMetrics, boundaries,
tickmarks, tickLineWidth, Qt::Horizontal ); tickmarks, tickLineWidth, Qt::Horizontal );
return ticksNode; return ticksNode;
} }

View File

@ -125,7 +125,7 @@ QColor ShadowedBox::shadowColor() const
return m_shadowColor; return m_shadowColor;
} }
QRectF ShadowedBox::layoutRectForSize( const QSizeF &size ) const QRectF ShadowedBox::layoutRectForSize( const QSizeF& size ) const
{ {
auto padding = paddingHint( Panel ); auto padding = paddingHint( Panel );
return { padding.left() / 2, padding.top() / 2, return { padding.left() / 2, padding.top() / 2,

View File

@ -46,9 +46,9 @@ namespace
int compare( const QSGMaterial* other ) const override; int compare( const QSGMaterial* other ) const override;
QVector2D aspect = QVector2D{1.0, 1.0}; QVector2D aspect = QVector2D{ 1.0, 1.0 };
float blurExtent = 0.0; float blurExtent = 0.0;
QVector4D radius = QVector4D{0.0, 0.0, 0.0, 0.0}; QVector4D radius = QVector4D{ 0.0, 0.0, 0.0, 0.0 };
QColor color = Qt::black; QColor color = Qt::black;
}; };

View File

@ -391,7 +391,7 @@ int main( int argc, char** argv )
#if 1 #if 1
/* /*
we don't need the fonts, but by calling something from we don't need the fonts, but by calling something from
the support library initializations regarding the skins the support library initializations regarding the skins
are loaded. TODO ... are loaded. TODO ...
*/ */

View File

@ -46,9 +46,9 @@ namespace
int compare( const QSGMaterial* other ) const override; int compare( const QSGMaterial* other ) const override;
QVector2D aspect = QVector2D{1.0, 1.0}; QVector2D aspect = QVector2D{ 1.0, 1.0 };
float blurExtent = 0.0; float blurExtent = 0.0;
QVector4D radius = QVector4D{0.0, 0.0, 0.0, 0.0}; QVector4D radius = QVector4D{ 0.0, 0.0, 0.0, 0.0 };
QColor color = Qt::black; QColor color = Qt::black;
}; };

View File

@ -24,7 +24,7 @@ class QSK_EXPORT QskArcMetrics
public: public:
constexpr QskArcMetrics() noexcept; constexpr QskArcMetrics() noexcept;
constexpr QskArcMetrics( qreal width, qreal startAngle, qreal spanAngle, constexpr QskArcMetrics( qreal width, qreal startAngle, qreal spanAngle,
Qt::SizeMode = Qt::AbsoluteSize ) noexcept; Qt::SizeMode = Qt::AbsoluteSize ) noexcept;
bool operator==( const QskArcMetrics& ) const noexcept; bool operator==( const QskArcMetrics& ) const noexcept;
bool operator!=( const QskArcMetrics& ) const noexcept; bool operator!=( const QskArcMetrics& ) const noexcept;

View File

@ -36,17 +36,17 @@ QskBoxHints QskBoxHints::interpolated(
} }
#ifndef QT_NO_DEBUG_STREAM #ifndef QT_NO_DEBUG_STREAM
#include <qdebug.h> #include <qdebug.h>
QDebug operator<<( QDebug debug, const QskBoxHints& hints ) QDebug operator<<( QDebug debug, const QskBoxHints& hints )
{ {
debug << hints.shape << hints.borderMetrics debug << hints.shape << hints.borderMetrics
<< hints.borderColors << hints.gradient; << hints.borderColors << hints.gradient;
return debug; return debug;
} }
#endif #endif
#include "moc_QskBoxHints.cpp" #include "moc_QskBoxHints.cpp"

View File

@ -122,7 +122,7 @@ QRectF qskValidOrEmptyInnerRect( const QRectF& rect, const QMarginsF& margins )
return QRectF( x, y, w, h ); return QRectF( x, y, w, h );
} }
QRectF qskInterpolatedRect( const QRectF &from, const QRectF &to, qreal progress ) QRectF qskInterpolatedRect( const QRectF& from, const QRectF& to, qreal progress )
{ {
if ( progress <= 0.0 ) if ( progress <= 0.0 )
return from; return from;
@ -138,7 +138,7 @@ QRectF qskInterpolatedRect( const QRectF &from, const QRectF &to, qreal progress
return QRectF( x, y, w, h ); return QRectF( x, y, w, h );
} }
QSizeF qskInterpolatedSize( const QSizeF &from, const QSizeF &to, qreal progress ) QSizeF qskInterpolatedSize( const QSizeF& from, const QSizeF& to, qreal progress )
{ {
if ( progress <= 0.0 ) if ( progress <= 0.0 )
return from; return from;

View File

@ -70,7 +70,7 @@ static inline bool qskIsVisible( const QskGradientStops& stops )
const auto& c = stop.color(); const auto& c = stop.color();
if ( c.isValid() && c.alpha() > 0 ) if ( c.isValid() && c.alpha() > 0 )
return true; return true;
} }
return false; return false;
} }
@ -182,7 +182,7 @@ static inline QskGradientStops qskExtractedStops(
static inline QskGradientStops qskGradientStops( const QGradientStops& qtStops ) static inline QskGradientStops qskGradientStops( const QGradientStops& qtStops )
{ {
QskGradientStops stops; QskGradientStops stops;
for ( const auto& s : qtStops ) for ( const auto& s : qtStops )
stops += QskGradientStop( s.first, s.second ); stops += QskGradientStop( s.first, s.second );

View File

@ -92,7 +92,7 @@ qreal qskWheelSteps( const QWheelEvent* event )
const auto angleDelta = event->angleDelta(); const auto angleDelta = event->angleDelta();
const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x(); const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x();
return delta / QWheelEvent::DefaultDeltasPerStep; return delta / QWheelEvent::DefaultDeltasPerStep;
} }
qreal qskWheelIncrement( const QWheelEvent* event ) qreal qskWheelIncrement( const QWheelEvent* event )
@ -109,7 +109,7 @@ qreal qskWheelIncrement( const QWheelEvent* event )
angleDelta.setY( -angleDelta.y() ); angleDelta.setY( -angleDelta.y() );
const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x(); const qreal delta = angleDelta.y() ? angleDelta.y() : angleDelta.x();
return delta / QWheelEvent::DefaultDeltasPerStep; return delta / QWheelEvent::DefaultDeltasPerStep;
} }
#endif #endif
@ -119,7 +119,7 @@ bool qskIsStandardKeyInput( const QKeyEvent* event, QKeySequence::StandardKey ke
#if 1 #if 1
return event->matches( key ); return event->matches( key );
#else #else
constexpr auto mask = ~(Qt::KeypadModifier | Qt::GroupSwitchModifier); constexpr auto mask = ~( Qt::KeypadModifier | Qt::GroupSwitchModifier );
// We should route this call through the skin. TODO // We should route this call through the skin. TODO
const auto theme = QGuiApplicationPrivate::platformTheme(); const auto theme = QGuiApplicationPrivate::platformTheme();

View File

@ -278,14 +278,14 @@ void QskMenu::traverse( int steps )
if ( hasAnimationHint( Cursor | QskAspect::Position | QskAspect::Metric ) ) if ( hasAnimationHint( Cursor | QskAspect::Position | QskAspect::Metric ) )
{ {
// when cycling we want slide in // when cycling we want slide in
if ( index < 0 ) if ( index < 0 )
setPositionHint( Cursor, count() ); setPositionHint( Cursor, count() );
if ( index >= count() ) if ( index >= count() )
setPositionHint( Cursor, -1 ); setPositionHint( Cursor, -1 );
movePositionHint( Cursor, newIndex ); movePositionHint( Cursor, newIndex );
} }

View File

@ -52,7 +52,8 @@ class QskMenuSkinlet::PrivateData
{ {
m_data->enableCache( false ); m_data->enableCache( false );
} }
private:
private:
PrivateData* m_data; PrivateData* m_data;
}; };

View File

@ -29,10 +29,10 @@ static int qskKeyIncrement(
if ( key == Qt::Key_Left ) if ( key == Qt::Key_Left )
return mirrored ? 1 : -1; return mirrored ? 1 : -1;
if ( key == Qt::Key_Right ) if ( key == Qt::Key_Right )
return mirrored ? -1 : 1; return mirrored ? -1 : 1;
} }
else else
{ {
if ( key == Qt::Key_Up ) if ( key == Qt::Key_Up )
@ -40,10 +40,10 @@ static int qskKeyIncrement(
if ( key == Qt::Key_Down ) if ( key == Qt::Key_Down )
return 1; return 1;
} }
return 0; return 0;
} }
class QskPageIndicator::PrivateData class QskPageIndicator::PrivateData
@ -145,8 +145,8 @@ qreal QskPageIndicator::valueRatioAt( int index ) const
const qreal diff = 1.0 - std::abs( pos - index ); const qreal diff = 1.0 - std::abs( pos - index );
return std::max( diff, 0.0 ); return std::max( diff, 0.0 );
} }
return 0.0; return 0.0;
} }
@ -205,7 +205,7 @@ void QskPageIndicator::mouseReleaseEvent( QMouseEvent* event )
if ( indexAtPosition( pos ) == index ) if ( indexAtPosition( pos ) == index )
Q_EMIT pageRequested( index ); Q_EMIT pageRequested( index );
} }
return; return;
} }

View File

@ -44,7 +44,7 @@ static QRectF qskBulletRect( const QskPageIndicator* indicator,
{ {
const auto maxWidth = n * size.width() + ( n - 1 ) * spacing; const auto maxWidth = n * size.width() + ( n - 1 ) * spacing;
const auto r = qskAlignedRectF( rect, maxWidth, size.height(), alignment ); const auto r = qskAlignedRectF( rect, maxWidth, size.height(), alignment );
x = r.x() + index * ( size.width() + spacing ); x = r.x() + index * ( size.width() + spacing );
y = r.y(); y = r.y();
} }
@ -52,7 +52,7 @@ static QRectF qskBulletRect( const QskPageIndicator* indicator,
{ {
const auto maxHeight = n * size.height() + ( n - 1 ) * spacing; const auto maxHeight = n * size.height() + ( n - 1 ) * spacing;
const auto r = qskAlignedRectF( rect, maxHeight, size.height(), alignment ); const auto r = qskAlignedRectF( rect, maxHeight, size.height(), alignment );
x = r.x(); x = r.x();
y = r.y() + index * ( size.height() + spacing );; y = r.y() + index * ( size.height() + spacing );;
} }

View File

@ -382,7 +382,7 @@ bool QskPopup::hasFaderEffect() const
void QskPopup::setPopupFlags( PopupFlags flags ) void QskPopup::setPopupFlags( PopupFlags flags )
{ {
if ( static_cast<int>(flags) != m_data->flags ) if ( static_cast< int >( flags ) != m_data->flags )
{ {
m_data->flags = flags; m_data->flags = flags;
updateInputGrabber(); updateInputGrabber();
@ -654,7 +654,7 @@ int QskPopup::execPopup()
if ( popup->isOpen() || popup->isFading() ) if ( popup->isOpen() || popup->isFading() )
return; return;
} }
QEventLoop::exit( 0 ); QEventLoop::exit( 0 );
} }
}; };
@ -679,10 +679,10 @@ int QskPopup::execPopup()
} }
if ( auto mouseGrabber = window()->mouseGrabberItem() ) if ( auto mouseGrabber = window()->mouseGrabberItem() )
{ {
// when being called from QQuickWindow::mouseReleaseEvent // when being called from QQuickWindow::mouseReleaseEvent
// the mouse grabber has not yet been released. // the mouse grabber has not yet been released.
if( !qskIsAncestorOf( this, mouseGrabber ) ) if( !qskIsAncestorOf( this, mouseGrabber ) )
qskUngrabMouse( mouseGrabber ); qskUngrabMouse( mouseGrabber );
} }

View File

@ -209,8 +209,7 @@ static inline QskAspect qskSubstitutedAspect(
if ( aspect.hasStates() ) if ( aspect.hasStates() )
{ {
qWarning() << "QskSkinnable::(re)setSkinHint: setting hints with states " qWarning() << "QskSkinnable::(re)setSkinHint: setting hints with states "
"is discouraged - use QskSkinTableEditor if you are " "is discouraged - use QskSkinTableEditor if you are sure, that you need this.";
"sure, that you need this.";
qWarning() << "QskAspect:" << aspect.stateless() qWarning() << "QskAspect:" << aspect.stateless()
<< skinnable->skinStatesAsPrintable( aspect.states() ); << skinnable->skinStatesAsPrintable( aspect.states() );

View File

@ -572,8 +572,8 @@ bool QskDialogButtonBox::isDefaultButtonKeyEvent( const QKeyEvent* event )
} }
else else
{ {
return ( event->key() == Qt::Key_Enter ) || return ( event->key() == Qt::Key_Enter )
( event->key() == Qt::Key_Return ); || ( event->key() == Qt::Key_Return );
} }
} }

View File

@ -19,7 +19,8 @@ class QskHunspellTextPredictor::PrivateData
QLocale locale; QLocale locale;
}; };
QskHunspellTextPredictor::QskHunspellTextPredictor( const QLocale &locale, QObject* object ) QskHunspellTextPredictor::QskHunspellTextPredictor(
const QLocale& locale, QObject* object )
: Inherited( object ) : Inherited( object )
, m_data( new PrivateData() ) , m_data( new PrivateData() )
{ {
@ -43,7 +44,8 @@ void QskHunspellTextPredictor::reset()
} }
} }
QPair< QString, QString > QskHunspellTextPredictor::affAndDicFile( const QString& path, const QLocale& locale ) QPair< QString, QString > QskHunspellTextPredictor::affAndDicFile(
const QString& path, const QLocale& locale )
{ {
QString prefix = QStringLiteral( "%1/%2" ).arg( path, locale.name() ); QString prefix = QStringLiteral( "%1/%2" ).arg( path, locale.name() );
QString affFile = prefix + QStringLiteral( ".aff" ); QString affFile = prefix + QStringLiteral( ".aff" );
@ -63,7 +65,7 @@ void QskHunspellTextPredictor::loadDictionaries()
{ {
QString userPaths = QString::fromUtf8( qgetenv( "QSK_HUNSPELL_PATH" ) ); QString userPaths = QString::fromUtf8( qgetenv( "QSK_HUNSPELL_PATH" ) );
#if defined(Q_OS_WIN32) #if defined( Q_OS_WIN32 )
QChar separator( ';' ); QChar separator( ';' );
QStringList defaultPaths; QStringList defaultPaths;
#else #else
@ -106,7 +108,7 @@ void QskHunspellTextPredictor::request( const QString& text )
char** suggestions; char** suggestions;
QTextCodec *codec = QTextCodec::codecForName( m_data->hunspellEncoding ); const auto codec = QTextCodec::codecForName( m_data->hunspellEncoding );
const QByteArray word = codec ? codec->fromUnicode( text ) : text.toUtf8(); const QByteArray word = codec ? codec->fromUnicode( text ) : text.toUtf8();
const int count = Hunspell_suggest( const int count = Hunspell_suggest(

View File

@ -318,7 +318,7 @@ QskInputContextFactory* QskInputContext::factory() const
return m_data->factory; return m_data->factory;
} }
std::shared_ptr<QskTextPredictor> QskInputContext::textPredictor( const QLocale& locale ) std::shared_ptr< QskTextPredictor > QskInputContext::textPredictor( const QLocale& locale )
{ {
if ( m_data->factory ) if ( m_data->factory )
return m_data->factory->setupPredictor( locale ); return m_data->factory->setupPredictor( locale );
@ -550,12 +550,12 @@ std::shared_ptr< QskTextPredictor > QskInputContextFactory::setupPredictor( cons
QskTextPredictor* QskInputContextFactory::createPredictor( const QLocale& locale ) QskTextPredictor* QskInputContextFactory::createPredictor( const QLocale& locale )
{ {
#if HUNSPELL #if HUNSPELL
return new QskHunspellTextPredictor( locale ); return new QskHunspellTextPredictor( locale );
#else #else
Q_UNUSED( locale ); Q_UNUSED( locale );
#endif #endif
return nullptr; return nullptr;
} }
QskInputPanel* QskInputContextFactory::createPanel() const QskInputPanel* QskInputContextFactory::createPanel() const

View File

@ -369,10 +369,7 @@ QskInputPanel::QskInputPanel( QQuickItem* parent )
this, &QskInputPanel::updateLocale ); this, &QskInputPanel::updateLocale );
connect( &m_data->keyProcessor, &KeyProcessor::keyProcessingFinished, connect( &m_data->keyProcessor, &KeyProcessor::keyProcessingFinished,
this, [this]( const Result& result ) this, [this]( const Result& result ) { m_data->handleKeyProcessingFinished( result ); } );
{
m_data->handleKeyProcessingFinished( result );
} );
updateLocale( locale() ); updateLocale( locale() );
} }
@ -489,9 +486,9 @@ void QskInputPanel::resetPredictor( const QLocale& locale )
{ {
// text predictor lives in another thread, so these will all be QueuedConnections: // text predictor lives in another thread, so these will all be QueuedConnections:
connect( this, &QskInputPanel::predictionReset, connect( this, &QskInputPanel::predictionReset,
predictor.get(), &QskTextPredictor::reset ); predictor.get(), &QskTextPredictor::reset );
connect( this, &QskInputPanel::predictionRequested, connect( this, &QskInputPanel::predictionRequested,
predictor.get(), &QskTextPredictor::request ); predictor.get(), &QskTextPredictor::request );
connect( predictor.get(), &QskTextPredictor::predictionChanged, connect( predictor.get(), &QskTextPredictor::predictionChanged,
this, &QskInputPanel::updatePrediction ); this, &QskInputPanel::updatePrediction );

View File

@ -53,7 +53,7 @@ class QSK_EXPORT QskInputPanel : public QskControl
virtual void attachItem( QQuickItem* ) = 0; virtual void attachItem( QQuickItem* ) = 0;
private: private:
void updatePrediction( const QString &text, const QStringList &candidates ); void updatePrediction( const QString&, const QStringList& candidates );
void resetPredictor( const QLocale& ); void resetPredictor( const QLocale& );
void updateLocale( const QLocale& ); void updateLocale( const QLocale& );

View File

@ -118,7 +118,7 @@ void QskBoxNode::setBoxData( const QRectF& rect,
if ( isFillMonochrome && isBorderMonochrome ) if ( isFillMonochrome && isBorderMonochrome )
{ {
if ( borderColors.gradient( Qsk::Left ).startColor() if ( borderColors.gradient( Qsk::Left ).startColor()
== fillGradient.startColor() ) == fillGradient.startColor() )
{ {
// we can draw border and background in one // we can draw border and background in one
hasBorder = false; hasBorder = false;

View File

@ -561,9 +561,10 @@ namespace
{ {
} }
void addAdditionalLines( float x11, float y11, float x12, float y12, // start line void addAdditionalLines(
float x21,float y21, float x22, float y22, // end line float x11, float y11, float x12, float y12, // start line
const QskGradient& gradient, Line* lines ) float x21, float y21, float x22, float y22, // end line
const QskGradient& gradient, Line* lines )
{ {
int additionalStopCount = additionalGradientStops( gradient ); int additionalStopCount = additionalGradientStops( gradient );
@ -712,35 +713,37 @@ namespace
if( additionalGradientStops( borderMapTR.gradient() ) > 0 ) if( additionalGradientStops( borderMapTR.gradient() ) > 0 )
{ {
float x1TR = c[ TopRight ].centerX + v.dx1( TopRight ), float x1TR = c[ TopRight ].centerX + v.dx1( TopRight ),
y1TR = c[ TopRight ].centerY - v.dy1( TopRight ), y1TR = c[ TopRight ].centerY - v.dy1( TopRight ),
x2TR = c[ TopRight ].centerX + v.dx2( TopRight ), x2TR = c[ TopRight ].centerX + v.dx2( TopRight ),
y2TR = c[ TopRight ].centerY - v.dy2( TopRight ), y2TR = c[ TopRight ].centerY - v.dy2( TopRight ),
x1TL = c[ TopLeft ].centerX - v.dx1( TopLeft ), x1TL = c[ TopLeft ].centerX - v.dx1( TopLeft ),
y1TL = c[ TopLeft ].centerY - v.dy1( TopLeft ), y1TL = c[ TopLeft ].centerY - v.dy1( TopLeft ),
x2TL = c[ TopLeft ].centerX - v.dx2( TopLeft ), x2TL = c[ TopLeft ].centerX - v.dx2( TopLeft ),
y2TL = c[ TopLeft ].centerY - v.dy2( TopLeft ); y2TL = c[ TopLeft ].centerY - v.dy2( TopLeft );
addAdditionalLines( x1TR, y1TR, x2TR, y2TR, addAdditionalLines(
x1TL, y1TL, x2TL, y2TL, x1TR, y1TR, x2TR, y2TR,
borderMapTR.gradient(), linesTR + k ); x1TL, y1TL, x2TL, y2TL,
borderMapTR.gradient(), linesTR + k );
} }
if( additionalGradientStops( borderMapBL.gradient() ) > 0 ) if( additionalGradientStops( borderMapBL.gradient() ) > 0 )
{ {
float x1BL = c[ BottomLeft ].centerX - v.dx1( BottomLeft ), float x1BL = c[ BottomLeft ].centerX - v.dx1( BottomLeft ),
y1BL = c[ BottomLeft ].centerY + v.dy1( BottomLeft ), y1BL = c[ BottomLeft ].centerY + v.dy1( BottomLeft ),
x2BL = c[ BottomLeft ].centerX - v.dx2( BottomLeft ), x2BL = c[ BottomLeft ].centerX - v.dx2( BottomLeft ),
y2BL = c[ BottomLeft ].centerY + v.dy2( BottomLeft ), y2BL = c[ BottomLeft ].centerY + v.dy2( BottomLeft ),
x1BR = c[ BottomRight ].centerX + v.dx1( BottomRight ), x1BR = c[ BottomRight ].centerX + v.dx1( BottomRight ),
y1BR = c[ BottomRight ].centerY + v.dy1( BottomRight ), y1BR = c[ BottomRight ].centerY + v.dy1( BottomRight ),
x2BR = c[ BottomRight ].centerX + v.dx2( BottomRight ), x2BR = c[ BottomRight ].centerX + v.dx2( BottomRight ),
y2BR = c[ BottomRight ].centerY + v.dy2( BottomRight ); y2BR = c[ BottomRight ].centerY + v.dy2( BottomRight );
addAdditionalLines( x1BL, y1BL, x2BL, y2BL, addAdditionalLines(
x1BR, y1BR, x2BR, y2BR, x1BL, y1BL, x2BL, y2BL,
borderMapBL.gradient(), linesBL + k ); x1BR, y1BR, x2BR, y2BR,
borderMapBL.gradient(), linesBL + k );
} }
} }
@ -749,35 +752,37 @@ namespace
if( additionalGradientStops( borderMapTL.gradient() ) > 0 ) if( additionalGradientStops( borderMapTL.gradient() ) > 0 )
{ {
float x1TL = c[ TopLeft ].centerX - v.dx1( TopLeft ), float x1TL = c[ TopLeft ].centerX - v.dx1( TopLeft ),
y1TL = c[ TopLeft ].centerY - v.dy1( TopLeft ), y1TL = c[ TopLeft ].centerY - v.dy1( TopLeft ),
x2TL = c[ TopLeft ].centerX - v.dx2( TopLeft ), x2TL = c[ TopLeft ].centerX - v.dx2( TopLeft ),
y2TL = c[ TopLeft ].centerY - v.dy2( TopLeft ), y2TL = c[ TopLeft ].centerY - v.dy2( TopLeft ),
x1BL = c[ BottomLeft ].centerX - v.dx1( BottomLeft ), x1BL = c[ BottomLeft ].centerX - v.dx1( BottomLeft ),
y1BL = c[ BottomLeft ].centerY + v.dy1( BottomLeft ), y1BL = c[ BottomLeft ].centerY + v.dy1( BottomLeft ),
x2BL = c[ BottomLeft ].centerX - v.dx2( BottomLeft ), x2BL = c[ BottomLeft ].centerX - v.dx2( BottomLeft ),
y2BL = c[ BottomLeft ].centerY + v.dy2( BottomLeft ); y2BL = c[ BottomLeft ].centerY + v.dy2( BottomLeft );
addAdditionalLines( x1TL, y1TL, x2TL, y2TL, addAdditionalLines(
x1BL, y1BL, x2BL, y2BL, x1TL, y1TL, x2TL, y2TL,
borderMapTL.gradient(), linesTL + j ); x1BL, y1BL, x2BL, y2BL,
borderMapTL.gradient(), linesTL + j );
} }
if( additionalGradientStops( borderMapBR.gradient() ) > 0 ) if( additionalGradientStops( borderMapBR.gradient() ) > 0 )
{ {
float x1BR = c[ BottomRight ].centerX + v.dx1( BottomRight ), float x1BR = c[ BottomRight ].centerX + v.dx1( BottomRight ),
y1BR = c[ BottomRight ].centerY + v.dy1( BottomRight ), y1BR = c[ BottomRight ].centerY + v.dy1( BottomRight ),
x2BR = c[ BottomRight ].centerX + v.dx2( BottomRight ), x2BR = c[ BottomRight ].centerX + v.dx2( BottomRight ),
y2BR = c[ BottomRight ].centerY + v.dy2( BottomRight ), y2BR = c[ BottomRight ].centerY + v.dy2( BottomRight ),
x1TR = c[ TopRight ].centerX + v.dx1( TopRight ), x1TR = c[ TopRight ].centerX + v.dx1( TopRight ),
y1TR = c[ TopRight ].centerY - v.dy1( TopRight ), y1TR = c[ TopRight ].centerY - v.dy1( TopRight ),
x2TR = c[ TopRight ].centerX + v.dx2( TopRight ), x2TR = c[ TopRight ].centerX + v.dx2( TopRight ),
y2TR = c[ TopRight ].centerY - v.dy2( TopRight ); y2TR = c[ TopRight ].centerY - v.dy2( TopRight );
addAdditionalLines( x1BR, y1BR, x2BR, y2BR, addAdditionalLines(
x1TR, y1TR, x2TR, y2TR, x1BR, y1BR, x2BR, y2BR,
borderMapBR.gradient(), linesBR + j ); x1TR, y1TR, x2TR, y2TR,
borderMapBR.gradient(), linesBR + j );
} }
} }
} }
@ -1011,17 +1016,13 @@ static inline void qskRenderBorder( const QskBoxRenderer::Metrics& metrics,
const int stepCount = metrics.corner[ 0 ].stepCount; const int stepCount = metrics.corner[ 0 ].stepCount;
auto left = c.gradient( Qsk::Left ), top = c.gradient( Qsk::Top ), auto left = c.gradient( Qsk::Left ), top = c.gradient( Qsk::Top ),
right = c.gradient( Qsk::Right ), bottom = c.gradient( Qsk::Bottom ); right = c.gradient( Qsk::Right ), bottom = c.gradient( Qsk::Bottom );
qskRenderBorderLines( metrics, orientation, line, qskRenderBorderLines( metrics, orientation, line,
BorderMapGradient( stepCount, qskRgbGradientStart( top ), BorderMapGradient( stepCount, qskRgbGradientStart( top ), qskRgbGradientEnd( left ), left ),
qskRgbGradientEnd( left ), left ), BorderMapGradient( stepCount, qskRgbGradientStart( right ), qskRgbGradientEnd( top ), top ),
BorderMapGradient( stepCount, qskRgbGradientStart( right ), BorderMapGradient( stepCount, qskRgbGradientStart( left ), qskRgbGradientEnd( bottom ), bottom ),
qskRgbGradientEnd( top ), top ), BorderMapGradient( stepCount, qskRgbGradientStart( bottom ), qskRgbGradientEnd( right ), right ) );
BorderMapGradient( stepCount, qskRgbGradientStart( left ),
qskRgbGradientEnd( bottom ), bottom ),
BorderMapGradient( stepCount, qskRgbGradientStart( bottom ),
qskRgbGradientEnd( right ), right ) );
} }
} }
@ -1071,16 +1072,12 @@ static inline void qskRenderBoxRandom(
const int n = metrics.corner[ 0 ].stepCount; const int n = metrics.corner[ 0 ].stepCount;
auto left = bc.gradient( Qsk::Left ), top = bc.gradient( Qsk::Top ), auto left = bc.gradient( Qsk::Left ), top = bc.gradient( Qsk::Top ),
right = bc.gradient( Qsk::Right ), bottom = bc.gradient( Qsk::Bottom ); right = bc.gradient( Qsk::Right ), bottom = bc.gradient( Qsk::Bottom );
const BorderMapGradient tl( n, qskRgbGradientStart( top.startColor() ), const BorderMapGradient tl( n, qskRgbGradientStart( top.startColor() ), qskRgbGradientEnd( left.endColor() ), left );
qskRgbGradientEnd( left.endColor() ), left ); const BorderMapGradient tr( n, qskRgbGradientStart( right ), qskRgbGradientEnd( top ), top );
const BorderMapGradient tr( n, qskRgbGradientStart( right ), const BorderMapGradient bl( n, qskRgbGradientStart( left ), qskRgbGradientEnd( bottom ), bottom );
qskRgbGradientEnd( top ), top ); const BorderMapGradient br( n, qskRgbGradientStart( bottom ), qskRgbGradientEnd( right ), right );
const BorderMapGradient bl( n, qskRgbGradientStart( left ),
qskRgbGradientEnd( bottom ), bottom );
const BorderMapGradient br( n, qskRgbGradientStart( bottom ),
qskRgbGradientEnd( right ), right );
if ( gradient.isMonochrome() ) if ( gradient.isMonochrome() )
{ {

View File

@ -623,9 +623,14 @@ void QskBoxRenderer::renderRect(
auto fillLines = line + fillLineCount; auto fillLines = line + fillLineCount;
if ( bc.isMonochrome() ) if ( bc.isMonochrome() )
qskCreateBorderMonochrome( rect, in, bc.gradient( Qsk::Left ).startColor().rgba(), fillLines ); {
const auto rgb = bc.gradient( Qsk::Left ).startColor().rgba();
qskCreateBorderMonochrome( rect, in, rgb, fillLines );
}
else else
{
qskCreateBorder( rect, in, bc, fillLines ); qskCreateBorder( rect, in, bc, fillLines );
}
} }
} }