added stuff related to scaling
This commit is contained in:
@@ -115,8 +115,9 @@ void NotebookButton::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
void NotebookButton::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (!event->mimeData()->hasFormat("chatterino/split"))
|
||||
if (!event->mimeData()->hasFormat("chatterino/split")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event->acceptProposedAction();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace chatterino {
|
||||
namespace widgets {
|
||||
|
||||
NotebookTab::NotebookTab(Notebook *notebook)
|
||||
: BaseWidget(notebook)
|
||||
: RippleEffectButton(notebook)
|
||||
, positionChangedAnimation_(this, "pos")
|
||||
, notebook_(notebook)
|
||||
, menu_(this)
|
||||
@@ -68,6 +68,9 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||
void NotebookTab::themeRefreshEvent()
|
||||
{
|
||||
this->update();
|
||||
|
||||
// this->setMouseEffectColor(QColor("#999"));
|
||||
this->setMouseEffectColor(this->themeManager->tabs.regular.text);
|
||||
}
|
||||
|
||||
void NotebookTab::updateSize()
|
||||
@@ -234,9 +237,9 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
bool windowFocused = this->window() == QApplication::activeWindow();
|
||||
// || SettingsDialog::getHandle() == QApplication::activeWindow();
|
||||
|
||||
QBrush tabBackground = this->mouseOver_ ? colors.backgrounds.hover
|
||||
: (windowFocused ? colors.backgrounds.regular
|
||||
: colors.backgrounds.unfocused);
|
||||
QBrush tabBackground = /*this->mouseOver_ ? colors.backgrounds.hover
|
||||
:*/ (windowFocused ? colors.backgrounds.regular
|
||||
: colors.backgrounds.unfocused);
|
||||
|
||||
// painter.fillRect(rect(), this->mouseOver_ ? regular.backgrounds.hover
|
||||
// : (windowFocused ? regular.backgrounds.regular
|
||||
@@ -312,6 +315,8 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
// draw line at bottom
|
||||
if (!this->selected_) {
|
||||
painter.fillRect(0, this->height() - 1, this->width(), 1, app->themes->window.background);
|
||||
|
||||
this->fancyPaint(painter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,19 +378,23 @@ void NotebookTab::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void NotebookTab::enterEvent(QEvent *)
|
||||
void NotebookTab::enterEvent(QEvent *event)
|
||||
{
|
||||
this->mouseOver_ = true;
|
||||
|
||||
this->update();
|
||||
|
||||
RippleEffectButton::enterEvent(event);
|
||||
}
|
||||
|
||||
void NotebookTab::leaveEvent(QEvent *)
|
||||
void NotebookTab::leaveEvent(QEvent *event)
|
||||
{
|
||||
this->mouseOverX_ = false;
|
||||
this->mouseOver_ = false;
|
||||
|
||||
this->update();
|
||||
|
||||
RippleEffectButton::leaveEvent(event);
|
||||
}
|
||||
|
||||
void NotebookTab::dragEnterEvent(QDragEnterEvent *event)
|
||||
@@ -429,6 +438,8 @@ void NotebookTab::mouseMoveEvent(QMouseEvent *event)
|
||||
this->notebook_->rearrangePage(this->page, index);
|
||||
}
|
||||
}
|
||||
|
||||
RippleEffectButton::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
QRect NotebookTab::getXRect()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "common.hpp"
|
||||
#include "widgets/basewidget.hpp"
|
||||
#include "widgets/helper/rippleeffectbutton.hpp"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPropertyAnimation>
|
||||
@@ -17,7 +18,7 @@ namespace widgets {
|
||||
class Notebook;
|
||||
class SplitContainer;
|
||||
|
||||
class NotebookTab : public BaseWidget
|
||||
class NotebookTab : public RippleEffectButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void RippleEffectButton::fancyPaint(QPainter &painter)
|
||||
QRadialGradient gradient(QPointF(mousePos_), this->width() / 2);
|
||||
|
||||
gradient.setColorAt(0,
|
||||
QColor(c.red(), c.green(), c.blue(), int(60 * this->hoverMultiplier_)));
|
||||
QColor(c.red(), c.green(), c.blue(), int(50 * this->hoverMultiplier_)));
|
||||
gradient.setColorAt(1,
|
||||
QColor(c.red(), c.green(), c.blue(), int(40 * this->hoverMultiplier_)));
|
||||
|
||||
@@ -97,7 +97,7 @@ void RippleEffectButton::fancyPaint(QPainter &painter)
|
||||
|
||||
for (auto effect : this->clickEffects_) {
|
||||
QRadialGradient gradient(effect.position.x(), effect.position.y(),
|
||||
effect.progress * float(width()) * 2, effect.position.x(),
|
||||
effect.progress * qreal(width()) * 2, effect.position.x(),
|
||||
effect.position.y());
|
||||
|
||||
gradient.setColorAt(0,
|
||||
|
||||
Reference in New Issue
Block a user