Make Checkbox text position relative to the View.
This commit is contained in:
parent
21d2f6a44f
commit
d5c5549c1a
|
@ -459,7 +459,7 @@ SetupChannelBox::SetupChannelBox(QWidget*, ChannelData *channel, bool existing)
|
|||
, _privacyGroup(std::make_shared<Ui::RadioenumGroup<Privacy>>(Privacy::Public))
|
||||
, _public(this, _privacyGroup, Privacy::Public, lang(channel->isMegagroup() ? lng_create_public_group_title : lng_create_public_channel_title), st::defaultBoxCheckbox)
|
||||
, _private(this, _privacyGroup, Privacy::Private, lang(channel->isMegagroup() ? lng_create_private_group_title : lng_create_private_channel_title), st::defaultBoxCheckbox)
|
||||
, _aboutPublicWidth(st::boxWideWidth - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultBoxCheckbox.textPosition.x())
|
||||
, _aboutPublicWidth(st::boxWideWidth - st::boxPadding.left() - st::boxButtonPadding.right() - st::newGroupPadding.left() - st::defaultRadio.diameter - st::defaultBoxCheckbox.textPosition.x())
|
||||
, _aboutPublic(st::defaultTextStyle, lang(channel->isMegagroup() ? lng_create_public_group_about : lng_create_public_channel_about), _defaultOptions, _aboutPublicWidth)
|
||||
, _aboutPrivate(st::defaultTextStyle, lang(channel->isMegagroup() ? lng_create_private_group_about : lng_create_private_channel_about), _defaultOptions, _aboutPublicWidth)
|
||||
, _link(this, st::setupChannelLink, base::lambda<QString()>(), channel->username, true) {
|
||||
|
@ -523,10 +523,10 @@ void SetupChannelBox::paintEvent(QPaintEvent *e) {
|
|||
p.fillRect(e->rect(), st::boxBg);
|
||||
p.setPen(st::newGroupAboutFg);
|
||||
|
||||
QRect aboutPublic(st::boxPadding.left() + st::newGroupPadding.left() + st::defaultBoxCheckbox.textPosition.x(), _public->bottomNoMargins(), _aboutPublicWidth, _aboutPublicHeight);
|
||||
QRect aboutPublic(st::boxPadding.left() + st::newGroupPadding.left() + st::defaultRadio.diameter + st::defaultBoxCheckbox.textPosition.x(), _public->bottomNoMargins(), _aboutPublicWidth, _aboutPublicHeight);
|
||||
_aboutPublic.drawLeft(p, aboutPublic.x(), aboutPublic.y(), aboutPublic.width(), width());
|
||||
|
||||
QRect aboutPrivate(st::boxPadding.left() + st::newGroupPadding.left() + st::defaultBoxCheckbox.textPosition.x(), _private->bottomNoMargins(), _aboutPublicWidth, _aboutPublicHeight);
|
||||
QRect aboutPrivate(st::boxPadding.left() + st::newGroupPadding.left() + st::defaultRadio.diameter + st::defaultBoxCheckbox.textPosition.x(), _private->bottomNoMargins(), _aboutPublicWidth, _aboutPublicHeight);
|
||||
_aboutPrivate.drawLeft(p, aboutPrivate.x(), aboutPrivate.y(), aboutPrivate.width(), width());
|
||||
|
||||
if (!_channel->isMegagroup() || !_link->isHidden()) {
|
||||
|
|
|
@ -55,7 +55,7 @@ attentionBoxButton: RoundButton(defaultBoxButton) {
|
|||
|
||||
defaultBoxCheckbox: Checkbox(defaultCheckbox) {
|
||||
width: -46px;
|
||||
textPosition: point(34px, 1px);
|
||||
textPosition: point(12px, 1px);
|
||||
style: boxTextStyle;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,9 +145,9 @@ void ConnectionBox::updateControlsPosition() {
|
|||
}
|
||||
|
||||
if (inputy) {
|
||||
_hostInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), inputy);
|
||||
_hostInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), inputy);
|
||||
_portInput->moveToRight(st::boxPadding.right(), inputy);
|
||||
_userInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), _hostInput->y() + _hostInput->height() + st::boxOptionInputSkip);
|
||||
_userInput->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x() - st::defaultInputField.textMargins.left(), _hostInput->y() + _hostInput->height() + st::boxOptionInputSkip);
|
||||
_passwordInput->moveToRight(st::boxPadding.right(), _userInput->y());
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ void DownloadPathBox::resizeEvent(QResizeEvent *e) {
|
|||
_default->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), st::boxOptionListPadding.top() + _default->getMargins().top());
|
||||
_temp->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _default->bottomNoMargins() + st::boxOptionListSkip);
|
||||
_dir->moveToLeft(st::boxPadding.left() + st::boxOptionListPadding.left(), _temp->bottomNoMargins() + st::boxOptionListSkip);
|
||||
auto inputx = st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultBoxCheckbox.textPosition.x();
|
||||
auto inputx = st::boxPadding.left() + st::boxOptionListPadding.left() + st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x();
|
||||
auto inputy = _dir->bottomNoMargins() + st::downloadPathSkip;
|
||||
|
||||
_pathLink->moveToLeft(inputx, inputy);
|
||||
|
@ -132,6 +132,6 @@ void DownloadPathBox::save() {
|
|||
}
|
||||
|
||||
void DownloadPathBox::setPathText(const QString &text) {
|
||||
auto availw = st::boxWideWidth - st::boxPadding.left() - st::defaultBoxCheckbox.textPosition.x() - st::boxPadding.right();
|
||||
auto availw = st::boxWideWidth - st::boxPadding.left() - st::defaultCheck.diameter - st::defaultBoxCheckbox.textPosition.x() - st::boxPadding.right();
|
||||
_pathLink->setText(st::boxTextFont->elided(text, availw));
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ void ChatSettingsWidget::createControls() {
|
|||
style::margins slidedPadding(0, marginSub.bottom() / 2, 0, marginSub.bottom() - (marginSub.bottom() / 2));
|
||||
|
||||
addChildRow(_replaceEmoji, marginSub, lang(lng_settings_replace_emojis), [this](bool) { onReplaceEmoji(); }, cReplaceEmojis());
|
||||
style::margins marginList(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||
style::margins marginList(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||
addChildRow(_viewList, marginList, slidedPadding, lang(lng_settings_view_emojis), SLOT(onViewList()), st::defaultLinkButton);
|
||||
if (!cReplaceEmojis()) {
|
||||
_viewList->hideFast();
|
||||
|
@ -169,7 +169,7 @@ void ChatSettingsWidget::createControls() {
|
|||
addChildRow(_dontAskDownloadPath, pathMargin, lang(lng_download_path_dont_ask), [this](bool) { onDontAskDownloadPath(); }, !Global::AskDownloadPath());
|
||||
|
||||
#ifndef OS_WIN_STORE
|
||||
style::margins marginPath(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||
style::margins marginPath(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||
addChildRow(_downloadPath, marginPath, slidedPadding);
|
||||
if (Global::AskDownloadPath()) {
|
||||
_downloadPath->hideFast();
|
||||
|
|
|
@ -176,7 +176,7 @@ void GeneralWidget::refreshControls() {
|
|||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
addChildRow(_updateAutomatically, marginSub, lang(lng_settings_update_automatically), [this](bool) { onUpdateAutomatically(); }, cAutoUpdate());
|
||||
style::margins marginLink(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||
style::margins marginLink(st::defaultCheck.diameter + st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||
addChildRow(_updateRow, marginLink, slidedPadding);
|
||||
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
||||
if (!cAutoUpdate()) {
|
||||
|
|
|
@ -223,7 +223,7 @@ void Checkbox::finishAnimations() {
|
|||
}
|
||||
|
||||
int Checkbox::naturalWidth() const {
|
||||
return _st.textPosition.x() + _text.maxWidth();
|
||||
return _checkRect.width() + _st.textPosition.x() + _text.maxWidth();
|
||||
}
|
||||
|
||||
void Checkbox::paintEvent(QPaintEvent *e) {
|
||||
|
@ -240,10 +240,10 @@ void Checkbox::paintEvent(QPaintEvent *e) {
|
|||
}
|
||||
if (realCheckRect.contains(e->rect())) return;
|
||||
|
||||
auto textWidth = qMax(width() - (_st.textPosition.x() + (_st.textPosition.x() - _check->getSize().width())), 1);
|
||||
auto textWidth = qMax(width() - (_checkRect.width() + _st.textPosition.x() + _st.textPosition.x()), 1);
|
||||
|
||||
p.setPen(_st.textFg);
|
||||
_text.drawLeftElided(p, _st.margin.left() + _st.textPosition.x(), _st.margin.top() + _st.textPosition.y(), textWidth, width());
|
||||
_text.drawLeftElided(p, _st.margin.left() + _checkRect.width() + _st.textPosition.x(), _st.margin.top() + _st.textPosition.y(), textWidth, width());
|
||||
}
|
||||
|
||||
void Checkbox::onStateChanged(State was, StateChangeSource source) {
|
||||
|
|
|
@ -707,7 +707,7 @@ defaultCheckbox: Checkbox {
|
|||
height: 22px;
|
||||
margin: margins(8px, 8px, 8px, 8px);
|
||||
|
||||
textPosition: point(32px, 2px);
|
||||
textPosition: point(10px, 2px);
|
||||
|
||||
style: defaultTextStyle;
|
||||
|
||||
|
|
Loading…
Reference in New Issue