QskMenu: Add own subcontrol Overlay

... so we can style it differently from the one of the QskPopup
This commit is contained in:
Peter Hartmann 2023-02-14 17:33:13 +01:00 committed by uwerat
parent 8df1551701
commit cf2e17def5
3 changed files with 6 additions and 1 deletions

View File

@ -324,6 +324,8 @@ void Editor::setupMenu()
setBoxBorderMetrics( Q::Panel, 0 ); setBoxBorderMetrics( Q::Panel, 0 );
setPadding( Q::Panel, 0 ); setPadding( Q::Panel, 0 );
setGradient( Q::Overlay, Qt::transparent );
// The color here is primary with an opacity of 8% - we blend that // The color here is primary with an opacity of 8% - we blend that
// with the background, because we don't want the menu to have transparency: // with the background, because we don't want the menu to have transparency:
const auto panel = flattenedColor( m_pal.primary, m_pal.background, 0.08 ); const auto panel = flattenedColor( m_pal.primary, m_pal.background, 0.08 );

View File

@ -17,6 +17,7 @@
#include <qvariant.h> #include <qvariant.h>
#include <qeventloop.h> #include <qeventloop.h>
QSK_SUBCONTROL( QskMenu, Overlay )
QSK_SUBCONTROL( QskMenu, Panel ) QSK_SUBCONTROL( QskMenu, Panel )
QSK_SUBCONTROL( QskMenu, Segment ) QSK_SUBCONTROL( QskMenu, Segment )
QSK_SUBCONTROL( QskMenu, Cursor ) QSK_SUBCONTROL( QskMenu, Cursor )
@ -81,6 +82,8 @@ QskMenu::QskMenu( QQuickItem* parent )
setPopupFlag( QskPopup::CloseOnPressOutside, true ); setPopupFlag( QskPopup::CloseOnPressOutside, true );
setPopupFlag( QskPopup::DeleteOnClose, true ); setPopupFlag( QskPopup::DeleteOnClose, true );
setSubcontrolProxy( Inherited::Overlay, Overlay );
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed ); initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
} }

View File

@ -32,7 +32,7 @@ class QSK_EXPORT QskMenu : public QskPopup
using Inherited = QskPopup; using Inherited = QskPopup;
public: public:
QSK_SUBCONTROLS( Panel, Segment, Cursor, Text, Graphic, Separator ) QSK_SUBCONTROLS( Overlay, Panel, Segment, Cursor, Text, Graphic, Separator )
QSK_STATES( Selected ) QSK_STATES( Selected )
QskMenu( QQuickItem* parentItem = nullptr ); QskMenu( QQuickItem* parentItem = nullptr );