style menu bar top label
This commit is contained in:
parent
2db80364b1
commit
56a9f6dffe
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <QtGui/QImage>
|
||||
|
||||
QSK_SUBCONTROL( MenuBarTopLabel, Graphic )
|
||||
QSK_SUBCONTROL( MenuBarGraphicLabel, Graphic )
|
||||
QSK_SUBCONTROL( MenuBarLabel, Text )
|
||||
QSK_SUBCONTROL( MenuItem, Panel )
|
||||
|
@ -57,9 +58,8 @@ MenuBar::MenuBar( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, parent )
|
|||
auto* mainIcon = ":/images/main-icon.png";
|
||||
QImage image( mainIcon );
|
||||
auto graphic = QskGraphic::fromImage( image );
|
||||
auto* graphicLabel = new QskGraphicLabel( graphic, this );
|
||||
graphicLabel->setAlignment( Qt::AlignTop );
|
||||
graphicLabel->setMargins( { 50, 0, 50, 54 } );
|
||||
auto* graphicLabel = new MenuBarTopLabel( graphic, this );
|
||||
graphicLabel->setMargins( marginHint( MenuBarTopLabel::Graphic ) );
|
||||
graphicLabel->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
|
||||
m_entryStrings = { "Dashboard", "Rooms", "Devices", "Statistics", "Storage", "Members" };
|
||||
|
|
|
@ -5,6 +5,30 @@
|
|||
#include <QskLinearBox.h>
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
class MenuBarTopLabel : public QskGraphicLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QSK_SUBCONTROLS( Graphic )
|
||||
|
||||
MenuBarTopLabel( 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 MenuBarGraphicLabel : public QskGraphicLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -79,6 +79,8 @@ void Skin::initHints( const Palette& palette )
|
|||
ed.setColor( MenuBarLabel::Text, Qt::white );
|
||||
ed.setFontRole( MenuBarLabel::Text, QskSkin::SmallFont );
|
||||
|
||||
ed.setMargin( MenuBarTopLabel::Graphic, { 50, 0, 50, 54 } );
|
||||
|
||||
ed.setAlignment( MenuBarGraphicLabel::Graphic, Qt::AlignCenter );
|
||||
|
||||
// top bar:
|
||||
|
|
Loading…
Reference in New Issue