spacing added

This commit is contained in:
Uwe Rathmann 2022-08-26 13:19:37 +02:00
parent b84dfc8226
commit 2479064f58
3 changed files with 21 additions and 0 deletions

View File

@ -34,6 +34,8 @@ namespace
{ {
using Q = QskPushButton; using Q = QskPushButton;
setSpacing( button->spacingHint( Q::Panel ) );
const auto graphicSourceSize = button->graphic().defaultSize(); const auto graphicSourceSize = button->graphic().defaultSize();
const bool hasText = !button->text().isEmpty(); const bool hasText = !button->text().isEmpty();

View File

@ -143,6 +143,10 @@ QSizeF QskSubcontrolLayoutEngine::TextElement::implicitSize( const QSizeF& const
const auto font = skinnable()->effectiveFont( subControl() ); const auto font = skinnable()->effectiveFont( subControl() );
const auto textOptions = skinnable()->textOptionsHint( subControl() ); const auto textOptions = skinnable()->textOptionsHint( subControl() );
#if 0
// what about skinnable()->strutSizeHint( subControl() ); ????
#endif
QSizeF hint; QSizeF hint;
const qreal lineHeight = QFontMetricsF( font ).height(); const qreal lineHeight = QFontMetricsF( font ).height();
@ -308,6 +312,16 @@ Qt::Orientation QskSubcontrolLayoutEngine::orientation() const
return m_data->orientation; return m_data->orientation;
} }
void QskSubcontrolLayoutEngine::setSpacing( qreal spacing )
{
Inherited::setSpacing( spacing, Qt::Horizontal | Qt::Vertical );
}
qreal QskSubcontrolLayoutEngine::spacing() const
{
return Inherited::spacing( m_data->orientation );
}
void QskSubcontrolLayoutEngine::setElementAt( int index, LayoutElement* element ) void QskSubcontrolLayoutEngine::setElementAt( int index, LayoutElement* element )
{ {
if ( index >= 0 && index < count() ) if ( index >= 0 && index < count() )

View File

@ -22,6 +22,8 @@ class QskSkinnable;
*/ */
class QskSubcontrolLayoutEngine : public QskLayoutEngine2D class QskSubcontrolLayoutEngine : public QskLayoutEngine2D
{ {
using Inherited = QskLayoutEngine2D;
public: public:
class LayoutElement : public QskLayoutElement class LayoutElement : public QskLayoutElement
{ {
@ -116,6 +118,9 @@ class QskSubcontrolLayoutEngine : public QskLayoutEngine2D
Qt::Orientation orientation() const; Qt::Orientation orientation() const;
bool setOrientation( Qt::Orientation ); bool setOrientation( Qt::Orientation );
void setSpacing( qreal );
qreal spacing() const;
void setElementAt( int index, LayoutElement* ); void setElementAt( int index, LayoutElement* );
LayoutElement* elementAt( int ) const; LayoutElement* elementAt( int ) const;