Setting to control whether the time is shown in the 'current page/total' label.

Apparently I am going to make millions with this new feature :D
This commit is contained in:
Luis Ángel San Martín
2025-07-18 14:51:33 +02:00
parent 6a4f9730f5
commit 41b7873263
7 changed files with 51 additions and 22 deletions

View File

@ -18,32 +18,35 @@ PageLabelWidget::PageLabelWidget(QWidget *parent)
auto layout = new QHBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
setContentsMargins(0, 0, 0, 0);
QSize labelSize;
if (verticalRes <= 1024)
labelSize = QSize(135, 30);
else if (verticalRes <= 1200)
labelSize = QSize(170, 35);
else
labelSize = QSize(205, 45);
textLabel = new QLabel(this);
textLabel->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
if (verticalRes <= 1024)
textLabel->setStyleSheet("QLabel { color : white; font-size:12px; padding-left:8px; }");
else if (verticalRes <= 1200)
textLabel->setStyleSheet("QLabel { color : white; font-size:16px; padding-left:8px;}");
else
textLabel->setStyleSheet("QLabel { color : white; font-size:20px; padding-left:8px; }");
textLabel->setWordWrap(true); // Allow wrapping
setFixedSize(labelSize);
int contentMargin = 0;
if (verticalRes <= 1024) {
textLabel->setStyleSheet("QLabel { color : white; font-size:12px; }");
contentMargin = 12;
} else if (verticalRes <= 1200) {
textLabel->setStyleSheet("QLabel { color : white; font-size:16px; }");
contentMargin = 16;
} else {
textLabel->setStyleSheet("QLabel { color : white; font-size:20px; }");
contentMargin = 20;
}
setContentsMargins(contentMargin * 2.3, contentMargin / 2.3, contentMargin * 2.3, contentMargin / 2.3);
// Instead of fixed size, allow dynamic sizing
textLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
layout->addWidget(textLabel, 0, Qt::AlignCenter);
setLayout(layout);
adjustSize(); // Resize to fit content
if (parent != nullptr)
move(QPoint((parent->geometry().size().width() - this->width()), -this->height()));
layout->addWidget(textLabel, 0, Qt::AlignCenter);
setLayout(layout);
}
void PageLabelWidget::show()