graphic label skin hints
This commit is contained in:
parent
83cca49bd5
commit
aa6d3eba1b
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <QtGui/QImage>
|
||||
|
||||
QSK_SUBCONTROL( MenuBarGraphicLabel, Graphic )
|
||||
QSK_SUBCONTROL( MenuBarLabel, Text )
|
||||
QSK_SUBCONTROL( MenuItem, Panel )
|
||||
|
||||
|
@ -25,10 +26,9 @@ MenuItem::MenuItem( const QString& name, QQuickItem* parent ) : QskLinearBox( Qt
|
|||
QString fileName = ":/images/" + name.toLower() + ".png"; // width: 14
|
||||
QImage image( fileName );
|
||||
auto graphic = QskGraphic::fromImage( image );
|
||||
auto* graphicLabel = new QskGraphicLabel( graphic, this );
|
||||
auto* graphicLabel = new MenuBarGraphicLabel( graphic, this );
|
||||
graphicLabel->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
graphicLabel->setFixedWidth( 14 );
|
||||
graphicLabel->setAlignment( Qt::AlignCenter );
|
||||
|
||||
new MenuBarLabel( name, this );
|
||||
}
|
||||
|
|
|
@ -1,9 +1,34 @@
|
|||
#ifndef MENUBAR_H
|
||||
#define MENUBAR_H
|
||||
|
||||
#include <QskGraphicLabel.h>
|
||||
#include <QskLinearBox.h>
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
class MenuBarGraphicLabel : public QskGraphicLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QSK_SUBCONTROLS( Graphic )
|
||||
|
||||
MenuBarGraphicLabel( const QskGraphic& graphic, QQuickItem* parent = nullptr )
|
||||
: QskGraphicLabel( graphic, parent )
|
||||
{
|
||||
}
|
||||
|
||||
QskAspect::Subcontrol effectiveSubcontrol(
|
||||
QskAspect::Subcontrol subControl ) const override final
|
||||
{
|
||||
if( subControl == QskGraphicLabel::Graphic )
|
||||
{
|
||||
return Graphic;
|
||||
}
|
||||
|
||||
return subControl;
|
||||
}
|
||||
};
|
||||
|
||||
class MenuBarLabel : public QskTextLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -72,6 +72,8 @@ void Skin::initHints( const Palette& palette )
|
|||
ed.setColor( MenuBarLabel::Text, Qt::white );
|
||||
ed.setFontRole( MenuBarLabel::Text, QskSkin::SmallFont );
|
||||
|
||||
ed.setAlignment( MenuBarGraphicLabel::Graphic, Qt::AlignCenter );
|
||||
|
||||
|
||||
ed.setGradient( MenuBar::Panel, palette.menuBar );
|
||||
ed.setGradient( MainContent::Panel, palette.mainContent );
|
||||
|
|
Loading…
Reference in New Issue