[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - vcl/inc vcl/qt5
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Dec 18 21:37:55 UTC 2018
vcl/inc/qt5/Qt5Frame.hxx | 1 +
vcl/inc/qt5/Qt5Object.hxx | 4 +---
vcl/qt5/Qt5Frame.cxx | 11 +++++++++--
vcl/qt5/Qt5Object.cxx | 18 ++++++++++++++----
4 files changed, 25 insertions(+), 9 deletions(-)
New commits:
commit 0cd4c92b56fb6259f8f3188fd50c315993883d2e
Author: Aleksei Nikiforov <darktemplar at basealt.ru>
AuthorDate: Fri Dec 14 12:39:44 2018 +0300
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Tue Dec 18 22:37:30 2018 +0100
Qt5: Fix fullscreen window size
Allow setting Qt5Object's position and size
Change-Id: I9f70b68ff402a3975e36baca4d81103603110d82
Reviewed-on: https://gerrit.libreoffice.org/65309
Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>
Tested-by: Jenkins
(cherry picked from commit 4aa66236d69c63b648a966de2e2d7a3f12eed8de)
Reviewed-on: https://gerrit.libreoffice.org/65368
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 4ed3d7a2060a..e88c1ead3d85 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -79,6 +79,7 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public QObject, public SalFrame
bool m_bDefaultSize;
bool m_bDefaultPos;
+ bool m_bFullScreen;
void Center();
Size CalcDefaultSize();
diff --git a/vcl/inc/qt5/Qt5Object.hxx b/vcl/inc/qt5/Qt5Object.hxx
index 99fef78a681b..294f4da4d9db 100644
--- a/vcl/inc/qt5/Qt5Object.hxx
+++ b/vcl/inc/qt5/Qt5Object.hxx
@@ -22,8 +22,6 @@
#include <salobj.hxx>
#include <vcl/sysdata.hxx>
-#include <memory>
-
#include <QtGui/QRegion>
class QWidget;
@@ -32,8 +30,8 @@ class Qt5Frame;
class Qt5Object : public SalObject
{
SystemEnvData m_aSystemData;
- std::unique_ptr<QWidget> m_pQWidget;
Qt5Frame* m_pParent;
+ QWidget* m_pQWidget;
QRegion m_pRegion;
public:
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 1a39eefbab87..781f1c6b67a4 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -70,6 +70,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
, m_bInDrag(false)
, m_bDefaultSize(true)
, m_bDefaultPos(true)
+ , m_bFullScreen(false)
{
Qt5Instance* pInst = static_cast<Qt5Instance*>(GetSalData()->m_pInstance);
pInst->insertFrame(this);
@@ -380,7 +381,11 @@ Size Qt5Frame::CalcDefaultSize()
else
qSize = QApplication::desktop()->screenGeometry(0).size();
- return bestmaxFrameSizeForScreenSize(toSize(qSize));
+ Size aSize = toSize(qSize);
+ if (!m_bFullScreen)
+ aSize = bestmaxFrameSizeForScreenSize(aSize);
+
+ return aSize;
}
void Qt5Frame::SetDefaultSize()
@@ -562,13 +567,15 @@ void Qt5Frame::ShowFullScreen(bool bFullScreen, sal_Int32 nScreen)
// only top-level windows can go fullscreen
assert(m_pTopLevel);
+ m_bFullScreen = bFullScreen;
+
// show it if it isn't shown yet
if (!isWindow())
m_pTopLevel->show();
// do that before going fullscreen
SetScreenNumber(nScreen);
- bFullScreen ? windowHandle()->showFullScreen() : windowHandle()->showNormal();
+ m_bFullScreen ? windowHandle()->showFullScreen() : windowHandle()->showNormal();
}
void Qt5Frame::StartPresentation(bool)
diff --git a/vcl/qt5/Qt5Object.cxx b/vcl/qt5/Qt5Object.cxx
index 3b68c0746d30..4f0a92da7bf7 100644
--- a/vcl/qt5/Qt5Object.cxx
+++ b/vcl/qt5/Qt5Object.cxx
@@ -25,10 +25,13 @@
Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
: m_pParent(pParent)
+ , m_pQWidget(nullptr)
{
if (!m_pParent || !pParent->GetQWidget())
return;
- m_pQWidget.reset(new QWidget(pParent->GetQWidget()));
+
+ m_pQWidget = new QWidget(pParent->GetQWidget());
+
if (bShow)
m_pQWidget->show();
@@ -43,7 +46,7 @@ Qt5Object::Qt5Object(Qt5Frame* pParent, bool bShow)
void Qt5Object::ResetClipRegion()
{
- if (m_pQWidget.get())
+ if (m_pQWidget)
m_pRegion = QRegion(m_pQWidget->geometry());
else
m_pRegion = QRegion();
@@ -58,11 +61,18 @@ void Qt5Object::UnionClipRegion(long nX, long nY, long nWidth, long nHeight)
void Qt5Object::EndSetClipRegion()
{
- if (m_pQWidget.get())
+ if (m_pQWidget)
m_pRegion = m_pRegion.intersected(m_pQWidget->geometry());
}
-void Qt5Object::SetPosSize(long /*nX*/, long /*nY*/, long /*nWidth*/, long /*nHeight*/) {}
+void Qt5Object::SetPosSize(long nX, long nY, long nWidth, long nHeight)
+{
+ if (m_pQWidget)
+ {
+ m_pQWidget->move(nX, nY);
+ m_pQWidget->setFixedSize(nWidth, nHeight);
+ }
+}
void Qt5Object::Show(bool bVisible)
{
More information about the Libreoffice-commits
mailing list