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