summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei Nikiforov <darktemplar@basealt.ru>2018-12-14 12:39:44 +0300
committerJan-Marek Glogowski <glogow@fbihome.de>2018-12-18 19:40:11 +0100
commit4aa66236d69c63b648a966de2e2d7a3f12eed8de (patch)
tree4ada3e83065d0114ab824fb2f9b8dc5f59cbcfe6
parent5658da22f77a48599bb20cf6c7c37abf0388186e (diff)
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@fbihome.de> Tested-by: Jenkins
-rw-r--r--vcl/inc/qt5/Qt5Frame.hxx1
-rw-r--r--vcl/inc/qt5/Qt5Object.hxx4
-rw-r--r--vcl/qt5/Qt5Frame.cxx11
-rw-r--r--vcl/qt5/Qt5Object.cxx18
4 files changed, 25 insertions, 9 deletions
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 87637916fe79..41e2be0fc54b 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)
{