Fix ScreenAreaSelector on Windows
This commit is contained in:
parent
09507ec2c9
commit
b5becd4386
@ -6,12 +6,15 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <settings.hpp>
|
#include <settings.hpp>
|
||||||
|
|
||||||
|
static QString hintPattern("Set the recording region by resizing this.\n%1x%2");
|
||||||
|
|
||||||
ScreenAreaSelector::ScreenAreaSelector() {
|
ScreenAreaSelector::ScreenAreaSelector() {
|
||||||
setAttribute(Qt::WA_TranslucentBackground);
|
setAttribute(Qt::WA_TranslucentBackground);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint);
|
||||||
setStyleSheet("background-color: rgba(0, 0, 0, 0.5);");
|
setStyleSheet("background-color: rgba(0, 0, 0, 0.5);");
|
||||||
setWindowTitle("KShare: Select Area (By resizing this window)");
|
setWindowTitle("KShare: Select Area (By resizing this window)");
|
||||||
|
setAutoFillBackground(true);
|
||||||
QTimer::singleShot(0, [&] {
|
QTimer::singleShot(0, [&] {
|
||||||
QVariant val = settings::settings().value("screenareaselector/rect");
|
QVariant val = settings::settings().value("screenareaselector/rect");
|
||||||
if (val.canConvert<QRect>()) {
|
if (val.canConvert<QRect>()) {
|
||||||
@ -19,7 +22,7 @@ ScreenAreaSelector::ScreenAreaSelector() {
|
|||||||
resize(rect.size());
|
resize(rect.size());
|
||||||
move(rect.topLeft());
|
move(rect.topLeft());
|
||||||
}
|
}
|
||||||
hintLabel->setText(QString::number(width()) + "x" + QString::number(height()));
|
hintLabel->setText(hintPattern.arg(QString::number(width()), QString::number(height())));
|
||||||
show();
|
show();
|
||||||
});
|
});
|
||||||
setLayout(new QStackedLayout());
|
setLayout(new QStackedLayout());
|
||||||
@ -43,7 +46,7 @@ void ScreenAreaSelector::keyPressEvent(QKeyEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenAreaSelector::resizeEvent(QResizeEvent *) {
|
void ScreenAreaSelector::resizeEvent(QResizeEvent *) {
|
||||||
hintLabel->setText(QString::number(width()) + "x" + QString::number(height()));
|
hintLabel->setText(hintPattern.arg(QString::number(width()), QString::number(height())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenAreaSelector::closeEvent(QCloseEvent *) {
|
void ScreenAreaSelector::closeEvent(QCloseEvent *) {
|
||||||
|
Loading…
Reference in New Issue
Block a user