CustomFrame: Allow to specify a callback for QWindow opt-in

Which QWindows should get a custom frame is up to you. Just
return true in the callback.
This commit is contained in:
Sergio Martins
2021-02-18 14:10:40 +00:00
parent 0d101d779f
commit cd19c5eb38
2 changed files with 11 additions and 3 deletions

View File

@@ -124,13 +124,16 @@ public:
#endif // Q_OS_WIN
typedef bool (*ShouldUseCustomFrame)(QWindow *);
class DOCKS_EXPORT CustomFrameHelper
: public QObject
, public QAbstractNativeEventFilter
{
Q_OBJECT
public:
explicit CustomFrameHelper(QObject *parent = nullptr);
explicit CustomFrameHelper(ShouldUseCustomFrame shouldUseCustomFrameFunc,
QObject *parent = nullptr);
~CustomFrameHelper() override;
public Q_SLOTS:
@@ -142,6 +145,7 @@ protected:
private:
bool m_inDtor = false;
ShouldUseCustomFrame m_shouldUseCustomFrameFunc = nullptr;
};
}