mirror-chatterino2/src/widgets/BaseWidget.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.6 KiB
C++
Raw Normal View History

#pragma once
#include <boost/optional.hpp>
#include <pajlada/signals/signal.hpp>
#include <pajlada/signals/signalholder.hpp>
#include <QShortcut>
#include <QWidget>
2019-10-07 15:46:08 +02:00
namespace chatterino {
class Theme;
class BaseWindow;
class BaseWidget : public QWidget
{
Q_OBJECT
public:
explicit BaseWidget(QWidget *parent = nullptr,
Qt::WindowFlags f = Qt::WindowFlags());
virtual float scale() const;
pajlada::Signals::Signal<float> scaleChanged;
boost::optional<float> overrideScale() const;
void setOverrideScale(boost::optional<float>);
QSize scaleIndependantSize() const;
int scaleIndependantWidth() const;
int scaleIndependantHeight() const;
void setScaleIndependantSize(int width, int height);
void setScaleIndependantSize(QSize);
void setScaleIndependantWidth(int value);
void setScaleIndependantHeight(int value);
float qtFontScale() const;
protected:
virtual void childEvent(QChildEvent *) override;
virtual void showEvent(QShowEvent *) override;
virtual void scaleChangedEvent(float newScale);
virtual void themeChangedEvent();
[[deprecated("addShortcuts called without overriding it")]] virtual void
addShortcuts()
{
}
void setScale(float value);
Theme *theme;
std::vector<QShortcut *> shortcuts_;
void clearShortcuts();
pajlada::Signals::SignalHolder signalHolder_;
private:
float scale_{1.f};
boost::optional<float> overrideScale_;
QSize scaleIndependantSize_;
std::vector<BaseWidget *> widgets_;
friend class BaseWindow;
};
2019-10-07 15:46:08 +02:00
} // namespace chatterino