1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(filetransfer): switch to Qt 5.13 compliant methods for OSX

This commit is contained in:
jenli669 2019-07-11 09:13:42 +02:00
parent b445031912
commit 8a0197b37f
No known key found for this signature in database
GPG Key ID: 8267F9F7C2BF7E5E

View File

@ -195,13 +195,14 @@ void FileTransferWidget::paintEvent(QPaintEvent*)
// Draw the widget background:
painter.setClipRect(QRect(0, 0, width(), height()));
painter.setBrush(QBrush(backgroundColor));
painter.drawRoundRect(geometry(), r * ratio, r);
painter.drawRoundedRect(geometry(), r * ratio, r, Qt::RelativeSize);
if (drawButtonAreaNeeded()) {
// Draw the button background:
QPainterPath buttonBackground;
buttonBackground.addRoundRect(width() - 2 * buttonFieldWidth - lineWidth * 2, 0,
buttonFieldWidth, buttonFieldWidth + lineWidth, 50, 50);
buttonBackground.addRoundedRect(width() - 2 * buttonFieldWidth - lineWidth * 2, 0,
buttonFieldWidth, buttonFieldWidth + lineWidth, 50, 50,
Qt::RelativeSize);
buttonBackground.addRect(width() - 2 * buttonFieldWidth - lineWidth * 2, 0,
buttonFieldWidth * 2, buttonFieldWidth / 2);
buttonBackground.addRect(width() - 1.5 * buttonFieldWidth - lineWidth * 2, 0,
@ -212,9 +213,9 @@ void FileTransferWidget::paintEvent(QPaintEvent*)
// Draw the left button:
QPainterPath leftButton;
leftButton.addRoundRect(QRect(width() - 2 * buttonFieldWidth - lineWidth, 0,
leftButton.addRoundedRect(QRect(width() - 2 * buttonFieldWidth - lineWidth, 0,
buttonFieldWidth, buttonFieldWidth),
50, 50);
50, 50, Qt::RelativeSize);
leftButton.addRect(QRect(width() - 2 * buttonFieldWidth - lineWidth, 0,
buttonFieldWidth / 2, buttonFieldWidth / 2));
leftButton.addRect(QRect(width() - 1.5 * buttonFieldWidth - lineWidth, 0,
@ -226,7 +227,7 @@ void FileTransferWidget::paintEvent(QPaintEvent*)
// Draw the right button:
painter.setBrush(QBrush(buttonColor));
painter.setClipRect(QRect(width() - buttonFieldWidth, 0, buttonFieldWidth, buttonFieldWidth));
painter.drawRoundRect(geometry(), r * ratio, r);
painter.drawRoundedRect(geometry(), r * ratio, r, Qt::RelativeSize);
}
}
@ -539,7 +540,7 @@ void FileTransferWidget::showPreview(const QString& filename)
ui->previewButton->show();
// Show mouseover preview, but make sure it's not larger than 50% of the screen
// width/height
const QRect desktopSize = QApplication::desktop()->screenGeometry();
const QRect desktopSize = QApplication::desktop()->geometry();
const int maxPreviewWidth{desktopSize.width() / 2};
const int maxPreviewHeight{desktopSize.height() / 2};
const QImage previewImage = [&image, maxPreviewWidth, maxPreviewHeight]() {