mirror of
https://github.com/vcmi/vcmi.git
synced 2026-06-19 22:57:37 +02:00
Fix buttons style
This commit is contained in:
@@ -384,6 +384,26 @@ void ImageViewer::setButtonSize(int size)
|
||||
ui->buttonClose->setMaximumSize(size, size);
|
||||
}
|
||||
|
||||
void ImageViewer::setButtonStyle(int size)
|
||||
{
|
||||
const int buttonRadius = size / 2;
|
||||
const QString buttonStyle = QStringLiteral(
|
||||
"QPushButton#buttonPrevious, QPushButton#buttonNext, QPushButton#buttonClose {"
|
||||
" border: 1px solid palette(mid);"
|
||||
" border-radius: %1px;"
|
||||
" padding: 3px;"
|
||||
" background: palette(button);"
|
||||
" font-weight: 700;"
|
||||
" }"
|
||||
"QPushButton#buttonPrevious:hover, QPushButton#buttonNext:hover, QPushButton#buttonClose:hover {"
|
||||
" background: palette(light);"
|
||||
" }").arg(buttonRadius);
|
||||
|
||||
ui->buttonPrevious->setStyleSheet(buttonStyle);
|
||||
ui->buttonNext->setStyleSheet(buttonStyle);
|
||||
ui->buttonClose->setStyleSheet(buttonStyle);
|
||||
}
|
||||
|
||||
void ImageViewer::updateResponsiveLayout(const QSize & windowSize)
|
||||
{
|
||||
#ifdef VCMI_MOBILE
|
||||
@@ -404,6 +424,7 @@ void ImageViewer::updateResponsiveLayout(const QSize & windowSize)
|
||||
ui->gridLayout->setVerticalSpacing(spacing);
|
||||
|
||||
setButtonSize(buttonSize);
|
||||
setButtonStyle(buttonSize);
|
||||
|
||||
ui->gridLayout->setColumnStretch(0, 0);
|
||||
ui->gridLayout->setColumnStretch(1, 1);
|
||||
|
||||
@@ -51,6 +51,7 @@ private:
|
||||
void applyZoomMultiplier(qreal multiplier);
|
||||
void panImage(const QPointF & delta);
|
||||
void setButtonSize(int size);
|
||||
void setButtonStyle(int size);
|
||||
|
||||
Ui::ImageViewer * ui;
|
||||
QShortcut * shortcutPrevious = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user