diff options
-rw-r--r-- | Swift/QtUI/ScreenSharing/QtRemoteScreenWindow.cpp | 10 | ||||
-rw-r--r-- | Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.cpp | 13 | ||||
-rw-r--r-- | Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.h | 4 |
3 files changed, 14 insertions, 13 deletions
diff --git a/Swift/QtUI/ScreenSharing/QtRemoteScreenWindow.cpp b/Swift/QtUI/ScreenSharing/QtRemoteScreenWindow.cpp index a1f1a88..090ab6b 100644 --- a/Swift/QtUI/ScreenSharing/QtRemoteScreenWindow.cpp +++ b/Swift/QtUI/ScreenSharing/QtRemoteScreenWindow.cpp @@ -8,6 +8,7 @@ #include "RemoteScreenViewerWidget.h" #include <QToolBar> +#include <QFrame> #include <QVBoxLayout> #include <Swiften/ScreenSharing/IncomingScreenSharing.h> @@ -17,9 +18,14 @@ namespace Swift { QtRemoteScreenWindow::QtRemoteScreenWindow(boost::shared_ptr<IncomingScreenSharing> incScreenSharing, QWidget *parent) : QMainWindow(parent), RemoteScreenWindow(incScreenSharing), viewer(new RemoteScreenViewerWidget(iss)) { - QVBoxLayout* centralLayout = new QVBoxLayout; - centralLayout->addWidget(viewer); + QVBoxLayout* frameLayout = new QVBoxLayout; + frameLayout->addWidget(viewer); + QFrame* frame = new QFrame; + frame->setLayout(frameLayout); + frame->setContentsMargins(QMargins(0, 0, 0, 0)); + QVBoxLayout* centralLayout = new QVBoxLayout; + centralLayout->addWidget(frame); QWidget* central = new QWidget(this); central->setLayout(centralLayout); diff --git a/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.cpp b/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.cpp index 7bb3f26..899f335 100644 --- a/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.cpp +++ b/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.cpp @@ -18,7 +18,7 @@ namespace Swift { RemoteScreenViewerWidget::RemoteScreenViewerWidget(boost::shared_ptr<IncomingScreenSharing> incScreenSharing, QWidget *parent) : - QFrame(parent), iss(incScreenSharing) + QWidget(parent), iss(incScreenSharing) { iss->onNewImageReceived.connect(boost::bind(&RemoteScreenViewerWidget::handleNewImageReceived, this, _1)); } @@ -30,7 +30,6 @@ RemoteScreenViewerWidget::~RemoteScreenViewerWidget() void RemoteScreenViewerWidget::paintEvent(QPaintEvent* event) { - QFrame::paintEvent(event); if (!pixmap.isNull()) { QPainter painter(this); painter.translate(geometry().center()); @@ -41,19 +40,15 @@ void RemoteScreenViewerWidget::paintEvent(QPaintEvent* event) void RemoteScreenViewerWidget::resizeEvent(QResizeEvent *event) { if (!pixmap.isNull()) { - int frameWidth2 = frameWidth() * 2; - QSize borders(frameWidth2, frameWidth2); - pixmap = pixmap.scaled(event->size() - borders, Qt::KeepAspectRatio); + pixmap = pixmap.scaled(event->size(), Qt::KeepAspectRatio); } - QFrame::resizeEvent(event); + QWidget::resizeEvent(event); } void RemoteScreenViewerWidget::handleNewImageReceived(const Image& image) { QImage qImg(image.data.data(), image.width, image.height, QImage::Format_RGB888); - int frameWidth2 = frameWidth() * 2; - QSize borders(frameWidth2, frameWidth2); - pixmap = QPixmap::fromImage(qImg).scaled(size() - borders, Qt::KeepAspectRatio); + pixmap = QPixmap::fromImage(qImg).scaled(size(), Qt::KeepAspectRatio); update(); } diff --git a/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.h b/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.h index c074e9f..b0a377e 100644 --- a/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.h +++ b/Swift/QtUI/ScreenSharing/RemoteScreenViewerWidget.h @@ -6,7 +6,7 @@ #pragma once -#include <QFrame> +#include <QWidget> #include <boost/shared_ptr.hpp> @@ -14,7 +14,7 @@ namespace Swift { class IncomingScreenSharing; class Image; - class RemoteScreenViewerWidget : public QFrame { + class RemoteScreenViewerWidget : public QWidget { Q_OBJECT public: RemoteScreenViewerWidget(boost::shared_ptr<IncomingScreenSharing> incScreenSharing, QWidget *parent = 0); |