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:
parent
d7da2f98c0
commit
124769017d
|
@ -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()
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user