mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
style(capslockindicator): Fixed code style
This commit is contained in:
parent
bbe158c7d9
commit
d7da2f98c0
|
@ -3,7 +3,8 @@
|
||||||
#include "src/platform/capslock.h"
|
#include "src/platform/capslock.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent) {
|
CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent)
|
||||||
|
{
|
||||||
inputSize = QSize(130, 23);
|
inputSize = QSize(130, 23);
|
||||||
cleanInputStyle = parentWidget()->styleSheet();
|
cleanInputStyle = parentWidget()->styleSheet();
|
||||||
|
|
||||||
|
@ -17,24 +18,28 @@ CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent) {
|
||||||
setToolTip(tr("CAPS-LOCK ENABLED"));
|
setToolTip(tr("CAPS-LOCK ENABLED"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CapsLockIndicator::show() {
|
void CapsLockIndicator::show()
|
||||||
|
{
|
||||||
QToolButton::show();
|
QToolButton::show();
|
||||||
|
|
||||||
QString style = QString("padding: -3px %1px -3px -6px; color: white").arg(iconSize().width() - 3);
|
QString style = QString("padding: -3px %1px -3px -6px; color: white").arg(iconSize().width() - 3);
|
||||||
parentWidget()->setStyleSheet(style);
|
parentWidget()->setStyleSheet(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CapsLockIndicator::hide() {
|
void CapsLockIndicator::hide()
|
||||||
|
{
|
||||||
QToolButton::hide();
|
QToolButton::hide();
|
||||||
parentWidget()->setStyleSheet(cleanInputStyle);
|
parentWidget()->setStyleSheet(cleanInputStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CapsLockIndicator::updateIndicator() {
|
void CapsLockIndicator::updateIndicator()
|
||||||
|
{
|
||||||
bool caps = false;
|
bool caps = false;
|
||||||
// It doesn't needed for OSX, because it shows indicator by default
|
// It doesn't needed for OSX, because it shows indicator by default
|
||||||
#if defined(QTOX_PLATFORM_EXT) && !defined(Q_OS_OSX)
|
#if defined(QTOX_PLATFORM_EXT) && !defined(Q_OS_OSX)
|
||||||
caps = Platform::capsLockEnabled();
|
caps = Platform::capsLockEnabled();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (caps)
|
if (caps)
|
||||||
show();
|
show();
|
||||||
else
|
else
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
|
||||||
class CapsLockIndicator : QToolButton {
|
class CapsLockIndicator : QToolButton
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
CapsLockIndicator(QWidget *widget);
|
CapsLockIndicator(QWidget *widget);
|
||||||
void updateIndicator();
|
void updateIndicator();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user