1
0
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:
Diadlo 2016-06-07 11:30:08 +03:00
parent bbe158c7d9
commit d7da2f98c0
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 11 additions and 5 deletions

View File

@ -3,7 +3,8 @@
#include "src/platform/capslock.h"
#endif
CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent) {
CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent)
{
inputSize = QSize(130, 23);
cleanInputStyle = parentWidget()->styleSheet();
@ -17,24 +18,28 @@ CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent) {
setToolTip(tr("CAPS-LOCK ENABLED"));
}
void CapsLockIndicator::show() {
void CapsLockIndicator::show()
{
QToolButton::show();
QString style = QString("padding: -3px %1px -3px -6px; color: white").arg(iconSize().width() - 3);
parentWidget()->setStyleSheet(style);
}
void CapsLockIndicator::hide() {
void CapsLockIndicator::hide()
{
QToolButton::hide();
parentWidget()->setStyleSheet(cleanInputStyle);
}
void CapsLockIndicator::updateIndicator() {
void CapsLockIndicator::updateIndicator()
{
bool caps = false;
// It doesn't needed for OSX, because it shows indicator by default
#if defined(QTOX_PLATFORM_EXT) && !defined(Q_OS_OSX)
caps = Platform::capsLockEnabled();
#endif
if (caps)
show();
else

View File

@ -3,7 +3,8 @@
#include <QToolButton>
class CapsLockIndicator : QToolButton {
class CapsLockIndicator : QToolButton
{
public:
CapsLockIndicator(QWidget *widget);
void updateIndicator();