added settings
This commit is contained in:
@@ -16,15 +16,17 @@ ChatWidgetHeaderButton::ChatWidgetHeaderButton()
|
||||
{
|
||||
setLayout(&hbox);
|
||||
|
||||
label.setAlignment(Qt::AlignCenter);
|
||||
|
||||
hbox.setMargin(0);
|
||||
hbox.addSpacing(6);
|
||||
hbox.addWidget(&this->label);
|
||||
hbox.addSpacing(6);
|
||||
|
||||
QObject::connect(&this->label, &ChatWidgetHeaderButtonLabel::mouseUp, this,
|
||||
QObject::connect(&this->label, &SignalLabel::mouseUp, this,
|
||||
&ChatWidgetHeaderButton::labelMouseUp);
|
||||
QObject::connect(&this->label, &ChatWidgetHeaderButtonLabel::mouseDown,
|
||||
this, &ChatWidgetHeaderButton::labelMouseDown);
|
||||
QObject::connect(&this->label, &SignalLabel::mouseDown, this,
|
||||
&ChatWidgetHeaderButton::labelMouseDown);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef CHATWIDGETHEADERBUTTON_H
|
||||
#define CHATWIDGETHEADERBUTTON_H
|
||||
|
||||
#include "widgets/chatwidgetheaderbuttonlabel.h"
|
||||
#include "widgets/signallabel.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
@@ -18,7 +18,7 @@ class ChatWidgetHeaderButton : public QWidget
|
||||
public:
|
||||
ChatWidgetHeaderButton();
|
||||
|
||||
ChatWidgetHeaderButtonLabel &
|
||||
SignalLabel &
|
||||
getLabel()
|
||||
{
|
||||
return label;
|
||||
@@ -38,7 +38,7 @@ protected:
|
||||
|
||||
private:
|
||||
QHBoxLayout hbox;
|
||||
ChatWidgetHeaderButtonLabel label;
|
||||
SignalLabel label;
|
||||
|
||||
bool mouseOver;
|
||||
bool mouseDown;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#include "widgets/chatwidgetheaderbuttonlabel.h"
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
ChatWidgetHeaderButtonLabel::ChatWidgetHeaderButtonLabel()
|
||||
{
|
||||
setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidgetHeaderButtonLabel::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit mouseDown();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidgetHeaderButtonLabel::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit mouseUp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef CHATWIDGETHEADERBUTTONLABEL_H
|
||||
#define CHATWIDGETHEADERBUTTONLABEL_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
class ChatWidgetHeaderButtonLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChatWidgetHeaderButtonLabel();
|
||||
|
||||
signals:
|
||||
void mouseDown();
|
||||
void mouseUp();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CHATWIDGETHEADERBUTTONLABEL_H
|
||||
@@ -7,6 +7,7 @@ namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
ChatWidgetInput::ChatWidgetInput()
|
||||
: edit(this)
|
||||
{
|
||||
setFixedHeight(38);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CHATWIDGETINPUT_H
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QTextEdit>
|
||||
#include <QWidget>
|
||||
|
||||
namespace chatterino {
|
||||
@@ -16,6 +17,9 @@ public:
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
private:
|
||||
QTextEdit edit;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,6 +147,10 @@ ChatWidgetView::paintEvent(QPaintEvent *)
|
||||
}
|
||||
|
||||
y += message->getHeight();
|
||||
|
||||
if (y > height()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+30
-3
@@ -3,21 +3,48 @@
|
||||
|
||||
#include <QFlags>
|
||||
#include <QLabel>
|
||||
#include <QMouseEvent>
|
||||
#include <QWidget>
|
||||
|
||||
class SignalLabel : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SignalLabel(QWidget *parent = 0, Qt::WindowFlags f = 0)
|
||||
: QLabel(parent, f) {}
|
||||
: QLabel(parent, f)
|
||||
{
|
||||
}
|
||||
virtual ~SignalLabel() = default;
|
||||
|
||||
signals:
|
||||
void mouseDoubleClick(QMouseEvent *ev);
|
||||
|
||||
void mouseDown();
|
||||
void mouseUp();
|
||||
|
||||
protected:
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *ev) override {
|
||||
virtual void
|
||||
mouseDoubleClickEvent(QMouseEvent *ev) override
|
||||
{
|
||||
emit this->mouseDoubleClick(ev);
|
||||
}
|
||||
|
||||
virtual void
|
||||
mousePressEvent(QMouseEvent *event) override
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit mouseDown();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mouseReleaseEvent(QMouseEvent *event) override
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
emit mouseUp();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif // SIGNALLABEL_H
|
||||
#endif // SIGNALLABEL_H
|
||||
|
||||
Reference in New Issue
Block a user