@@ -12,7 +12,7 @@ SettingsDialogTab::SettingsDialogTab(SettingsDialog *_dialog, QString _labelText
|
||||
: dialog(_dialog)
|
||||
{
|
||||
this->ui.labelText = _labelText;
|
||||
this->ui.image.load(imageFileName);
|
||||
this->ui.icon.addFile(imageFileName);
|
||||
|
||||
this->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
|
||||
@@ -50,11 +50,13 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
|
||||
|
||||
this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this);
|
||||
|
||||
int a = (this->height() - this->ui.image.width()) / 2;
|
||||
int a = (this->height() - 20) / 2;
|
||||
QPixmap pixmap = this->ui.icon.pixmap(QSize(20,20));
|
||||
|
||||
painter.drawImage(a, a, this->ui.image);
|
||||
|
||||
a = a + a + this->ui.image.width();
|
||||
painter.drawPixmap(0, a, pixmap);
|
||||
|
||||
a = a + a + 20;
|
||||
|
||||
painter.drawText(QRect(a, 0, width() - a, height()), this->ui.labelText,
|
||||
QTextOption(Qt::AlignLeft | Qt::AlignVCenter));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <QPaintEvent>
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
|
||||
namespace chatterino {
|
||||
namespace widgets {
|
||||
@@ -29,7 +30,7 @@ private:
|
||||
struct {
|
||||
QWidget *widget;
|
||||
QString labelText;
|
||||
QImage image;
|
||||
QIcon icon;
|
||||
} ui;
|
||||
|
||||
// Parent settings dialog
|
||||
|
||||
Reference in New Issue
Block a user