[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - 2 commits - vcl/Library_vclplug_kde5.mk vcl/unx
Katarina Behrens
Katarina.Behrens at cib.de
Wed May 2 11:27:59 UTC 2018
Rebased ref, commits from common ancestor:
commit 6e0d7ce5c38cfab790b073c9e8ea5a7e08a8921d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 2 13:25:43 2018 +0200
Native focus rectangles for checkboxes
done only half-way, they need to be made transparent
Change-Id: Id7b1ebce33ef6f8912ee5250c13e38592b383f81
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 59cdd1347fb9..849865641fb1 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -82,12 +82,14 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
{
case ControlType::Pushbutton:
case ControlType::Radiobutton:
- case ControlType::Checkbox:
case ControlType::Tooltip:
case ControlType::Progress:
case ControlType::ListNode:
return (part == ControlPart::Entire);
+ case ControlType::Checkbox:
+ return (part == ControlPart::Entire) || (part == ControlPart::Focus);
+
case ControlType::Menubar:
case ControlType::MenuPopup:
case ControlType::Editbox:
@@ -419,10 +421,18 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
}
else if (type == ControlType::Checkbox)
{
- QStyleOptionButton option;
- draw( QStyle::CE_CheckBox, &option, m_image.get(),
+ if (part == ControlPart::Entire)
+ {
+ QStyleOptionButton option;
+ draw( QStyle::CE_CheckBox, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- //m_image->save("/tmp/checkbox.png");
+ }
+ else if (part == ControlPart::Focus)
+ {
+ QStyleOptionFocusRect option;
+ draw( QStyle::PE_FrameFocusRect, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
}
else if (type == ControlType::Scrollbar)
{
commit d8cd9b1aeeaef8f4d071b88570885867ac81a54b
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 2 13:14:29 2018 +0200
KDE5SalData derives from Qt5Data
A step back since now mbNoFocusRects (= draw focus rectangle natively)
is set, but native drawing itself is not yet implemented and no focus
rectangles are drawn
Change-Id: I4dde734d057f6c594eb11162990430697277f029
diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk
index f82227722c55..0f6cffad5d3c 100644
--- a/vcl/Library_vclplug_kde5.mk
+++ b/vcl/Library_vclplug_kde5.mk
@@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_libs,vclplug_kde5,\
))
$(eval $(call gb_Library_add_exception_objects,vclplug_kde5,\
+ vcl/unx/kde5/KDE5SalData \
vcl/unx/kde5/KDE5SalDisplay \
vcl/unx/kde5/KDE5SalFrame \
vcl/unx/kde5/KDE5SalGraphics \
diff --git a/vcl/unx/kde5/KDE5SalData.cxx b/vcl/unx/kde5/KDE5SalData.cxx
new file mode 100644
index 000000000000..f995fa549768
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalData.cxx
@@ -0,0 +1,59 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <QtWidgets/QStyle>
+#include <QtWidgets/QApplication>
+
+#undef Region
+
+#include "KDE5SalData.hxx"
+
+KDE5SalData::KDE5SalData( SalInstance *pInstance )
+ : Qt5Data( pInstance )
+{
+}
+
+KDE5SalData::~KDE5SalData()
+{
+}
+
+void KDE5SalData::initNWF()
+{
+ ImplSVData *pSVData = ImplGetSVData();
+
+ // draw toolbars on separate lines
+ pSVData->maNWFData.mbDockingAreaSeparateTB = true;
+ // no borders for menu, theming does that
+ pSVData->maNWFData.mbFlatMenu = true;
+ // Qt theme engines may support a rollover menubar
+ pSVData->maNWFData.mbRolloverMenubar = true;
+
+ pSVData->maNWFData.mbNoFocusRects = true;
+
+ // Styled menus need additional space
+ QStyle *style = QApplication::style();
+ pSVData->maNWFData.mnMenuFormatBorderX =
+ style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
+ style->pixelMetric( QStyle::PM_MenuHMargin );
+ pSVData->maNWFData.mnMenuFormatBorderY =
+ style->pixelMetric( QStyle::PM_MenuPanelWidth ) +
+ style->pixelMetric( QStyle::PM_MenuVMargin );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalData.hxx b/vcl/unx/kde5/KDE5SalData.hxx
new file mode 100644
index 000000000000..a72180694d7b
--- /dev/null
+++ b/vcl/unx/kde5/KDE5SalData.hxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#pragma once
+
+#include <qt5/Qt5Data.hxx>
+
+class KDE5SalData : public Qt5Data
+{
+ public:
+ KDE5SalData( SalInstance *pInstance );
+ virtual ~KDE5SalData();
+
+ static void initNWF() ;
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/unx/kde5/KDE5SalInstance.cxx b/vcl/unx/kde5/KDE5SalInstance.cxx
index 86b42a9c5206..819889362443 100644
--- a/vcl/unx/kde5/KDE5SalInstance.cxx
+++ b/vcl/unx/kde5/KDE5SalInstance.cxx
@@ -25,8 +25,8 @@
#include <QtWidgets/QFrame>
#include <osl/process.h>
-#include <qt5/Qt5Data.hxx>
+#include "KDE5SalData.hxx"
#include "KDE5SalInstance.hxx"
#include "KDE5SalFrame.hxx"
#include "KDE5SalDisplay.hxx"
@@ -39,6 +39,8 @@ KDE5SalInstance::KDE5SalInstance(SalYieldMutex* pMutex)
ImplSVData* pSVData = ImplGetSVData();
delete pSVData->maAppData.mpToolkitName;
pSVData->maAppData.mpToolkitName = new OUString("kde5");
+
+ KDE5SalData::initNWF();
}
SalFrame* KDE5SalInstance::CreateFrame( SalFrame *pParent, SalFrameStyleFlags nState )
@@ -127,7 +129,7 @@ VCLPLUG_KDE5_PUBLIC SalInstance* create_SalInstance()
KDE5SalInstance* pInstance = new KDE5SalInstance(new SalYieldMutex());
// initialize SalData
- new Qt5Data(pInstance);
+ new KDE5SalData(pInstance);
pInstance->m_pQApplication.reset(pQApplication);
pInstance->m_pFakeArgvFreeable.reset(pFakeArgvFreeable);
More information about the Libreoffice-commits
mailing list