mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added emote button and text length label
This commit is contained in:
parent
9165d5cc2e
commit
8d85f91c4d
17 changed files with 268 additions and 72 deletions
|
@ -9,6 +9,8 @@ namespace chatterino {
|
|||
namespace settings {
|
||||
class BoolSetting : public Setting
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BoolSetting(const QString &name, bool defaultValue)
|
||||
: Setting(name)
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace settings {
|
|||
|
||||
class FloatSetting : public Setting
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FloatSetting(const QString &name, qreal defaultValue,
|
||||
qreal minValue = std::numeric_limits<qreal>::min(),
|
||||
|
|
|
@ -9,6 +9,8 @@ namespace chatterino {
|
|||
namespace settings {
|
||||
class IntSetting : public Setting
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IntSetting(const QString &name, int defaultValue)
|
||||
: Setting(name)
|
||||
|
|
|
@ -7,8 +7,10 @@
|
|||
namespace chatterino {
|
||||
namespace settings {
|
||||
|
||||
class Setting
|
||||
class Setting : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Setting(const QString &name)
|
||||
: name(name)
|
||||
|
|
|
@ -31,7 +31,7 @@ BoolSetting Settings::enableGifAnimations("", true);
|
|||
BoolSetting Settings::enableGifs("", true);
|
||||
BoolSetting Settings::inlineWhispers("", true);
|
||||
BoolSetting Settings::windowTopMost("", true);
|
||||
BoolSetting Settings::compactTabs("", false);
|
||||
BoolSetting Settings::hideTabX("", false);
|
||||
|
||||
QSettings Settings::settings(
|
||||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation),
|
||||
|
|
|
@ -71,7 +71,7 @@ private:
|
|||
settingsItems.push_back(&enableGifs);
|
||||
settingsItems.push_back(&inlineWhispers);
|
||||
settingsItems.push_back(&windowTopMost);
|
||||
settingsItems.push_back(&compactTabs);
|
||||
settingsItems.push_back(&hideTabX);
|
||||
}
|
||||
|
||||
static QSettings settings;
|
||||
|
@ -91,135 +91,135 @@ private:
|
|||
|
||||
// settings
|
||||
public:
|
||||
static StringSetting
|
||||
static StringSetting &
|
||||
getTheme()
|
||||
{
|
||||
return Settings::theme;
|
||||
}
|
||||
static StringSetting
|
||||
static StringSetting &
|
||||
getUser()
|
||||
{
|
||||
return Settings::user;
|
||||
}
|
||||
static FloatSetting
|
||||
static FloatSetting &
|
||||
getEmoteScale()
|
||||
{
|
||||
return Settings::emoteScale;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getScaleEmotesByLineHeight()
|
||||
{
|
||||
return Settings::scaleEmotesByLineHeight;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getShowTimestamps()
|
||||
{
|
||||
return Settings::showTimestamps;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getShowTimestampSeconds()
|
||||
{
|
||||
return Settings::showTimestampSeconds;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getAllowDouplicateMessages()
|
||||
{
|
||||
return Settings::allowDouplicateMessages;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getLinksDoubleClickOnly()
|
||||
{
|
||||
return Settings::linksDoubleClickOnly;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getHideEmptyInput()
|
||||
{
|
||||
return Settings::hideEmptyInput;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getShowMessageLength()
|
||||
{
|
||||
return Settings::showMessageLength;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getSeperateMessages()
|
||||
{
|
||||
return Settings::seperateMessages;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getMentionUsersWithAt()
|
||||
{
|
||||
return Settings::mentionUsersWithAt;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getAllowCommandsAtEnd()
|
||||
{
|
||||
return Settings::allowCommandsAtEnd;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableHighlights()
|
||||
{
|
||||
return Settings::enableHighlights;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableHighlightSound()
|
||||
{
|
||||
return Settings::enableHighlightSound;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableHighlightTaskbar()
|
||||
{
|
||||
return Settings::enableHighlightTaskbar;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getCustomHighlightSound()
|
||||
{
|
||||
return Settings::customHighlightSound;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableTwitchEmotes()
|
||||
{
|
||||
return Settings::enableTwitchEmotes;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableBttvEmotes()
|
||||
{
|
||||
return Settings::enableBttvEmotes;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableFFzEmotes()
|
||||
{
|
||||
return Settings::enableFFzEmotes;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableEmojis()
|
||||
{
|
||||
return Settings::enableEmojis;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableGifAnimations()
|
||||
{
|
||||
return Settings::enableGifAnimations;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getEnableGifs()
|
||||
{
|
||||
return Settings::enableGifs;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getInlineWhispers()
|
||||
{
|
||||
return Settings::inlineWhispers;
|
||||
}
|
||||
static BoolSetting
|
||||
static BoolSetting &
|
||||
getWindowTopMost()
|
||||
{
|
||||
return Settings::windowTopMost;
|
||||
}
|
||||
static BoolSetting
|
||||
getCompactTabs()
|
||||
static BoolSetting &
|
||||
getHideTabX()
|
||||
{
|
||||
return Settings::compactTabs;
|
||||
return Settings::hideTabX;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -248,7 +248,7 @@ private:
|
|||
static BoolSetting enableGifs;
|
||||
static BoolSetting inlineWhispers;
|
||||
static BoolSetting windowTopMost;
|
||||
static BoolSetting compactTabs;
|
||||
static BoolSetting hideTabX;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace settings {
|
|||
|
||||
class StringSetting : public Setting
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StringSetting(const QString &name, const QString &defaultValue)
|
||||
: Setting(name)
|
||||
|
|
|
@ -63,13 +63,11 @@ ChatWidgetHeader::ChatWidgetHeader(ChatWidget *parent)
|
|||
|
||||
// middle
|
||||
this->middleLabel.setAlignment(Qt::AlignCenter);
|
||||
/*QObject::connect(&this->middleLabel,
|
||||
* SIGNAL(mouseDoubleClickEvent(QMouseEvent)), this,
|
||||
* SLOT(mouseDoubleClickEvent));
|
||||
* mouseDoubleClickEvent is not a signal, its an event handler
|
||||
*/
|
||||
|
||||
connect(&this->middleLabel, &SignalLabel::mouseDoubleClick, this,
|
||||
&ChatWidgetHeader::mouseDoubleClickEvent);
|
||||
// connect(&this->middleLabel, &SignalLabel::mouseDown, this,
|
||||
// &ChatWidgetHeader::mouseDoubleClickEvent);
|
||||
|
||||
// right
|
||||
this->rightLabel.setMinimumWidth(height());
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
ChatWidgetHeaderButton::ChatWidgetHeaderButton()
|
||||
ChatWidgetHeaderButton::ChatWidgetHeaderButton(int spacing)
|
||||
: QWidget()
|
||||
, hbox()
|
||||
, label()
|
||||
|
@ -19,9 +19,9 @@ ChatWidgetHeaderButton::ChatWidgetHeaderButton()
|
|||
label.setAlignment(Qt::AlignCenter);
|
||||
|
||||
hbox.setMargin(0);
|
||||
hbox.addSpacing(6);
|
||||
hbox.addSpacing(spacing);
|
||||
hbox.addWidget(&this->label);
|
||||
hbox.addSpacing(6);
|
||||
hbox.addSpacing(spacing);
|
||||
|
||||
QObject::connect(&this->label, &SignalLabel::mouseUp, this,
|
||||
&ChatWidgetHeaderButton::labelMouseUp);
|
||||
|
|
|
@ -16,7 +16,7 @@ class ChatWidgetHeaderButton : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ChatWidgetHeaderButton();
|
||||
explicit ChatWidgetHeaderButton(int spacing = 6);
|
||||
|
||||
SignalLabel &
|
||||
getLabel()
|
||||
|
|
|
@ -8,13 +8,46 @@ namespace widgets {
|
|||
|
||||
ChatWidgetInput::ChatWidgetInput()
|
||||
: hbox()
|
||||
, vbox()
|
||||
, editContainer()
|
||||
, edit()
|
||||
, textLengthLabel()
|
||||
, emotesLabel(0)
|
||||
{
|
||||
this->setLayout(&hbox);
|
||||
|
||||
this->setLayout(&this->hbox);
|
||||
this->setMaximumHeight(150);
|
||||
this->hbox.setMargin(4);
|
||||
|
||||
this->hbox.addWidget(&edit);
|
||||
this->hbox.addLayout(&this->editContainer);
|
||||
this->hbox.addLayout(&this->vbox);
|
||||
|
||||
this->editContainer.addWidget(&this->edit);
|
||||
this->editContainer.setMargin(4);
|
||||
|
||||
this->vbox.addWidget(&this->textLengthLabel);
|
||||
this->vbox.addStretch(1);
|
||||
this->vbox.addWidget(&this->emotesLabel);
|
||||
|
||||
this->textLengthLabel.setText("100");
|
||||
this->textLengthLabel.setAlignment(Qt::AlignRight);
|
||||
this->emotesLabel.getLabel().setTextFormat(Qt::RichText);
|
||||
this->emotesLabel.getLabel().setText(
|
||||
"<img src=':/images/Emoji_Color_1F60A_19.png' width='12' height='12' "
|
||||
"/>");
|
||||
|
||||
// this->emotesLabel.setMaximumSize(12, 12);
|
||||
|
||||
this->refreshTheme();
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidgetInput::refreshTheme()
|
||||
{
|
||||
QPalette palette;
|
||||
|
||||
palette.setColor(QPalette::Foreground, ColorScheme::instance().Text);
|
||||
|
||||
this->textLengthLabel.setPalette(palette);
|
||||
|
||||
edit.setStyleSheet(ColorScheme::instance().InputStyleSheet);
|
||||
}
|
||||
|
@ -28,5 +61,15 @@ ChatWidgetInput::paintEvent(QPaintEvent *)
|
|||
painter.setPen(ColorScheme::instance().ChatInputBorder);
|
||||
painter.drawRect(0, 0, width() - 1, height() - 1);
|
||||
}
|
||||
|
||||
void
|
||||
ChatWidgetInput::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
if (height() == this->maximumHeight()) {
|
||||
edit.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
} else {
|
||||
edit.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
#define CHATWIDGETINPUT_H
|
||||
|
||||
#include "resizingtextedit.h"
|
||||
#include "widgets/chatwidgetheaderbutton.h"
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPaintEvent>
|
||||
#include <QTextEdit>
|
||||
|
@ -23,9 +25,18 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *);
|
||||
|
||||
void resizeEvent(QResizeEvent *);
|
||||
|
||||
private:
|
||||
QHBoxLayout hbox;
|
||||
QVBoxLayout vbox;
|
||||
QHBoxLayout editContainer;
|
||||
ResizingTextEdit edit;
|
||||
QLabel textLengthLabel;
|
||||
ChatWidgetHeaderButton emotesLabel;
|
||||
|
||||
private slots:
|
||||
void refreshTheme();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,38 +21,59 @@ Notebook::Notebook(QWidget *parent)
|
|||
{
|
||||
connect(&this->settingsButton, SIGNAL(clicked()), this,
|
||||
SLOT(settingsButtonClicked()));
|
||||
connect(&this->userButton, SIGNAL(clicked()), this,
|
||||
SLOT(usersButtonClicked()));
|
||||
connect(&this->addButton, SIGNAL(clicked()), this,
|
||||
SLOT(addPageButtonClicked()));
|
||||
|
||||
this->settingsButton.resize(24, 24);
|
||||
this->settingsButton.icon = NotebookButton::IconSettings;
|
||||
|
||||
this->userButton.resize(24, 24);
|
||||
this->userButton.move(24, 0);
|
||||
this->userButton.icon = NotebookButton::IconUser;
|
||||
|
||||
this->addButton.resize(24, 24);
|
||||
}
|
||||
|
||||
void
|
||||
Notebook::settingsButtonClicked()
|
||||
{
|
||||
SettingsDialog *a = new SettingsDialog();
|
||||
|
||||
a->show();
|
||||
}
|
||||
|
||||
NotebookPage *
|
||||
Notebook::addPage()
|
||||
Notebook::addPage(bool select)
|
||||
{
|
||||
auto tab = new NotebookTab(this);
|
||||
auto page = new NotebookPage(this, tab);
|
||||
|
||||
if (this->pages.count() == 0) {
|
||||
select(page);
|
||||
if (select || this->pages.count() == 0) {
|
||||
this->select(page);
|
||||
}
|
||||
|
||||
this->pages.append(page);
|
||||
|
||||
performLayout();
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
void
|
||||
Notebook::removePage(NotebookPage *page)
|
||||
{
|
||||
int index = pages.indexOf(page);
|
||||
|
||||
if (pages.size() == 1) {
|
||||
select(NULL);
|
||||
} else if (index == pages.count() - 1) {
|
||||
select(pages[index - 1]);
|
||||
} else {
|
||||
select(pages[index + 1]);
|
||||
}
|
||||
|
||||
delete page->tab;
|
||||
delete page;
|
||||
|
||||
pages.removeOne(page);
|
||||
|
||||
performLayout();
|
||||
}
|
||||
|
||||
void
|
||||
Notebook::select(NotebookPage *page)
|
||||
{
|
||||
|
@ -111,5 +132,24 @@ Notebook::resizeEvent(QResizeEvent *)
|
|||
{
|
||||
performLayout();
|
||||
}
|
||||
|
||||
void
|
||||
Notebook::settingsButtonClicked()
|
||||
{
|
||||
SettingsDialog *a = new SettingsDialog();
|
||||
|
||||
a->show();
|
||||
}
|
||||
|
||||
void
|
||||
Notebook::usersButtonClicked()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Notebook::addPageButtonClicked()
|
||||
{
|
||||
addPage(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,13 @@ class Notebook : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Notebook(QWidget *parent);
|
||||
|
||||
NotebookPage *addPage();
|
||||
|
||||
enum HighlightType { none, highlighted, newMessage };
|
||||
|
||||
Notebook(QWidget *parent);
|
||||
|
||||
NotebookPage *addPage(bool select = false);
|
||||
|
||||
void removePage(NotebookPage *page);
|
||||
void select(NotebookPage *page);
|
||||
|
||||
NotebookPage *
|
||||
|
@ -39,6 +40,8 @@ protected:
|
|||
|
||||
public slots:
|
||||
void settingsButtonClicked();
|
||||
void usersButtonClicked();
|
||||
void addPageButtonClicked();
|
||||
|
||||
private:
|
||||
QList<NotebookPage *> pages;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "widgets/notebooktab.h"
|
||||
#include "colorscheme.h"
|
||||
#include "settings/settings.h"
|
||||
#include "widgets/notebook.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
@ -14,17 +15,38 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||
, selected(false)
|
||||
, mouseOver(false)
|
||||
, mouseDown(false)
|
||||
, mouseOverX(false)
|
||||
, mouseDownX(false)
|
||||
, highlightStyle(HighlightNone)
|
||||
{
|
||||
calcSize();
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
QObject::connect(&settings::Settings::getHideTabX(),
|
||||
SIGNAL(settings::BoolSetting::valueChanged(bool)), this,
|
||||
SLOT(NotebookTab::hideTabXChanged(bool)));
|
||||
|
||||
this->installEventFilter(this);
|
||||
|
||||
this->setMouseTracking(true);
|
||||
}
|
||||
|
||||
NotebookTab::~NotebookTab()
|
||||
{
|
||||
QObject::disconnect(&settings::Settings::getHideTabX(),
|
||||
SIGNAL(settings::BoolSetting::valueChanged(bool)), this,
|
||||
SLOT(NotebookTab::hideTabXChanged(bool)));
|
||||
}
|
||||
|
||||
void
|
||||
NotebookTab::calcSize()
|
||||
{
|
||||
resize(fontMetrics().width(this->text) + 8, 24);
|
||||
if (settings::Settings::getHideTabX().get()) {
|
||||
this->resize(this->fontMetrics().width(this->text) + 8, 24);
|
||||
} else {
|
||||
this->resize(this->fontMetrics().width(this->text) + 8 + 24, 24);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -54,25 +76,52 @@ NotebookTab::paintEvent(QPaintEvent *)
|
|||
}
|
||||
|
||||
painter.setPen(fg);
|
||||
painter.drawText(4, (height() + fontMetrics().height()) / 2, this->text);
|
||||
|
||||
QRect rect(0, 0,
|
||||
width() - (settings::Settings::getHideTabX().get() ? 0 : 16),
|
||||
height());
|
||||
|
||||
painter.drawText(rect, this->text, QTextOption(Qt::AlignCenter));
|
||||
|
||||
if (!settings::Settings::getHideTabX().get() && (mouseOver || selected)) {
|
||||
if (mouseOverX) {
|
||||
painter.fillRect(getXRect(), QColor(0, 0, 0, 64));
|
||||
|
||||
if (mouseDownX) {
|
||||
painter.fillRect(getXRect(), QColor(0, 0, 0, 64));
|
||||
}
|
||||
}
|
||||
|
||||
painter.drawLine(getXRect().topLeft() + QPoint(4, 4),
|
||||
getXRect().bottomRight() + QPoint(-4, -4));
|
||||
painter.drawLine(getXRect().topRight() + QPoint(-4, 4),
|
||||
getXRect().bottomLeft() + QPoint(4, -4));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NotebookTab::mousePressEvent(QMouseEvent *)
|
||||
NotebookTab::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
this->mouseDown = true;
|
||||
this->mouseDownX = this->getXRect().contains(event->pos());
|
||||
|
||||
repaint();
|
||||
this->repaint();
|
||||
|
||||
this->notebook->select(page);
|
||||
}
|
||||
|
||||
void
|
||||
NotebookTab::mouseReleaseEvent(QMouseEvent *)
|
||||
NotebookTab::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
this->mouseDown = false;
|
||||
|
||||
repaint();
|
||||
if (this->mouseDownX) {
|
||||
this->mouseDownX = false;
|
||||
|
||||
this->notebook->removePage(this->page);
|
||||
} else {
|
||||
repaint();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -86,7 +135,7 @@ NotebookTab::enterEvent(QEvent *)
|
|||
void
|
||||
NotebookTab::leaveEvent(QEvent *)
|
||||
{
|
||||
this->mouseOver = false;
|
||||
this->mouseOverX = this->mouseOver = false;
|
||||
|
||||
repaint();
|
||||
}
|
||||
|
@ -96,5 +145,17 @@ NotebookTab::dragEnterEvent(QDragEnterEvent *event)
|
|||
{
|
||||
this->notebook->select(page);
|
||||
}
|
||||
|
||||
void
|
||||
NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
bool overX = this->getXRect().contains(event->pos());
|
||||
|
||||
if (overX != this->mouseOverX) {
|
||||
this->mouseOverX = overX;
|
||||
|
||||
this->repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
};
|
||||
|
||||
NotebookTab(Notebook *notebook);
|
||||
~NotebookTab();
|
||||
|
||||
void calcSize();
|
||||
|
||||
|
@ -65,14 +66,16 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
|
||||
void mousePressEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *) Q_DECL_OVERRIDE;
|
||||
void enterEvent(QEvent *) Q_DECL_OVERRIDE;
|
||||
void leaveEvent(QEvent *) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void enterEvent(QEvent *) override;
|
||||
void leaveEvent(QEvent *) override;
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event) Q_DECL_OVERRIDE;
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
Notebook *notebook;
|
||||
|
@ -82,7 +85,24 @@ private:
|
|||
bool selected;
|
||||
bool mouseOver;
|
||||
bool mouseDown;
|
||||
bool mouseOverX;
|
||||
bool mouseDownX;
|
||||
|
||||
HighlightStyle highlightStyle;
|
||||
|
||||
QRect
|
||||
getXRect()
|
||||
{
|
||||
return QRect(this->width() - 20, 4, 16, 16);
|
||||
}
|
||||
|
||||
private slots:
|
||||
void
|
||||
hideTabXChanged(bool value)
|
||||
{
|
||||
calcSize();
|
||||
repaint();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@ protected:
|
|||
if (event->button() == Qt::LeftButton) {
|
||||
emit mouseDown();
|
||||
}
|
||||
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -44,6 +46,14 @@ protected:
|
|||
if (event->button() == Qt::LeftButton) {
|
||||
emit mouseUp();
|
||||
}
|
||||
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
virtual void
|
||||
mouseMoveEvent(QMouseEvent *event) override
|
||||
{
|
||||
event->ignore();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue