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" #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

View File

@ -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();