1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(capslockindicator): Fix position of capslock indicator

This commit is contained in:
Diadlo 2016-06-12 01:15:14 +03:00
parent d7da2f98c0
commit 124769017d
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
3 changed files with 14 additions and 4 deletions

View File

@ -5,17 +5,24 @@
CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent) CapsLockIndicator::CapsLockIndicator(QWidget *parent) : QToolButton(parent)
{ {
inputSize = QSize(130, 23);
cleanInputStyle = parentWidget()->styleSheet(); cleanInputStyle = parentWidget()->styleSheet();
QIcon icon = QIcon(":img/caps_lock.svg"); QIcon icon = QIcon(":img/caps_lock.svg");
setIcon(icon); setIcon(icon);
QSize iconSize(inputSize.height(), inputSize.height());
setIconSize(iconSize);
setCursor(Qt::ArrowCursor); setCursor(Qt::ArrowCursor);
move(inputSize.width() - inputSize.height(), 0);
setStyleSheet("border: none; padding: 0; color: white"); setStyleSheet("border: none; padding: 0; color: white");
setToolTip(tr("CAPS-LOCK ENABLED")); setToolTip(tr("CAPS-LOCK ENABLED"));
updateSize();
}
void CapsLockIndicator::updateSize()
{
inputSize = parentWidget()->size();
move(inputSize.width() - inputSize.height(), 0);
int side = inputSize.height() - 5;
QSize iconSize(side, side);
setIconSize(iconSize);
} }
void CapsLockIndicator::show() void CapsLockIndicator::show()

View File

@ -8,6 +8,7 @@ class CapsLockIndicator : QToolButton
public: public:
CapsLockIndicator(QWidget *widget); CapsLockIndicator(QWidget *widget);
void updateIndicator(); void updateIndicator();
void updateSize();
private: private:
void show(); void show();

View File

@ -136,6 +136,8 @@ bool LoginScreen::event(QEvent* event)
void LoginScreen::onNewProfilePageClicked() void LoginScreen::onNewProfilePageClicked()
{ {
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
capsIndicator->updateSize();
confimCapsIndicator->updateSize();
} }
void LoginScreen::onLoginPageClicked() void LoginScreen::onLoginPageClicked()