qskinny/src/controls/QskSetup.h

82 lines
1.8 KiB
C
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_SETUP_H
2021-02-09 08:13:20 +01:00
#define QSK_SETUP_H
2017-07-21 18:21:34 +02:00
#include "QskGlobal.h"
2021-02-09 08:13:20 +01:00
#include "QskQuickItem.h"
2018-08-03 08:15:28 +02:00
#include <qobject.h>
2017-07-21 18:21:34 +02:00
#include <memory>
class QskSkin;
2018-04-04 20:19:47 +02:00
class QQuickItem;
2017-07-21 18:21:34 +02:00
class QskGraphicProvider;
class QLocale;
#if defined( qskSetup )
#undef qskSetup
#endif
#define qskSetup QskSetup::instance()
class QSK_EXPORT QskSetup : public QObject
{
Q_OBJECT
2018-08-03 08:15:28 +02:00
public:
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
static QskSetup* instance();
2017-07-21 18:21:34 +02:00
2021-02-09 08:13:20 +01:00
void setItemUpdateFlags( QskQuickItem::UpdateFlags );
void resetItemUpdateFlags();
QskQuickItem::UpdateFlags itemUpdateFlags() const;
2017-07-21 18:21:34 +02:00
2021-02-09 08:13:20 +01:00
void setItemUpdateFlag( QskQuickItem::UpdateFlag, bool on = true );
void resetItemUpdateFlag( QskQuickItem::UpdateFlag );
bool testItemUpdateFlag( QskQuickItem::UpdateFlag );
2017-07-21 18:21:34 +02:00
2021-02-09 08:13:20 +01:00
QskSkin* setSkin( const QString& );
QString skinName() const;
2017-07-21 18:21:34 +02:00
QskSkin* skin();
void addGraphicProvider( const QString& providerId, QskGraphicProvider* );
QskGraphicProvider* graphicProvider( const QString& providerId ) const;
static void setup();
static void cleanup();
QLocale inheritedLocale( const QObject* );
void inheritLocale( QObject*, const QLocale& );
static QskSetup* qmlAttachedProperties( QObject* );
2018-08-03 08:15:28 +02:00
Q_SIGNALS:
2017-07-21 18:21:34 +02:00
void skinChanged( QskSkin* );
2021-02-09 08:13:20 +01:00
void itemUpdateFlagsChanged();
2017-07-21 18:21:34 +02:00
2018-08-03 08:15:28 +02:00
private:
2017-07-21 18:21:34 +02:00
QskSetup();
2018-07-31 17:32:25 +02:00
~QskSetup() override;
2017-07-21 18:21:34 +02:00
2018-07-31 17:32:25 +02:00
bool eventFilter( QObject*, QEvent* ) override final;
2017-07-21 18:21:34 +02:00
static QskSetup* s_instance;
class PrivateData;
std::unique_ptr< PrivateData > m_data;
};
2018-08-03 08:15:28 +02:00
inline QskSetup* QskSetup::instance()
2017-07-21 18:21:34 +02:00
{
Q_ASSERT( s_instance );
return s_instance;
}
#endif