more skin hints

This commit is contained in:
Peter Hartmann 2021-03-26 12:56:51 +01:00
parent 23a14f0fb7
commit 83cca49bd5
3 changed files with 30 additions and 3 deletions

View File

@ -8,6 +8,7 @@
#include <QtGui/QImage> #include <QtGui/QImage>
QSK_SUBCONTROL( MenuBarLabel, Text )
QSK_SUBCONTROL( MenuItem, Panel ) QSK_SUBCONTROL( MenuItem, Panel )
MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ), MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt::Horizontal, parent ),
@ -29,9 +30,7 @@ MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt
graphicLabel->setFixedWidth( 14 ); graphicLabel->setFixedWidth( 14 );
graphicLabel->setAlignment( Qt::AlignCenter ); graphicLabel->setAlignment( Qt::AlignCenter );
auto* textLabel = new QskTextLabel( name, this ); new MenuBarLabel( name, this );
textLabel->setTextColor( Qt::white ); // ### style
textLabel->setFontRole( QskSkin::SmallFont ); // ### style
} }
QskAspect::Subcontrol MenuItem::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const QskAspect::Subcontrol MenuItem::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const

View File

@ -2,6 +2,31 @@
#define MENUBAR_H #define MENUBAR_H
#include <QskLinearBox.h> #include <QskLinearBox.h>
#include <QskTextLabel.h>
class MenuBarLabel : public QskTextLabel
{
Q_OBJECT
public:
QSK_SUBCONTROLS( Text )
MenuBarLabel( const QString& text, QQuickItem* parent = nullptr )
: QskTextLabel( text, parent )
{
}
QskAspect::Subcontrol effectiveSubcontrol(
QskAspect::Subcontrol subControl ) const override final
{
if( subControl == QskTextLabel::Text )
{
return Text;
}
return subControl;
}
};
class MenuItem : public QskLinearBox class MenuItem : public QskLinearBox
{ {

View File

@ -69,6 +69,9 @@ void Skin::initHints( const Palette& palette )
color.setAlphaF( 0.09 ); color.setAlphaF( 0.09 );
ed.setGradient( MenuItem::Panel | QskControl::Hovered, color ); ed.setGradient( MenuItem::Panel | QskControl::Hovered, color );
ed.setColor( MenuBarLabel::Text, Qt::white );
ed.setFontRole( MenuBarLabel::Text, QskSkin::SmallFont );
ed.setGradient( MenuBar::Panel, palette.menuBar ); ed.setGradient( MenuBar::Panel, palette.menuBar );
ed.setGradient( MainContent::Panel, palette.mainContent ); ed.setGradient( MainContent::Panel, palette.mainContent );