This commit is contained in:
fourtf 2018-06-24 13:32:56 +02:00
parent 6c727cf82b
commit 573abe9f40
5 changed files with 13 additions and 2 deletions

View file

@ -20,7 +20,7 @@ public:
explicit BaseWidget(QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags()); explicit BaseWidget(QWidget *parent, Qt::WindowFlags f = Qt::WindowFlags());
virtual ~BaseWidget() override; virtual ~BaseWidget() override;
float getScale() const; virtual float getScale() const;
pajlada::Signals::Signal<float> scaleChanged; pajlada::Signals::Signal<float> scaleChanged;
QSize getScaleIndependantSize() const; QSize getScaleIndependantSize() const;

View file

@ -65,6 +65,11 @@ BaseWindow::BaseWindow(QWidget *parent, Flags _flags)
CreateWindowShortcut(this, "CTRL+0", [] { getApp()->settings->uiScale.setValue(0); }); CreateWindowShortcut(this, "CTRL+0", [] { getApp()->settings->uiScale.setValue(0); });
} }
float BaseWindow::getScale() const
{
return this->scale;
}
BaseWindow::Flags BaseWindow::getFlags() BaseWindow::Flags BaseWindow::getFlags()
{ {
return this->flags_; return this->flags_;

View file

@ -42,6 +42,8 @@ public:
void moveTo(QWidget *widget, QPoint point, bool offset = true); void moveTo(QWidget *widget, QPoint point, bool offset = true);
virtual float getScale() const override;
Flags getFlags(); Flags getFlags();
protected: protected:

View file

@ -20,7 +20,7 @@ Label::Label(BaseWidget *parent, QString text, FontStyle style)
{ {
auto app = getApp(); auto app = getApp();
app->fonts->fontChanged.connect([=] { this->updateSize(); }); this->connections_.managedConnect(app->fonts->fontChanged, [this] { this->updateSize(); });
} }
const QString &Label::getText() const const QString &Label::getText() const

View file

@ -3,6 +3,8 @@
#include "singletons/fontmanager.hpp" #include "singletons/fontmanager.hpp"
#include "widgets/basewidget.hpp" #include "widgets/basewidget.hpp"
#include <pajlada/signals/signalholder.hpp>
namespace chatterino { namespace chatterino {
namespace widgets { namespace widgets {
@ -33,6 +35,8 @@ protected:
virtual QSize minimumSizeHint() const override; virtual QSize minimumSizeHint() const override;
private: private:
pajlada::Signals::SignalHolder connections_;
QString text_; QString text_;
FontStyle fontStyle_; FontStyle fontStyle_;
QSize preferedSize_; QSize preferedSize_;