classic fourtf commit
This commit is contained in:
+43
-6
@@ -1,5 +1,7 @@
|
||||
#include "notebookbutton.h"
|
||||
#include "QPainter"
|
||||
#include "QPainterPath"
|
||||
#include "colorscheme.h"
|
||||
|
||||
NotebookButton::NotebookButton(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@@ -14,22 +16,25 @@ void NotebookButton::paintEvent(QPaintEvent *)
|
||||
QColor background;
|
||||
QColor foreground;
|
||||
|
||||
auto colorScheme = ColorScheme::getInstance();
|
||||
|
||||
if (mouseDown)
|
||||
{
|
||||
foreground = QColor(0, 0, 0);
|
||||
background = QColor(255, 255, 255);
|
||||
background = colorScheme.TabSelectedBackground;
|
||||
foreground = colorScheme.TabSelectedText;
|
||||
}
|
||||
else if (mouseOver)
|
||||
{
|
||||
foreground = QColor(255, 255, 255);
|
||||
background = QColor(0, 0, 0);
|
||||
background = colorScheme.TabHoverBackground;
|
||||
foreground = colorScheme.TabSelectedBackground;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreground = QColor(0, 0, 0);
|
||||
background = QColor(255, 255, 255);
|
||||
background = colorScheme.TabPanelBackground;
|
||||
foreground = colorScheme.TabSelectedBackground;
|
||||
}
|
||||
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.fillRect(this->rect(), background);
|
||||
|
||||
float h = this->height(), w = this->width();
|
||||
@@ -41,11 +46,43 @@ void NotebookButton::paintEvent(QPaintEvent *)
|
||||
}
|
||||
else if (icon == IconUser)
|
||||
{
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
|
||||
auto a = w/8;
|
||||
QPainterPath path;
|
||||
|
||||
path.arcMoveTo(a, 4 * a, 6 * a, 6 * a, 0);
|
||||
path.arcTo(a, 4 * a, 6 * a, 6 * a, 0, 180);
|
||||
|
||||
painter.fillPath(path, foreground);
|
||||
|
||||
painter.setBrush(background);
|
||||
painter.drawEllipse(2*a, 1*a, 4*a, 4*a);
|
||||
|
||||
painter.setBrush(foreground);
|
||||
painter.drawEllipse(2.5*a, 1.5*a, 3*a + 1, 3*a);
|
||||
}
|
||||
else // IconSettings
|
||||
{
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
painter.setRenderHint(QPainter::HighQualityAntialiasing);
|
||||
|
||||
auto a = w/8;
|
||||
QPainterPath path;
|
||||
|
||||
path.arcMoveTo(a, a, 6*a, 6*a, 0 - (360 / 32.0));
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
path.arcTo(a, a, 6*a, 6*a, i * (360 / 8.0) - (360 / 32.0), (360 / 32.0));
|
||||
path.arcTo(2*a, 2*a, 4*a, 4*a, i * (360 / 8.0) + (360 / 32.0), (360 / 32.0));
|
||||
}
|
||||
|
||||
painter.fillPath(path, foreground);
|
||||
|
||||
painter.setBrush(background);
|
||||
painter.drawEllipse(3*a, 3*a, 2*a, 2*a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user