Fixed size previews
This commit is contained in:
parent
c621c0db3e
commit
e573f3d014
@ -16,19 +16,23 @@ RecordingPreview::RecordingPreview(QRect area, QWidget *parent) : QWidget(parent
|
|||||||
QTimer::singleShot(0, [&] {
|
QTimer::singleShot(0, [&] {
|
||||||
adjustSize();
|
adjustSize();
|
||||||
move(0, 0);
|
move(0, 0);
|
||||||
if (geometry().intersects(recordingArea)) // Formatter please
|
if (rect().intersects(recordingArea)) // Formatter please
|
||||||
move(QApplication::primaryScreen()->size().width() - rect().width(), 0);
|
move(QApplication::primaryScreen()->size().width() - rect().width(), 0);
|
||||||
if (geometry().intersects(recordingArea)) // Formatter please
|
if (rect().intersects(recordingArea)) // Formatter please
|
||||||
move(0, QApplication::primaryScreen()->size().height() - rect().height());
|
move(0, QApplication::primaryScreen()->size().height() - rect().height());
|
||||||
if (geometry().intersects(recordingArea))
|
if (rect().intersects(recordingArea))
|
||||||
move(QApplication::primaryScreen()->size().width() - rect().width(),
|
move(QApplication::primaryScreen()->size().width() - rect().width(),
|
||||||
QApplication::primaryScreen()->size().height() - rect().height());
|
QApplication::primaryScreen()->size().height() - rect().height());
|
||||||
if (!geometry().intersects(recordingArea)) show();
|
if (!rect().intersects(recordingArea)) show();
|
||||||
});
|
});
|
||||||
label = new QLabel;
|
label = new QLabel;
|
||||||
hintLabel = new QLabel;
|
hintLabel = new QLabel;
|
||||||
auto ly = new QGridLayout(this);
|
auto ly = new QGridLayout(this);
|
||||||
setLayout(ly);
|
setLayout(ly);
|
||||||
|
auto size = recordingArea.size().scaled(QSize(300, 300), Qt::KeepAspectRatio);
|
||||||
|
label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||||
|
label->setMaximumSize(size);
|
||||||
|
label->resize(size);
|
||||||
layout()->addWidget(hintLabel);
|
layout()->addWidget(hintLabel);
|
||||||
layout()->addWidget(label);
|
layout()->addWidget(label);
|
||||||
hintLabel->setText(QString("Time: 00:00\nFrame: 0\nStop key: ") + hotkeying::sequence("recordingstop"));
|
hintLabel->setText(QString("Time: 00:00\nFrame: 0\nStop key: ") + hotkeying::sequence("recordingstop"));
|
||||||
@ -41,7 +45,7 @@ RecordingPreview::~RecordingPreview() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPreview::setPixmap(QPixmap map) {
|
void RecordingPreview::setPixmap(QPixmap map) {
|
||||||
label->setPixmap(map);
|
label->setPixmap(map.scaled(label->maximumSize()));
|
||||||
}
|
}
|
||||||
void RecordingPreview::setTime(QString time, int frame) {
|
void RecordingPreview::setTime(QString time, int frame) {
|
||||||
if (isVisible())
|
if (isVisible())
|
||||||
|
Loading…
Reference in New Issue
Block a user