mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
parent
b1214a9ae8
commit
f351b00075
1 changed files with 19 additions and 4 deletions
|
@ -11,6 +11,21 @@
|
||||||
#include "RippleOverlay.h"
|
#include "RippleOverlay.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
|
// The ampersand is automatically set in QPushButton or QCheckbx
|
||||||
|
// by KDEPlatformTheme plugin in Qt5. [https://bugs.kde.org/show_bug.cgi?id=337491]
|
||||||
|
//
|
||||||
|
// A workaroud is to add
|
||||||
|
//
|
||||||
|
// [Development]
|
||||||
|
// AutoCheckAccelerators=false
|
||||||
|
//
|
||||||
|
// to ~/.config/kdeglobals
|
||||||
|
static QString
|
||||||
|
removeKDEAccelerators(QString text)
|
||||||
|
{
|
||||||
|
return text.remove(QChar('&'));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
FlatButton::init()
|
FlatButton::init()
|
||||||
{
|
{
|
||||||
|
@ -327,7 +342,7 @@ FlatButton::sizeHint() const
|
||||||
{
|
{
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
|
|
||||||
QSize label(fontMetrics().size(Qt::TextSingleLine, text()));
|
QSize label(fontMetrics().size(Qt::TextSingleLine, removeKDEAccelerators(text())));
|
||||||
|
|
||||||
int w = 20 + label.width();
|
int w = 20 + label.width();
|
||||||
int h = label.height();
|
int h = label.height();
|
||||||
|
@ -500,11 +515,11 @@ FlatButton::paintForeground(QPainter *painter)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (icon().isNull()) {
|
if (icon().isNull()) {
|
||||||
painter->drawText(rect(), Qt::AlignCenter, text());
|
painter->drawText(rect(), Qt::AlignCenter, removeKDEAccelerators(text()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize textSize(fontMetrics().size(Qt::TextSingleLine, text()));
|
QSize textSize(fontMetrics().size(Qt::TextSingleLine, removeKDEAccelerators(text())));
|
||||||
QSize base(size() - textSize);
|
QSize base(size() - textSize);
|
||||||
|
|
||||||
const int iw = iconSize().width() + IconPadding;
|
const int iw = iconSize().width() + IconPadding;
|
||||||
|
@ -519,7 +534,7 @@ FlatButton::paintForeground(QPainter *painter)
|
||||||
/* iconGeometry.translate(textSize.width() + IconPadding, 0); */
|
/* iconGeometry.translate(textSize.width() + IconPadding, 0); */
|
||||||
/* } */
|
/* } */
|
||||||
|
|
||||||
painter->drawText(textGeometry, Qt::AlignCenter, text());
|
painter->drawText(textGeometry, Qt::AlignCenter, removeKDEAccelerators(text()));
|
||||||
|
|
||||||
QPixmap pixmap = icon().pixmap(iconSize());
|
QPixmap pixmap = icon().pixmap(iconSize());
|
||||||
QPainter icon(&pixmap);
|
QPainter icon(&pixmap);
|
||||||
|
|
Loading…
Reference in a new issue