mirror of
https://github.com/YACReader/yacreader
synced 2025-07-21 06:24:39 -04:00
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:
@ -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()
|
||||
|
Reference in New Issue
Block a user