minor improvements

This commit is contained in:
Uwe Rathmann 2021-12-22 10:55:48 +01:00
parent 0ed89c111d
commit 0b5b622d1a
6 changed files with 32 additions and 10 deletions

View File

@ -138,9 +138,15 @@ QskPopup::QskPopup( QQuickItem* parent )
Inherited::setVisible( false );
setSkinStateFlag( QskPopup::Closed );
// we need to stop event propagation
setAcceptedMouseButtons( Qt::AllButtons );
setWheelEnabled( true );
/*
We need to stop event propagation.
Unfortunatly derived classes can't use setAcceptedMouseButtons anymore.
Need to think about a solution TODO ...
*/
Inherited::setAcceptedMouseButtons( Qt::AllButtons );
Inherited::setWheelEnabled( true );
// we don't want to be resized by layout code
setTransparentForPositioner( true );

View File

@ -4,7 +4,7 @@
*****************************************************************************/
#ifndef QSK_POPUP_H
#define QSK_POPUP_H 1
#define QSK_POPUP_H
#include "QskControl.h"
@ -69,6 +69,10 @@ class QSK_EXPORT QskPopup : public QskControl
bool isOpen() const;
bool isFading() const;
// we always need to accept all inputs, to stop further propagation
void setAcceptedMouseButtons( Qt::MouseButtons ) = delete;
void setWheelEnabled( bool ) = delete;
public Q_SLOTS:
void open();
void close();

View File

@ -19,7 +19,8 @@ class QSK_EXPORT QskPopupSkinlet : public QskSkinlet
public:
enum NodeRole
{
OverlayRole
OverlayRole,
RoleCount
};
Q_INVOKABLE QskPopupSkinlet( QskSkin* = nullptr );

View File

@ -24,21 +24,23 @@ QskSubWindowSkinlet::~QskSubWindowSkinlet() = default;
QRectF QskSubWindowSkinlet::subControlRect( const QskSkinnable* skinnable,
const QRectF& contentsRect, QskAspect::Subcontrol subControl ) const
{
using Q = QskSubWindow;
const auto subWindow = static_cast< const QskSubWindow* >( skinnable );
if ( subControl == QskSubWindow::Panel )
if ( subControl == Q::Panel )
{
return contentsRect;
}
else if ( subControl == QskSubWindow::TitleBarPanel )
else if ( subControl == Q::TitleBarPanel )
{
return titleBarRect( subWindow, contentsRect );
}
else if ( subControl == QskSubWindow::TitleBarSymbol )
else if ( subControl == Q::TitleBarSymbol )
{
return symbolRect( subWindow, contentsRect );
}
else if ( subControl == QskSubWindow::TitleBarText )
else if ( subControl == Q::TitleBarText )
{
return titleRect( subWindow, contentsRect );
}

View File

@ -19,7 +19,7 @@ class QSK_EXPORT QskSubWindowSkinlet : public QskPopupSkinlet
public:
enum NodeRole
{
PanelRole = QskPopupSkinlet::OverlayRole + 1,
PanelRole = QskPopupSkinlet::RoleCount,
TitleBarRole,
SymbolRole,
TitleRole

View File

@ -72,6 +72,15 @@ namespace QskSGNode
return node;
}
template< typename Node >
inline Node* ensureNode( QSGNode* node )
{
if ( node == nullptr )
node = new Node();
return static_cast< Node* >( node );
}
}
#endif