[Libreoffice-commits] core.git: Branch 'feature/qt5+kde5' - 3179 commits - accessibility/inc accessibility/source android/Bootstrap android/README android/source avmedia/inc avmedia/source basctl/inc basctl/sdi basctl/source basctl/uiconfig basegfx/Library_basegfx.mk basegfx/source basegfx/test basic/inc basic/qa basic/source bean/pom.officebean.xml bin/check-elf-dynamic-objects bin/find-unneeded-includes bin/gbuild-to-ide bin/gla11y bin/lint-ui.py bin/sanitize-blacklist.txt bridges/Library_cpp_uno.mk bridges/source canvas/source canvas/workben chart2/CppunitTest_chart2_dump.mk chart2/CppunitTest_chart2_export.mk chart2/CppunitTest_chart2_import.mk chart2/CppunitTest_chart2_pivot_chart_test.mk chart2/CppunitTest_chart2_trendcalculators.mk chart2/CppunitTest_chart2_xshape.mk chart2/inc chart2/IwyuFilter_chart2.yaml chart2/qa chart2/source chart2/uiconfig cli_ure/source comphelper/source compilerplugins/clang config_host/config_extensions.h.in config_host/config_extension_update.h.in config_host/co nfig_features.h.in config_host/config_firebird.h.in config_host/config_gpgme.h.in config_host/config_java.h.in config_host/config_libnumbertext.h.in config_host.mk.in configmgr/source configure.ac connectivity/Library_dbtools.mk connectivity/registry connectivity/source cppcanvas/CppunitTest_cppcanvas_emfplus.mk cppcanvas/Library_cppcanvas.mk cppcanvas/qa cppcanvas/source cppuhelper/source cppu/source cui/inc cui/Library_cui.mk cui/qa cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/CppunitTest_dbaccess_embeddeddb_performancetest.mk dbaccess/CppunitTest_dbaccess_hsqlbinary_import.mk dbaccess/CppunitTest_dbaccess_hsqldb_test.mk dbaccess/CppunitTest_dbaccess_hsqlschema_import.mk dbaccess/CppunitTest_dbaccess_RowSetClones.mk dbaccess/inc dbaccess/Library_dbahsql.mk dbaccess/Library_dba.mk dbaccess/Library_dbu.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/README.vars dbaccess/source dbaccess/uiconfig dbaccess/UIConfig_dbaccess.mk desktop/CppunitTest_desktop_lib.mk desktop/inc desktop/Library_crashreport.mk desktop/Library_sofficeapp.mk desktop/Package_branding.mk desktop/qa desktop/source desktop/uiconfig desktop/unx dictionaries distro-configs/Jenkins distro-configs/LibreOfficeAndroidAarch64.conf distro-configs/LibreOfficeAndroid.conf distro-configs/LibreOfficeAndroidX86.conf distro-configs/LibreOfficeFlatpak.conf distro-configs/LibreOfficeiOS.conf distro-configs/LibreOfficeLinux.conf distro-configs/LibreOfficeVanillaMacAppStore.conf download.lst drawinglayer/Library_drawinglayer.mk drawinglayer/source dtrans/source editeng/inc editeng/qa editeng/source embeddedobj/source embedserv/source emfio/Library_emfio.mk emfio/qa emfio/source eventattacher/source extensions/inc extensions/Library_ldapbe2.mk extensions/Library_oleautobridge.mk extensions/Library_WinUserInfoBe.mk extensions/Module_extensions.mk extensions/qa extensions/source extensions/test extensions/uiconfig external/boost external/curl external/epoxy external/firebird external/hunspell external /icu external/libassuan external/libcmis external/libepubgen external/libetonyek external/libgpg-error external/liblangtag external/libmspub external/libmwaw external/libnumbertext external/libstaroffice external/libtommath external/libwps external/lxml external/mdds external/Module_external.mk external/more_fonts external/msc-externals external/pdfium external/python3 external/xmlsec extras/CustomTarget_autocorr.mk extras/CustomTarget_opensymbol.mk extras/Module_extras.mk extras/Package_autocorr.mk extras/Package_fonts.mk extras/source filter/Configuration_filter.mk filter/CppunitTest_filter_pict_test.mk filter/Executable_svg2odf.mk filter/inc filter/Library_flash.mk filter/Library_gie.mk filter/Library_svgfilter.mk filter/Module_filter.mk filter/qa filter/source filter/uiconfig forms/qa forms/source formula/source formula/uiconfig fpicker/source fpicker/test fpicker/uiconfig framework/dtd framework/inc framework/Library_fwl.mk framework/source framework/util g helpcompiler/inc hel pcompiler/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/README i18nlangtag/source i18npool/inc i18npool/Library_i18npool.mk i18npool/Library_localedata_others.mk i18npool/qa i18npool/source i18nutil/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/crystal icon-themes/elementary icon-themes/elementary_svg icon-themes/galaxy icon-themes/hicontrast icon-themes/industrial icon-themes/karasa_jaga icon-themes/oxygen icon-themes/README icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_svg icon-themes/tango icon-themes/tango_svg icon-themes/tango_testing idlc/inc idlc/source idl/inc idl/source include/avmedia include/basegfx include/basic include/canvas include/comphelper include/connectivity include/cppuhelper include/drawinglayer include/editeng include/filter include/formula include/i18nlangtag include/LibreOfficeKit include/o3tl include/oox include/osl include/package include/registry include/rtl include/sal include/salhelper include/sfx2 include/svl include/svtools include/svx include/test include/toolkit include/tools include/ucbhelper include/unotools include/vbahelper include/vcl include/xmloff instsetoo_native/CustomTarget_setup.mk instsetoo_native/inc_common instsetoo_native/inc_ooohelppack instsetoo_native/inc_openoffice instsetoo_native/inc_sdkoo instsetoo_native/util ios/LibreOfficeLight io/source javaunohelper/pom.juh.xml jurt/pom.jurt.xml jvmaccess/Library_jvmaccess.mk jvmaccess/source jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/Module_libreofficekit.mk libreofficekit/qa libreofficekit/source libreofficekit/UIConfig_libreofficekit.mk lingucomponent/Library_numbertext.mk lingucomponent/Module_lingucomponent.mk lingucomponent/source linguistic/source lotuswordpro/inc lotuswordpro/qa lotuswordpro/source Makefile.fetch Makefile.in mysqlc/Extension_mysql-connector-ooo.mk mysqlc/Library_mysqlc.mk mysqlc/source o3tl/CompilerTes t_o3tl_temporary.mk o3tl/Module_o3tl.mk o3tl/qa odk/build-examples_common.mk odk/CustomTarget_build-examples_java.mk odk/CustomTarget_build-examples.mk odk/CustomTarget_html.mk odk/examples odk/Module_odk.mk odk/README offapi/com offapi/UnoApi_offapi.mk offapi/util officecfg/Configuration_officecfg.mk officecfg/files.mk officecfg/Package_misc.mk officecfg/registry officecfg/util onlineupdate/source oovbaapi/ooo oox/source osx/soffice.xcodeproj package/inc package/qa package/source postprocess/CustomTarget_images.mk postprocess/CustomTarget_registry.mk postprocess/qa postprocess/Rdb_services.mk postprocess/signing pyuno/qa pyuno/source qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/.project qadevOOo/README qadevOOo/runner qadevOOo/tests readlicense_oo/docs readlicense_oo/license README.md registry/source reportbuilder/Module_reportbuilder.mk reportbuilder/Package_reportbuilder-templates.mk reportbuilder/Package_templates.mk reportdesign/inc reportdesign/source reportdesign/uiconf ig RepositoryExternal.mk Repository.mk ridljar/pom.ridl.xml ridljar/pom.unoloader.xml sal/Library_sal.mk sal/osl sal/qa sal/rtl sax/source scaddins/idl scaddins/source sc/common_unoapi_tests.mk sccomp/source sc/CppunitTest_sc_addin_functions_test.mk sc/CppunitTest_sc_anchor_test.mk sc/CppunitTest_sc_annotationobj.mk sc/CppunitTest_sc_annotationshapeobj.mk sc/CppunitTest_sc_annotationsobj.mk sc/CppunitTest_sc_arealinkobj.mk sc/CppunitTest_sc_arealinksobj.mk sc/CppunitTest_sc_array_functions_test.mk sc/CppunitTest_sc_autoformatobj.mk sc/CppunitTest_sc_bugfix_test.mk sc/CppunitTest_sc_cache_test.mk sc/CppunitTest_sc_cellcursorobj.mk sc/CppunitTest_sc_cellobj.mk sc/CppunitTest_sc_cellrangeobj.mk sc/CppunitTest_sc_cellrangesobj.mk sc/CppunitTest_sc_chart2dataprovider.mk sc/CppunitTest_sc_chart_regression_test.mk sc/CppunitTest_sc_check_data_pilot_field.mk sc/CppunitTest_sc_check_data_pilot_table.mk sc/CppunitTest_sc_check_xcell_ranges_query.mk sc/CppunitTest_sc_cond_format_merge.mk sc/Cp punitTest_sc_consolidationdescriptorobj.mk sc/CppunitTest_sc_copypaste.mk sc/CppunitTest_sc_database_functions_test.mk sc/CppunitTest_sc_databaserangeobj.mk sc/CppunitTest_sc_databaserangesobj.mk sc/CppunitTest_sc_datapilotfieldobj.mk sc/CppunitTest_sc_datapilotitemobj.mk sc/CppunitTest_sc_datapilottableobj.mk sc/CppunitTest_sc_datapilottablesobj.mk sc/CppunitTest_sc_dataprovider.mk sc/CppunitTest_sc_datatransformation.mk sc/CppunitTest_sc_datetime_functions_test.mk sc/CppunitTest_sc_ddelinkobj.mk sc/CppunitTest_sc_documentconfigurationobj.mk sc/CppunitTest_sc_editfieldobj_cell.mk sc/CppunitTest_sc_editfieldobj_header.mk sc/CppunitTest_sc_filterdescriptorbaseobj.mk sc/CppunitTest_sc_filters_test.mk sc/CppunitTest_sc_financial_functions_test.mk sc/CppunitTest_sc_functiondescriptionobj.mk sc/CppunitTest_sc_functionlistobj.mk sc/CppunitTest_sc_functions_test_old.mk sc/CppunitTest_sc_headerfootercontentobj.mk sc/CppunitTest_sc_html_export_test.mk sc/CppunitTest_sc_importdescriptorbaseob j.mk sc/CppunitTest_sc_information_functions_test.mk sc/CppunitTest_sc_labelrangeobj.mk sc/CppunitTest_sc_labelrangesobj.mk sc/CppunitTest_sc_logical_functions_test.mk sc/CppunitTest_sc_macros_test.mk sc/CppunitTest_sc_mark_test.mk sc/CppunitTest_sc_mathematical_functions_test.mk sc/CppunitTest_sc_modelobj.mk sc/CppunitTest_sc_namedrangeobj.mk sc/CppunitTest_sc_namedrangesobj.mk sc/CppunitTest_sc_new_cond_format_api.mk sc/CppunitTest_sc_opencl_test.mk sc/CppunitTest_sc_outlineobj.mk sc/CppunitTest_sc_parallelism.mk sc/CppunitTest_sc_pivottable_filters_test.mk sc/CppunitTest_sc_rangelst_test.mk sc/CppunitTest_sc_range_test.mk sc/CppunitTest_sc_recentfunctionsobj.mk sc/CppunitTest_sc_recordchanges.mk sc/CppunitTest_sc_scenariosobj.mk sc/CppunitTest_sc_shapeobj.mk sc/CppunitTest_sc_sheetlinkobj.mk sc/CppunitTest_sc_sortdescriptorbaseobj.mk sc/CppunitTest_sc_spreadsheet_functions_test.mk sc/CppunitTest_sc_spreadsheetsettings.mk sc/CppunitTest_sc_spreadsheetsettingsobj.mk sc/CppunitTest_ sc_statistical_functions_test.mk sc/CppunitTest_sc_styleloaderobj.mk sc/CppunitTest_sc_subsequent_export_test.mk sc/CppunitTest_sc_subsequent_filters_test.mk sc/CppunitTest_sc_subtotaldescriptorbaseobj.mk sc/CppunitTest_sc_subtotalfieldobj.mk sc/CppunitTest_sc_tableconditionalentryobj.mk sc/CppunitTest_sc_tableconditionalformatobj.mk sc/CppunitTest_sc_tablesheetobj.mk sc/CppunitTest_sc_tablesheetsobj.mk sc/CppunitTest_sc_tablevalidationobj.mk sc/CppunitTest_sc_tabviewobj.mk sc/CppunitTest_sc_text_functions_test.mk sc/CppunitTest_sc_tiledrendering.mk sc/CppunitTest_sc_ucalc.mk sc/CppunitTest_sc_viewpaneobj.mk sc/inc sc/IwyuFilter_sc.yaml sc/Library_sc.mk sc/Module_sc.mk scp2/InstallModule_ooo.mk scp2/InstallModule_windows.mk scp2/macros scp2/source sc/qa scripting/astyle.options scripting/examples scripting/java scripting/Package_scriptproviderforpython.mk scripting/Package_ScriptsPython.mk scripting/README scripting/source sc/sdi sc/source sc/uiconfig sc/UIConfig_scalc.mk sc/UITest_ autofilter.mk sc/UITest_calc_tests.mk sd/CppunitTest_sd_activex_controls_tests.mk sd/CppunitTest_sd_filters_test.mk sd/CppunitTest_sd_html_export_tests.mk sd/CppunitTest_sd_import_tests.mk sd/CppunitTest_sd_import_tests_smartart.mk sd/CppunitTest_sd_misc_tests.mk sdext/CppunitTest_sdext_pdfimport.mk sdext/Executable_pdf2xml.mk sdext/Executable_pdfunzip.mk sdext/Library_pdfimport.mk sdext/Library_PresenterScreen.mk sdext/source sd/inc sd/IwyuFilter_sd.yaml sd/Library_sdui.mk sd/qa sd/sdi sd/source sd/uiconfig sd/UIConfig_sdraw.mk sd/workben setup_native/Library_inst_msu_msi.mk setup_native/Library_instooofiltmsi.mk setup_native/Module_setup_native.mk setup_native/scripts setup_native/source sfx2/classification sfx2/CppunitTest_sfx2_misc.mk sfx2/inc sfx2/Library_qstart_gtk.mk sfx2/Library_sfx.mk sfx2/Module_sfx2.mk sfx2/qa sfx2/sdi sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk shell/inc shell/source slideshow/Library_slideshow.mk slideshow/opengl slideshow/source slideshow/test smoke test/data solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild solenv/gdb solenv/inc solenv/sanitizers soltools/mkdepend sot/CppunitTest_sot_test_sot.mk sot/inc sot/qa sot/source starmath/inc starmath/source starmath/uiconfig stoc/source stoc/test store/source svgio/inc svgio/qa svgio/source svl/CppunitTest_svl_qa_cppunit.mk svl/qa svl/source svtools/inc svtools/Library_svt.mk svtools/qa svtools/source svtools/uiconfig svtools/UIConfig_svt.mk svtools/util svx/CppunitTest_svx_unit.mk svx/inc svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk svx/util sw/CppunitTest_sw_accessible_relation_set.mk sw/CppunitTest_sw_apitests.mk sw/CppunitTest_sw_filters_test.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layout_test.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_mailmerge.mk sw/CppunitTest_sw_odfexport.mk sw/CppunitTest_sw_odfimport.mk sw/ CppunitTest_sw_ooxmlexport12.mk sw/CppunitTest_sw_ooxmlexport8.mk sw/CppunitTest_sw_ooxmlimport2.mk sw/CppunitTest_sw_ooxmlimport.mk sw/CppunitTest_sw_ooxmllinks.mk sw/CppunitTest_sw_rtfimport.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_uwriter.mk sw/CppunitTest_sw_ww8export2.mk sw/CppunitTest_sw_ww8export.mk sw/CppunitTest_sw_ww8import.mk swext/mediawiki sw/inc sw/IwyuFilter_sw.yaml sw/JunitTest_sw_complex.mk sw/Library_sw.mk sw/Module_sw.mk sw/ooxmlexport_setup.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sw/UITest_writer_tests.mk sysui/CustomTarget_share.mk sysui/desktop sysui/Package_share.mk test/Library_subsequenttest.mk test/Library_test.mk test/source toolkit/inc toolkit/Library_tk.mk toolkit/qa toolkit/source tools/CppunitTest_tools_test.mk tools/inc tools/Library_tl.mk tools/qa tools/source translations ucbhelper/source ucb/source udkapi/com uitest/impress_tests uitest/manual_tests uitest/UITest_manual_tests.mk uitest/UITest_writer_demo.mk uitest/wri ter_tests UnoControls/inc UnoControls/source unodevtools/source unoidl/source unoil/pom.unoil.xml unotest/source unotools/source unoxml/Library_unoxml.mk unoxml/qa unoxml/source ure/source uui/CppunitTest_uui_dialogs_test.mk uui/inc uui/Library_uui.mk uui/source uui/uiconfig vbahelper/source vcl/backendtest vcl/CppunitTest_vcl_apitests.mk vcl/CppunitTest_vcl_bitmap_render_test.mk vcl/CppunitTest_vcl_complextext.mk vcl/CppunitTest_vcl_fontmetric.mk vcl/CppunitTest_vcl_graphic_test.mk vcl/CppunitTest_vcl_jpeg_read_write_test.mk vcl/CustomTarget_kde5_moc.mk vcl/CustomTarget_qt5_moc.mk vcl/Executable_outdevgrind.mk vcl/Executable_vcldemo.mk vcl/headless vcl/inc vcl/Library_vcl.mk vcl/Library_vclplug_gtk3_kde5.mk vcl/Library_vclplug_gtk3.mk vcl/Library_vclplug_gtk.mk vcl/Library_vclplug_kde4.mk vcl/Library_vclplug_kde5.mk vcl/Library_vclplug_qt5.mk vcl/Module_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/README.GDIMetaFile vcl/source vcl/uiconfig vcl/UIConfig_vcl.mk vcl/unx vcl /vcl.common.component vcl/win vcl/workben winaccessibility/source wizards/com wizards/source writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/IwyuFilter_writerfilter.yaml writerfilter/source writerperfect/astyle.options writerperfect/CppunitTest_writerperfect_wpftimport.mk writerperfect/inc writerperfect/Library_writerperfect.mk writerperfect/qa writerperfect/README writerperfect/source writerperfect/uiconfig xmerge/source xmlhelp/source xmloff/dtd xmloff/inc xmloff/Library_xo.mk xmloff/qa xmloff/source xmlscript/dtd xmlscript/source xmlscript/test xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/Executable_pdfverify.mk xmlsecurity/inc xmlsecurity/Library_xsec_xmlsec.mk xmlsecurity/qa xmlsecurity/source xmlsecurity/uiconfig xmlsecurity/util xmlsecurity/workben
Katarina Behrens
Katarina.Behrens at cib.de
Thu May 31 08:24:10 UTC 2018
Rebased ref, commits from common ancestor:
commit ec3f10b72366f41616508118da4f49bf8bb482ec
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 31 10:20:39 2018 +0200
Use harfbuzz and graphite, needed after GenericSalLayout refactoring
Change-Id: I21c221715c4e6b4e692c8b5ea4d9c9eb5d073980
diff --git a/vcl/Library_vclplug_kde5.mk b/vcl/Library_vclplug_kde5.mk
index 0f6cffad5d3c..377698d1f93c 100644
--- a/vcl/Library_vclplug_kde5.mk
+++ b/vcl/Library_vclplug_kde5.mk
@@ -55,6 +55,8 @@ $(eval $(call gb_Library_use_libraries,vclplug_kde5,\
$(eval $(call gb_Library_use_externals,vclplug_kde5,\
boost_headers \
cairo \
+ graphite \
+ harfbuzz \
icuuc \
kde5 \
epoxy \
commit 8e2631589c74b3f84a6a807591cedcc9a5937397
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 29 09:53:43 2018 +0200
Add radiobuttons to native menus
Change-Id: I015bbb0a337b917096ca6f542a73c24c79fbef7d
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 6c219aff7557..e61595af4850 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -87,6 +87,7 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
if ( mbMenuBar && mpQMenuBar )
mpQMenuBar->clear();
+ QActionGroup* pQAG = nullptr;
for ( sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++ )
{
@@ -105,8 +106,11 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
else
{
if( pSalMenuItem->mpSubMenu )
+ {
// submenu
pQMenu = pQMenu->addMenu( toQString(aText) );
+ pQAG = new QActionGroup( pQMenu );
+ }
else
{
if ( pSalMenuItem->mnType == MenuItemType::SEPARATOR )
@@ -122,6 +126,16 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
pAction->setCheckable( true );
pAction->setChecked( bChecked );
}
+ else if (itemBits & MenuItemBits::RADIOCHECK)
+ {
+ pAction->setCheckable(true);
+ if ( !pQAG )
+ {
+ pQAG = new QActionGroup( pQMenu );
+ pQAG->setExclusive(true);
+ }
+ pQAG->addAction( pAction );
+ }
connect( pAction, &QAction::triggered, this,
[this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } );
commit d307e4aac9bedd8589f22a65cf83902968d62db8
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon May 28 13:59:43 2018 +0200
Add checkmark buttons to native menus
Change-Id: If64227af287006cb4f9b980dac97b2fb401eac88
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 91de0defccff..6c219aff7557 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -96,6 +96,8 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
QMenu* pQMenu = pParentMenu;
NativeItemText( aText );
vcl::KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId );
+ bool bChecked = pVCLMenu->IsItemChecked( nId );
+ MenuItemBits itemBits = pVCLMenu->GetItemBits( nId );
if (mbMenuBar && mpQMenuBar)
// top-level menu
@@ -114,6 +116,13 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
// leaf menu
QAction *pAction = pQMenu->addAction( toQString(aText) );
pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) );
+
+ if (itemBits & MenuItemBits::CHECKABLE)
+ {
+ pAction->setCheckable( true );
+ pAction->setChecked( bChecked );
+ }
+
connect( pAction, &QAction::triggered, this,
[this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } );
}
commit 0ec7d87f5aa5c15894967656a4d8a80573d0fcad
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri May 25 16:04:24 2018 +0200
Dispatch commands from menus for real
Change-Id: I01997caa22e14c1350bd83100edb74397ebab5d7
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index 408d97e76520..37887045506f 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -42,6 +42,7 @@ public:
virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override;
virtual void SetFrame( const SalFrame* pFrame ) override;
const Qt5Frame* GetFrame() const;
+ Qt5Menu* GetTopLevel();
virtual void CheckItem( unsigned nPos, bool bCheck ) override;
virtual void EnableItem( unsigned nPos, bool bEnable ) override;
virtual void ShowItem( unsigned nPos, bool bShow ) override;
@@ -56,7 +57,7 @@ public:
Qt5MenuItem* GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
private slots:
- void DispatchCommand();
+ void DispatchCommand( Qt5MenuItem* pQItem );
};
class Qt5MenuItem : public SalMenuItem
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index f7ebc5617d8c..91de0defccff 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -114,7 +114,8 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
// leaf menu
QAction *pAction = pQMenu->addAction( toQString(aText) );
pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) );
- connect( pAction, &QAction::triggered, this, &Qt5Menu::DispatchCommand );
+ connect( pAction, &QAction::triggered, this,
+ [this, pSalMenuItem]{ DispatchCommand(pSalMenuItem); } );
}
}
}
@@ -156,6 +157,14 @@ void Qt5Menu::GetSystemMenuData( SystemMenuData* pData )
{
}
+Qt5Menu* Qt5Menu::GetTopLevel()
+{
+ Qt5Menu *pMenu = this;
+ while (pMenu->mpParentSalMenu)
+ pMenu = pMenu->mpParentSalMenu;
+ return pMenu;
+}
+
const Qt5Frame* Qt5Menu::GetFrame() const
{
SolarMutexGuard aGuard;
@@ -165,9 +174,15 @@ const Qt5Frame* Qt5Menu::GetFrame() const
return pMenu ? pMenu->mpFrame : nullptr;
}
-void Qt5Menu::DispatchCommand()
+void Qt5Menu::DispatchCommand( Qt5MenuItem *pQItem )
{
- SAL_WARN("vcl.qt5", "menu triggered");
+ if ( pQItem )
+ {
+ Qt5Menu* pSalMenu = pQItem->mpParentMenu;
+ Qt5Menu* pTopLevel = pSalMenu->GetTopLevel();
+ pTopLevel->GetMenu()->HandleMenuCommandEvent(pSalMenu->GetMenu(), pQItem->mnId);
+ SAL_WARN("vcl.qt5", "menu triggered " << pQItem->mnId );
+ }
}
void Qt5Menu::NativeItemText( OUString& rItemText )
commit 8c36e6a9eaf93ceb1dbe286f570c0711e89fc584
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 24 15:04:02 2018 +0200
Basic structure of a slot to dispatch commands from menu
Change-Id: If3a134f67f59d3238c27eb0fef99bf49a8970433
diff --git a/vcl/CustomTarget_qt5_moc.mk b/vcl/CustomTarget_qt5_moc.mk
index aabe77d9a9c5..3962a730d388 100644
--- a/vcl/CustomTarget_qt5_moc.mk
+++ b/vcl/CustomTarget_qt5_moc.mk
@@ -12,6 +12,7 @@ $(eval $(call gb_CustomTarget_CustomTarget,vcl/qt5))
$(call gb_CustomTarget_get_target,vcl/qt5) : \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5FilePicker.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Instance.moc \
+ $(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Menu.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Timer.moc \
$(call gb_CustomTarget_get_workdir,vcl/qt5)/Qt5Widget.moc \
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index 38dcc3688b1f..408d97e76520 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -17,8 +17,9 @@ class QMenuBar;
class Qt5MenuItem;
class Qt5Frame;
-class Qt5Menu : public SalMenu
+class Qt5Menu : public QObject, public SalMenu
{
+ Q_OBJECT
private:
std::vector< Qt5MenuItem* > maItems;
VclPtr<Menu> mpVCLMenu;
@@ -53,6 +54,9 @@ public:
Menu* GetMenu() { return mpVCLMenu; }
unsigned GetItemCount() { return maItems.size(); }
Qt5MenuItem* GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
+
+private slots:
+ void DispatchCommand();
};
class Qt5MenuItem : public SalMenuItem
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index fd864e8b2422..f7ebc5617d8c 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -9,6 +9,7 @@
#include "Qt5Frame.hxx"
#include "Qt5Menu.hxx"
+#include <Qt5Menu.moc>
#include <QtWidgets/QtWidgets>
@@ -62,7 +63,6 @@ void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned
pQSubMenu->mpParentSalMenu = this;
pItem->mpSubMenu = pQSubMenu;
-
}
void Qt5Menu::SetFrame( const SalFrame* pFrame )
@@ -114,6 +114,7 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
// leaf menu
QAction *pAction = pQMenu->addAction( toQString(aText) );
pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) );
+ connect( pAction, &QAction::triggered, this, &Qt5Menu::DispatchCommand );
}
}
}
@@ -164,6 +165,11 @@ const Qt5Frame* Qt5Menu::GetFrame() const
return pMenu ? pMenu->mpFrame : nullptr;
}
+void Qt5Menu::DispatchCommand()
+{
+ SAL_WARN("vcl.qt5", "menu triggered");
+}
+
void Qt5Menu::NativeItemText( OUString& rItemText )
{
rItemText = rItemText.replace( '~', '&' );
commit 674a92bdf7cd3350588203f495f256fe865860eb
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 23 17:39:44 2018 +0200
Add shortcuts to native menu entries
something's wrong though, they don't really show
Change-Id: Id8559fd9b6a5d4b2b49442d179571d31a99b5b20
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 0575d5aab693..fd864e8b2422 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -95,6 +95,7 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
OUString aText = pVCLMenu->GetItemText( nId );
QMenu* pQMenu = pParentMenu;
NativeItemText( aText );
+ vcl::KeyCode nAccelKey = pVCLMenu->GetAccelKey( nId );
if (mbMenuBar && mpQMenuBar)
// top-level menu
@@ -109,8 +110,11 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
if ( pSalMenuItem->mnType == MenuItemType::SEPARATOR )
pQMenu->addSeparator();
else
+ {
// leaf menu
- pQMenu->addAction( toQString(aText) );
+ QAction *pAction = pQMenu->addAction( toQString(aText) );
+ pAction->setShortcut( toQString( nAccelKey.GetName(GetFrame()->GetWindow()) ) );
+ }
}
}
@@ -151,6 +155,15 @@ void Qt5Menu::GetSystemMenuData( SystemMenuData* pData )
{
}
+const Qt5Frame* Qt5Menu::GetFrame() const
+{
+ SolarMutexGuard aGuard;
+ const Qt5Menu* pMenu = this;
+ while( pMenu && ! pMenu->mpFrame )
+ pMenu = pMenu->mpParentSalMenu;
+ return pMenu ? pMenu->mpFrame : nullptr;
+}
+
void Qt5Menu::NativeItemText( OUString& rItemText )
{
rItemText = rItemText.replace( '~', '&' );
commit 0c9cfab3e776f41e52187c0d3698ca134967cdea
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 23 11:23:34 2018 +0200
Insert separators into native menu
Change-Id: I88bb70b1e443821cc8d1904039f2a8fb52df1ff9
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 65bf726252df..0575d5aab693 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -105,8 +105,13 @@ void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
// submenu
pQMenu = pQMenu->addMenu( toQString(aText) );
else
- // leaf menu
- pQMenu->addAction( toQString(aText) );
+ {
+ if ( pSalMenuItem->mnType == MenuItemType::SEPARATOR )
+ pQMenu->addSeparator();
+ else
+ // leaf menu
+ pQMenu->addAction( toQString(aText) );
+ }
}
if ( pSalMenuItem->mpSubMenu != nullptr )
@@ -153,6 +158,7 @@ void Qt5Menu::NativeItemText( OUString& rItemText )
Qt5MenuItem::Qt5MenuItem( const SalItemParams* pItemData ) :
mnId( pItemData->nId ),
+ mnType( pItemData->eType ),
mpVCLMenu( pItemData->pMenu ),
mpParentMenu( nullptr ),
mpSubMenu( nullptr )
commit b323287328b1c96e80712d72c4b54501a6416566
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 23 10:51:30 2018 +0200
Native leaf menus and submenus are now visible
Change-Id: Ieaac0966b167d82c8bdeb60f3ce4b9cc8589ec62
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index aa3948ce6d2d..38dcc3688b1f 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -12,6 +12,7 @@
#include <salmenu.hxx>
class MenuItemList;
+class QMenu;
class QMenuBar;
class Qt5MenuItem;
class Qt5Frame;
@@ -24,12 +25,9 @@ private:
Qt5Menu* mpParentSalMenu;
Qt5Frame* mpFrame;
bool mbMenuBar;
-
QMenuBar* mpQMenuBar;
- void ActivateAllSubMenus( Menu* pMenuBar );
- void Update();
-
+ void DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu = nullptr );
void NativeItemText( OUString &rItemText );
public:
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 586130925356..65bf726252df 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -53,6 +53,16 @@ void Qt5Menu::RemoveItem( unsigned nPos )
void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
{
+ SolarMutexGuard aGuard;
+ Qt5MenuItem *pItem = static_cast< Qt5MenuItem* >( pSalMenuItem );
+ Qt5Menu *pQSubMenu = static_cast< Qt5Menu* >( pSubMenu );
+
+ if ( pQSubMenu == nullptr )
+ return;
+
+ pQSubMenu->mpParentSalMenu = this;
+ pItem->mpSubMenu = pQSubMenu;
+
}
void Qt5Menu::SetFrame( const SalFrame* pFrame )
@@ -68,26 +78,10 @@ void Qt5Menu::SetFrame( const SalFrame* pFrame )
if( pMainWindow )
mpQMenuBar = pMainWindow->menuBar();
- ActivateAllSubMenus( mpVCLMenu );
-
- Update();
+ DoFullMenuUpdate( mpVCLMenu );
}
-void Qt5Menu::ActivateAllSubMenus( Menu* pMenuBar )
-{
- for (Qt5MenuItem* pSalItem : maItems)
- {
- if ( pSalItem->mpSubMenu != nullptr )
- {
- pMenuBar->HandleMenuActivateEvent(pSalItem->mpSubMenu->GetMenu());
- pSalItem->mpSubMenu->ActivateAllSubMenus(pMenuBar);
- pSalItem->mpSubMenu->Update();
- pMenuBar->HandleMenuDeActivateEvent(pSalItem->mpSubMenu->GetMenu());
- }
- }
-}
-
-void Qt5Menu::Update()
+void Qt5Menu::DoFullMenuUpdate( Menu* pMenuBar, QMenu* pParentMenu )
{
Menu* pVCLMenu = mpVCLMenu;
@@ -99,11 +93,27 @@ void Qt5Menu::Update()
Qt5MenuItem *pSalMenuItem = GetItemAtPos( nItem );
sal_uInt16 nId = pSalMenuItem->mnId;
OUString aText = pVCLMenu->GetItemText( nId );
+ QMenu* pQMenu = pParentMenu;
+ NativeItemText( aText );
if (mbMenuBar && mpQMenuBar)
+ // top-level menu
+ pQMenu = mpQMenuBar->addMenu( toQString(aText) );
+ else
+ {
+ if( pSalMenuItem->mpSubMenu )
+ // submenu
+ pQMenu = pQMenu->addMenu( toQString(aText) );
+ else
+ // leaf menu
+ pQMenu->addAction( toQString(aText) );
+ }
+
+ if ( pSalMenuItem->mpSubMenu != nullptr )
{
- NativeItemText( aText );
- mpQMenuBar->addMenu( toQString(aText) );
+ pMenuBar->HandleMenuActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
+ pSalMenuItem->mpSubMenu->DoFullMenuUpdate( pMenuBar, pQMenu );
+ pMenuBar->HandleMenuDeActivateEvent(pSalMenuItem->mpSubMenu->GetMenu());
}
}
}
commit b6474138534514178270c6178c67fdc6459d372a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 17 16:48:53 2018 +0200
Clear menubar before opening a new app
Change-Id: Icab19e31f7aa737351460790d2028114b24284ad
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index e70e2d1896a9..586130925356 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -91,6 +91,9 @@ void Qt5Menu::Update()
{
Menu* pVCLMenu = mpVCLMenu;
+ if ( mbMenuBar && mpQMenuBar )
+ mpQMenuBar->clear();
+
for ( sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++ )
{
Qt5MenuItem *pSalMenuItem = GetItemAtPos( nItem );
commit f196230ece1f1d194ca7191968eb6122c8baca6a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 17 15:09:48 2018 +0200
Replace ~ with & (Qt accelerator marker) in menu entries
Change-Id: Ie7866357d4e74b778849262c1c2b60605a26faad
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index 1d1048881fbc..aa3948ce6d2d 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -30,6 +30,8 @@ private:
void ActivateAllSubMenus( Menu* pMenuBar );
void Update();
+ void NativeItemText( OUString &rItemText );
+
public:
Qt5Menu( bool bMenuBar );
virtual ~Qt5Menu() override;
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index b82b525462c0..e70e2d1896a9 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -99,6 +99,7 @@ void Qt5Menu::Update()
if (mbMenuBar && mpQMenuBar)
{
+ NativeItemText( aText );
mpQMenuBar->addMenu( toQString(aText) );
}
}
@@ -132,6 +133,10 @@ void Qt5Menu::GetSystemMenuData( SystemMenuData* pData )
{
}
+void Qt5Menu::NativeItemText( OUString& rItemText )
+{
+ rItemText = rItemText.replace( '~', '&' );
+}
Qt5MenuItem::Qt5MenuItem( const SalItemParams* pItemData ) :
mnId( pItemData->nId ),
commit c178b63eddf2443213ca1c84374ce3163cee8cbe
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 17 12:55:55 2018 +0200
Unify Color -> QColor conversion
this also resolves build failures on 32bit platforms
Change-Id: I53fa2faae52a8cb322644c5bd5e5e84d71110d8e
diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index d632a5ed8ce5..06c02572473c 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -26,6 +26,7 @@
#include <rtl/string.hxx>
#include <rtl/ustring.hxx>
+#include <tools/color.hxx>
#include <tools/gen.hxx>
#include <memory>
@@ -55,6 +56,11 @@ inline QSize toQSize(const Size& rSize) { return QSize(rSize.Width(), rSize.Heig
inline Size toSize(const QSize& rSize) { return Size(rSize.width(), rSize.height()); }
+inline QColor toQColor(const Color& rColor)
+{
+ return QColor( rColor.GetRed(), rColor.GetGreen(), rColor.GetBlue(), rColor.GetTransparency() );
+}
+
static constexpr QImage::Format Qt5_DefaultFormat32 = QImage::Format_ARGB32;
inline QImage::Format getBitFormat(sal_uInt16 nBitCount)
diff --git a/vcl/qt5/Qt5Graphics_GDI.cxx b/vcl/qt5/Qt5Graphics_GDI.cxx
index 7bed0a43aed6..61b92b109bfe 100644
--- a/vcl/qt5/Qt5Graphics_GDI.cxx
+++ b/vcl/qt5/Qt5Graphics_GDI.cxx
@@ -172,7 +172,7 @@ void Qt5Graphics::drawPixel(long nX, long nY)
void Qt5Graphics::drawPixel(long nX, long nY, Color nColor)
{
Qt5Painter aPainter(*this);
- aPainter.setPen(QColor(QRgb(nColor)));
+ aPainter.setPen(toQColor(nColor));
aPainter.setPen(Qt::SolidLine);
aPainter.drawPoint(nX, nY);
aPainter.update(nX, nY, 1, 1);
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index a719bef57085..d95795953ff9 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -179,7 +179,7 @@ void Qt5Graphics::DrawTextLayout(const GenericSalLayout &rLayout )
aGlyphRun.setRawFont( aRawFont );
Qt5Painter aPainter(*this);
- QColor aColor = QColor::fromRgb(QRgb(m_aTextColor));
+ QColor aColor = toQColor(m_aTextColor);
aPainter.setPen(aColor);
aPainter.drawGlyphRun( QPointF(), aGlyphRun );
}
diff --git a/vcl/qt5/Qt5Painter.cxx b/vcl/qt5/Qt5Painter.cxx
index 5bf0db22b3f0..88e9b10b1885 100644
--- a/vcl/qt5/Qt5Painter.cxx
+++ b/vcl/qt5/Qt5Painter.cxx
@@ -37,7 +37,7 @@ Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTr
setClipRegion(rGraphics.m_aClipRegion);
if (SALCOLOR_NONE != rGraphics.m_aLineColor)
{
- QColor aColor = QColor::fromRgb(QRgb(rGraphics.m_aLineColor));
+ QColor aColor = toQColor(rGraphics.m_aLineColor);
aColor.setAlpha(nTransparency);
setPen(aColor);
}
@@ -45,7 +45,7 @@ Qt5Painter::Qt5Painter(Qt5Graphics& rGraphics, bool bPrepareBrush, sal_uInt8 nTr
setPen(Qt::NoPen);
if (bPrepareBrush && SALCOLOR_NONE != rGraphics.m_aFillColor)
{
- QColor aColor = QColor::fromRgb(QRgb(rGraphics.m_aFillColor));
+ QColor aColor = toQColor(rGraphics.m_aFillColor);
aColor.setAlpha(nTransparency);
setBrush(Qt::SolidPattern);
setBrush(aColor);
commit 361b0fb267b49e18cef219cef35f899d76249eb1
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 16 11:37:09 2018 +0200
Top-level native menubar items are now visible
Change-Id: I6746b4a41a99c75234e64ab48ce81ea97333da04
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index 1c0f03b3342c..1d1048881fbc 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -28,6 +28,7 @@ private:
QMenuBar* mpQMenuBar;
void ActivateAllSubMenus( Menu* pMenuBar );
+ void Update();
public:
Qt5Menu( bool bMenuBar );
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 4869a78b8a05..b82b525462c0 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -69,6 +69,8 @@ void Qt5Menu::SetFrame( const SalFrame* pFrame )
mpQMenuBar = pMainWindow->menuBar();
ActivateAllSubMenus( mpVCLMenu );
+
+ Update();
}
void Qt5Menu::ActivateAllSubMenus( Menu* pMenuBar )
@@ -85,6 +87,23 @@ void Qt5Menu::ActivateAllSubMenus( Menu* pMenuBar )
}
}
+void Qt5Menu::Update()
+{
+ Menu* pVCLMenu = mpVCLMenu;
+
+ for ( sal_Int32 nItem = 0; nItem < static_cast<sal_Int32>(GetItemCount()); nItem++ )
+ {
+ Qt5MenuItem *pSalMenuItem = GetItemAtPos( nItem );
+ sal_uInt16 nId = pSalMenuItem->mnId;
+ OUString aText = pVCLMenu->GetItemText( nId );
+
+ if (mbMenuBar && mpQMenuBar)
+ {
+ mpQMenuBar->addMenu( toQString(aText) );
+ }
+ }
+}
+
void Qt5Menu::ShowItem( unsigned nPos, bool bCheck )
{
}
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index 8d910434b600..5331d32000a8 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -464,7 +464,6 @@ private:
: QMainWindow(Q_NULLPTR, f), maMixin(&rFrame)
{
Init();
- ParentClassT::menuBar()->addMenu("ExperimentMenu");
}
void Init()
commit 09b5368a8dfea69901773e0beed8fcbf1a50df1a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 15 16:29:15 2018 +0200
Expose menu bar of the main window
and some addional work on activating menus
Change-Id: I0c4d87dc158f3253aa97d151385fce14551c11b9
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 8772ee7bbfcc..1f881d706881 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -28,6 +28,7 @@
class Qt5Graphics;
class Qt5Instance;
+class Qt5Menu;
class QWidget;
class QPaintDevice;
class QImage;
@@ -55,6 +56,8 @@ class VCLPLUG_QT5_PUBLIC Qt5Frame : public SalFrame
Qt5Frame* m_pParent;
PointerStyle m_ePointerStyle;
+ Qt5Menu* m_pSalMenu;
+
bool m_bDefaultSize;
bool m_bDefaultPos;
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
index cf7a715f5911..1c0f03b3342c 100644
--- a/vcl/inc/qt5/Qt5Menu.hxx
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -12,6 +12,7 @@
#include <salmenu.hxx>
class MenuItemList;
+class QMenuBar;
class Qt5MenuItem;
class Qt5Frame;
@@ -24,6 +25,10 @@ private:
Qt5Frame* mpFrame;
bool mbMenuBar;
+ QMenuBar* mpQMenuBar;
+
+ void ActivateAllSubMenus( Menu* pMenuBar );
+
public:
Qt5Menu( bool bMenuBar );
virtual ~Qt5Menu() override;
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index ec210c15ade0..4a36bee27776 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -24,6 +24,7 @@
#include "Qt5Graphics.hxx"
#include "Qt5Widget.hxx"
#include "Qt5Data.hxx"
+#include <Qt5Menu.hxx>
#include <QtCore/QPoint>
#include <QtCore/QSize>
@@ -233,7 +234,10 @@ void Qt5Frame::SetIcon(sal_uInt16 nIcon)
m_pQWidget->window()->setWindowIcon(aIcon);
}
-void Qt5Frame::SetMenu(SalMenu* /*pMenu*/) {}
+void Qt5Frame::SetMenu(SalMenu* pMenu)
+{
+ m_pSalMenu = static_cast<Qt5Menu*>( pMenu );
+}
void Qt5Frame::DrawMenuBar() {}
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 5a3753b6433a..4869a78b8a05 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -10,6 +10,8 @@
#include "Qt5Frame.hxx"
#include "Qt5Menu.hxx"
+#include <QtWidgets/QtWidgets>
+
#include <vcl/svapp.hxx>
Qt5Menu::Qt5Menu( bool bMenuBar ) :
@@ -55,8 +57,32 @@ void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned
void Qt5Menu::SetFrame( const SalFrame* pFrame )
{
-
+ SolarMutexGuard aGuard;
+ assert(mbMenuBar);
mpFrame = const_cast<Qt5Frame*>( static_cast<const Qt5Frame*>( pFrame ) );
+
+ mpFrame->SetMenu( this );
+
+ QWidget* pWidget = mpFrame->GetQWidget();
+ QMainWindow* pMainWindow = dynamic_cast<QMainWindow*>(pWidget);
+ if( pMainWindow )
+ mpQMenuBar = pMainWindow->menuBar();
+
+ ActivateAllSubMenus( mpVCLMenu );
+}
+
+void Qt5Menu::ActivateAllSubMenus( Menu* pMenuBar )
+{
+ for (Qt5MenuItem* pSalItem : maItems)
+ {
+ if ( pSalItem->mpSubMenu != nullptr )
+ {
+ pMenuBar->HandleMenuActivateEvent(pSalItem->mpSubMenu->GetMenu());
+ pSalItem->mpSubMenu->ActivateAllSubMenus(pMenuBar);
+ pSalItem->mpSubMenu->Update();
+ pMenuBar->HandleMenuDeActivateEvent(pSalItem->mpSubMenu->GetMenu());
+ }
+ }
}
void Qt5Menu::ShowItem( unsigned nPos, bool bCheck )
commit 50b783c00d03a07ec844673df94367c9443adf8d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon May 14 15:39:30 2018 +0200
Templatize Qt5Widget class
to distinguish between QMainWindow (top-level SalFrame) and QWidget
(everything else). The former are going to receive a native menu
Change-Id: I9023d1e464345f96f13967f5e2c8b0716890fbc9
diff --git a/vcl/inc/qt5/Qt5Frame.hxx b/vcl/inc/qt5/Qt5Frame.hxx
index 4b0a99113536..8772ee7bbfcc 100644
--- a/vcl/inc/qt5/Qt5Frame.hxx
+++ b/vcl/inc/qt5/Qt5Frame.hxx
@@ -28,7 +28,6 @@
class Qt5Graphics;
class Qt5Instance;
-class Qt5Widget;
class QWidget;
class QPaintDevice;
class QImage;
@@ -36,7 +35,7 @@ class SvpSalGraphics;
class VCLPLUG_QT5_PUBLIC Qt5Frame : public SalFrame
{
- friend class Qt5Widget;
+ friend class VclQtMixinBase;
std::unique_ptr<QWidget> m_pQWidget;
diff --git a/vcl/inc/qt5/Qt5Widget.hxx b/vcl/inc/qt5/Qt5Widget.hxx
index 7e7ed8240802..c95bc94c1f0c 100644
--- a/vcl/inc/qt5/Qt5Widget.hxx
+++ b/vcl/inc/qt5/Qt5Widget.hxx
@@ -21,43 +21,8 @@
#include <QtWidgets/QWidget>
-class Qt5Frame;
-class Qt5Object;
-class QFocusEvent;
-class QKeyEvent;
-class QMouseEvent;
-class QMoveEvent;
-class QPaintEvent;
-class QResizeEvent;
-class QShowEvent;
-class QWheelEvent;
+#include "Qt5Frame.hxx"
-class Qt5Widget : public QWidget
-{
- Q_OBJECT
-
- Qt5Frame* m_pFrame;
-
- bool handleKeyEvent(QKeyEvent*, bool);
- void handleMouseButtonEvent(QMouseEvent*, bool);
-
- virtual void focusInEvent(QFocusEvent*) override;
- virtual void focusOutEvent(QFocusEvent*) override;
- virtual void keyPressEvent(QKeyEvent*) override;
- virtual void keyReleaseEvent(QKeyEvent*) override;
- virtual void mouseMoveEvent(QMouseEvent*) override;
- virtual void mousePressEvent(QMouseEvent*) override;
- virtual void mouseReleaseEvent(QMouseEvent*) override;
- virtual void moveEvent(QMoveEvent*) override;
- virtual void paintEvent(QPaintEvent*) override;
- virtual void resizeEvent(QResizeEvent*) override;
- virtual void showEvent(QShowEvent*) override;
- virtual void wheelEvent(QWheelEvent*) override;
- virtual void closeEvent(QCloseEvent*) override;
-
-public:
- Qt5Widget(Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
- virtual ~Qt5Widget() override;
-};
+QWidget* createQt5Widget(Qt5Frame &rFrame, QWidget* parent, Qt::WindowFlags f);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5FilePicker.cxx b/vcl/qt5/Qt5FilePicker.cxx
index cb599b6822a7..7dee36de35d3 100644
--- a/vcl/qt5/Qt5FilePicker.cxx
+++ b/vcl/qt5/Qt5FilePicker.cxx
@@ -193,7 +193,7 @@ sal_Int16 SAL_CALL Qt5FilePicker::execute()
vcl::Window *pWindow = ::Application::GetActiveTopWindow();
assert( pWindow );
- Qt5Widget *pTransientParent = nullptr;
+ QWidget *pTransientParent = nullptr;
QWindow *pTransientWindow = nullptr;
if( pWindow )
{
@@ -201,7 +201,7 @@ sal_Int16 SAL_CALL Qt5FilePicker::execute()
assert( pFrame );
if( pFrame )
{
- pTransientParent = static_cast<Qt5Widget *>( pFrame->GetQWidget() );
+ pTransientParent = pFrame->GetQWidget();
pTransientWindow = pTransientParent->window()->windowHandle();
}
}
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx
index 2af95ee039dd..ec210c15ade0 100644
--- a/vcl/qt5/Qt5Frame.cxx
+++ b/vcl/qt5/Qt5Frame.cxx
@@ -90,7 +90,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo)
aWinFlags |= Qt::Window;
}
- m_pQWidget.reset(new Qt5Widget(*this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags));
+ m_pQWidget.reset(createQt5Widget(*this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags));
if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG))
{
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx
index bb3ca8aaa44b..8d910434b600 100644
--- a/vcl/qt5/Qt5Widget.cxx
+++ b/vcl/qt5/Qt5Widget.cxx
@@ -32,43 +32,61 @@
#include <QtGui/QPaintEvent>
#include <QtGui/QShowEvent>
#include <QtGui/QWheelEvent>
+#include <QtWidgets/QtWidgets>
+#include <QtWidgets/QMainWindow>
#include <cairo.h>
#include <headless/svpgdi.hxx>
-Qt5Widget::Qt5Widget(Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f)
- : QWidget(parent, f)
- , m_pFrame(&rFrame)
+class VclQtMixinBase
{
- create();
- setMouseTracking(true);
- setFocusPolicy(Qt::StrongFocus);
-}
-
-Qt5Widget::~Qt5Widget() {}
-
-void Qt5Widget::paintEvent(QPaintEvent* pEvent)
+public:
+ VclQtMixinBase( Qt5Frame *pFrame) { m_pFrame = pFrame; }
+
+ void mixinFocusInEvent(QFocusEvent*);
+ void mixinFocusOutEvent(QFocusEvent*);
+ void mixinKeyPressEvent(QKeyEvent*);
+ void mixinKeyReleaseEvent(QKeyEvent*);
+ void mixinMouseMoveEvent(QMouseEvent*);
+ void mixinMousePressEvent(QMouseEvent*);
+ void mixinMouseReleaseEvent(QMouseEvent*);
+ void mixinMoveEvent(QMoveEvent*);
+ void mixinPaintEvent(QPaintEvent*, QWidget* widget);
+ void mixinResizeEvent(QResizeEvent*, QSize aSize);
+ void mixinShowEvent(QShowEvent*);
+ void mixinWheelEvent(QWheelEvent*);
+ void mixinCloseEvent(QCloseEvent*);
+
+private:
+ bool mixinHandleKeyEvent(QKeyEvent*, bool);
+ void mixinHandleMouseButtonEvent(QMouseEvent*, bool);
+
+ Qt5Frame *m_pFrame;
+};
+
+
+void VclQtMixinBase::mixinPaintEvent(QPaintEvent* pEvent, QWidget* widget)
{
- QPainter p(this);
+ QPainter p(widget);
if (m_pFrame->m_bUseCairo)
{
cairo_surface_t* pSurface = m_pFrame->m_pSurface.get();
cairo_surface_flush(pSurface);
- QImage aImage(cairo_image_surface_get_data(pSurface), size().width(), size().height(),
- Qt5_DefaultFormat32);
+ QImage aImage(cairo_image_surface_get_data(pSurface), widget->size().width(),
+ widget->size().height(),Qt5_DefaultFormat32);
p.drawImage(pEvent->rect().topLeft(), aImage, pEvent->rect());
}
else
p.drawImage(pEvent->rect().topLeft(), *m_pFrame->m_pQImage, pEvent->rect());
}
-void Qt5Widget::resizeEvent(QResizeEvent*)
+void VclQtMixinBase::mixinResizeEvent(QResizeEvent*, QSize aSize)
{
if (m_pFrame->m_bUseCairo)
{
- int width = size().width();
- int height = size().height();
+ int width = aSize.width();
+ int height = aSize.height();
cairo_surface_t* pSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
cairo_surface_set_user_data(pSurface, SvpSalGraphics::getDamageKey(),
&m_pFrame->m_aDamageHandler, nullptr);
@@ -77,18 +95,18 @@ void Qt5Widget::resizeEvent(QResizeEvent*)
}
else
{
- QImage* pImage = new QImage(size(), Qt5_DefaultFormat32);
+ QImage* pImage = new QImage(aSize, Qt5_DefaultFormat32);
m_pFrame->m_pQt5Graphics->ChangeQImage(pImage);
m_pFrame->m_pQImage.reset(pImage);
}
- m_pFrame->maGeometry.nWidth = size().width();
- m_pFrame->maGeometry.nHeight = size().height();
+ m_pFrame->maGeometry.nWidth = aSize.width();
+ m_pFrame->maGeometry.nHeight = aSize.height();
m_pFrame->CallCallback(SalEvent::Resize, nullptr);
}
-void Qt5Widget::handleMouseButtonEvent(QMouseEvent* pEvent, bool bReleased)
+void VclQtMixinBase::mixinHandleMouseButtonEvent(QMouseEvent* pEvent, bool bReleased)
{
SalMouseEvent aEvent;
switch (pEvent->button())
@@ -119,11 +137,17 @@ void Qt5Widget::handleMouseButtonEvent(QMouseEvent* pEvent, bool bReleased)
m_pFrame->CallCallback(nEventType, &aEvent);
}
-void Qt5Widget::mousePressEvent(QMouseEvent* pEvent) { handleMouseButtonEvent(pEvent, false); }
+void VclQtMixinBase::mixinMousePressEvent(QMouseEvent* pEvent)
+{
+ mixinHandleMouseButtonEvent(pEvent, false);
+}
-void Qt5Widget::mouseReleaseEvent(QMouseEvent* pEvent) { handleMouseButtonEvent(pEvent, true); }
+void VclQtMixinBase::mixinMouseReleaseEvent(QMouseEvent* pEvent)
+{
+ mixinHandleMouseButtonEvent(pEvent, true);
+}
-void Qt5Widget::mouseMoveEvent(QMouseEvent* pEvent)
+void VclQtMixinBase::mixinMouseMoveEvent(QMouseEvent* pEvent)
{
SalMouseEvent aEvent;
aEvent.mnTime = pEvent->timestamp();
@@ -136,7 +160,7 @@ void Qt5Widget::mouseMoveEvent(QMouseEvent* pEvent)
pEvent->accept();
}
-void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
+void VclQtMixinBase::mixinWheelEvent(QWheelEvent* pEvent)
{
SalWheelMouseEvent aEvent;
@@ -164,16 +188,19 @@ void Qt5Widget::wheelEvent(QWheelEvent* pEvent)
pEvent->accept();
}
-void Qt5Widget::moveEvent(QMoveEvent*) { m_pFrame->CallCallback(SalEvent::Move, nullptr); }
+void VclQtMixinBase::mixinMoveEvent(QMoveEvent*)
+{
+ m_pFrame->CallCallback(SalEvent::Move, nullptr);
+}
-void Qt5Widget::showEvent(QShowEvent*)
+void VclQtMixinBase::mixinShowEvent(QShowEvent*)
{
- QSize aSize(m_pFrame->m_pQWidget->size());
+ QSize aSize( m_pFrame->GetQWidget()->size() );
SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height(), true);
m_pFrame->CallCallback(SalEvent::Paint, &aPaintEvt);
}
-void Qt5Widget::closeEvent(QCloseEvent* /*pEvent*/)
+void VclQtMixinBase::mixinCloseEvent(QCloseEvent* /*pEvent*/)
{
m_pFrame->CallCallback(SalEvent::Close, nullptr);
}
@@ -314,7 +341,7 @@ static sal_uInt16 GetKeyCode(int keyval)
return nCode;
}
-bool Qt5Widget::handleKeyEvent(QKeyEvent* pEvent, bool bDown)
+bool VclQtMixinBase::mixinHandleKeyEvent(QKeyEvent* pEvent, bool bDown)
{
SalKeyEvent aEvent;
@@ -331,23 +358,133 @@ bool Qt5Widget::handleKeyEvent(QKeyEvent* pEvent, bool bDown)
return bStopProcessingKey;
}
-void Qt5Widget::keyPressEvent(QKeyEvent* pEvent)
+void VclQtMixinBase::mixinKeyPressEvent(QKeyEvent* pEvent)
{
- if (handleKeyEvent(pEvent, true))
+ if (mixinHandleKeyEvent(pEvent, true))
pEvent->accept();
}
-void Qt5Widget::keyReleaseEvent(QKeyEvent* pEvent)
+void VclQtMixinBase::mixinKeyReleaseEvent(QKeyEvent* pEvent)
{
- if (handleKeyEvent(pEvent, false))
+ if (mixinHandleKeyEvent(pEvent, false))
pEvent->accept();
}
-void Qt5Widget::focusInEvent(QFocusEvent*) { m_pFrame->CallCallback(SalEvent::GetFocus, nullptr); }
+void VclQtMixinBase::mixinFocusInEvent(QFocusEvent*)
+{
+ m_pFrame->CallCallback(SalEvent::GetFocus, nullptr);
+}
-void Qt5Widget::focusOutEvent(QFocusEvent*)
+void VclQtMixinBase::mixinFocusOutEvent(QFocusEvent*)
{
m_pFrame->CallCallback(SalEvent::LoseFocus, nullptr);
}
+template<class ParentClassT>
+class Qt5Widget : public ParentClassT
+{
+ //Q_OBJECT
+
+ VclQtMixinBase maMixin;
+
+ virtual void focusInEvent(QFocusEvent* event) override
+ {
+ return maMixin.mixinFocusInEvent(event);
+ }
+
+ virtual void focusOutEvent(QFocusEvent* event) override
+ {
+ return maMixin.mixinFocusOutEvent(event);
+ }
+
+ virtual void keyPressEvent(QKeyEvent* event) override
+ {
+ return maMixin.mixinKeyPressEvent(event);
+ }
+
+ virtual void keyReleaseEvent(QKeyEvent* event) override
+ {
+ return maMixin.mixinKeyReleaseEvent(event);
+ }
+
+ virtual void mouseMoveEvent(QMouseEvent* event) override
+ {
+ return maMixin.mixinMouseMoveEvent(event);
+ }
+
+ virtual void mousePressEvent(QMouseEvent* event) override
+ {
+ return maMixin.mixinMousePressEvent(event);
+ }
+
+ virtual void mouseReleaseEvent(QMouseEvent* event) override
+ {
+ return maMixin.mixinMouseReleaseEvent(event);
+ }
+
+ virtual void moveEvent(QMoveEvent* event) override
+ {
+ return maMixin.mixinMoveEvent(event);
+ }
+
+ virtual void paintEvent(QPaintEvent* event) override
+ {
+ return maMixin.mixinPaintEvent(event, this);
+ }
+
+ virtual void resizeEvent(QResizeEvent* event) override
+ {
+ return maMixin.mixinResizeEvent(event, ParentClassT::size());
+ }
+
+ virtual void showEvent(QShowEvent* event) override
+ {
+ return maMixin.mixinShowEvent(event);
+ }
+
+ virtual void wheelEvent(QWheelEvent* event) override
+ {
+ return maMixin.mixinWheelEvent(event);
+ }
+
+ virtual void closeEvent(QCloseEvent* event) override
+ {
+ return maMixin.mixinCloseEvent(event);
+ }
+
+
+private:
+ Qt5Widget( Qt5Frame& rFrame, QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags() )
+ : QWidget(parent, f), maMixin(&rFrame)
+ {
+ Init();
+ }
+
+ Qt5Widget( Qt5Frame& rFrame, Qt::WindowFlags f )
+ : QMainWindow(Q_NULLPTR, f), maMixin(&rFrame)
+ {
+ Init();
+ ParentClassT::menuBar()->addMenu("ExperimentMenu");
+ }
+
+ void Init()
+ {
+ ParentClassT::create();
+ ParentClassT::setMouseTracking(true);
+ ParentClassT::setFocusPolicy(Qt::StrongFocus);
+ }
+public:
+ virtual ~Qt5Widget() override {};
+
+ friend QWidget* createQt5Widget(Qt5Frame &rFrame, QWidget* parent, Qt::WindowFlags f);
+};
+
+QWidget* createQt5Widget( Qt5Frame& rFrame, QWidget* parent, Qt::WindowFlags f)
+{
+ if(parent)
+ return new Qt5Widget<QWidget>(rFrame, parent, f);
+ else
+ return new Qt5Widget<QMainWindow>(rFrame, f);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9bb726d437e4d4e0a05f8a27d0930a60f71742e6
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 9 14:34:24 2018 +0200
Basic ops (add, remove) with native menu items
nothing's visible yet
Change-Id: Iee9d31ecdb931e64016f8430b51b619a39528726
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
index 2471f779c463..5a3753b6433a 100644
--- a/vcl/qt5/Qt5Menu.cxx
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -10,6 +10,8 @@
#include "Qt5Frame.hxx"
#include "Qt5Menu.hxx"
+#include <vcl/svapp.hxx>
+
Qt5Menu::Qt5Menu( bool bMenuBar ) :
mpVCLMenu( nullptr ),
mpParentSalMenu( nullptr ),
@@ -20,6 +22,7 @@ Qt5Menu::Qt5Menu( bool bMenuBar ) :
Qt5Menu::~Qt5Menu()
{
+ maItems.clear();
}
bool Qt5Menu::VisibleMenuBar()
@@ -29,10 +32,21 @@ bool Qt5Menu::VisibleMenuBar()
void Qt5Menu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
{
+ SolarMutexGuard aGuard;
+ Qt5MenuItem *pItem = static_cast<Qt5MenuItem*>( pSalMenuItem );
+
+ if ( nPos == MENU_APPEND )
+ maItems.push_back( pItem );
+ else
+ maItems.insert( maItems.begin() + nPos, pItem );
+
+ pItem->mpParentMenu = this;
}
void Qt5Menu::RemoveItem( unsigned nPos )
{
+ SolarMutexGuard aGuard;
+ maItems.erase( maItems.begin() + nPos );
}
void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
commit ceac90b44e8f3e3651ef3a759391b7aeba4aee5c
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 8 18:35:44 2018 +0200
Prep Qt5Instance for native menus
Change-Id: I7ec34b13823b943ef5e99b92d919c2df795d6ace
diff --git a/vcl/inc/qt5/Qt5Instance.hxx b/vcl/inc/qt5/Qt5Instance.hxx
index 71b816a83be4..24085b2af92d 100644
--- a/vcl/inc/qt5/Qt5Instance.hxx
+++ b/vcl/inc/qt5/Qt5Instance.hxx
@@ -79,6 +79,11 @@ public:
virtual OUString GetDefaultPrinter() override;
virtual void PostPrintersChanged() override;
+ virtual SalMenu* CreateMenu( bool, Menu* ) override;
+ virtual void DestroyMenu( SalMenu* pMenu ) override;
+ virtual SalMenuItem* CreateMenuItem( const SalItemParams* ) override;
+ virtual void DestroyMenuItem( SalMenuItem* pItem ) override;
+
virtual SalTimer* CreateSalTimer() override;
virtual SalSystem* CreateSalSystem() override;
virtual SalBitmap* CreateSalBitmap() override;
diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx
index 1ab91453e1a0..9bfcd00e630b 100644
--- a/vcl/qt5/Qt5Instance.cxx
+++ b/vcl/qt5/Qt5Instance.cxx
@@ -24,6 +24,7 @@
#include "Qt5Data.hxx"
#include "Qt5FilePicker.hxx"
#include "Qt5Frame.hxx"
+#include "Qt5Menu.hxx"
#include "Qt5Object.hxx"
#include "Qt5Timer.hxx"
#include "Qt5VirtualDevice.hxx"
@@ -110,6 +111,28 @@ Qt5Instance::CreateVirtualDevice(SalGraphics* pGraphics, long& nDX, long& nDY, D
}
}
+SalMenu* Qt5Instance::CreateMenu( bool bMenuBar, Menu* pVCLMenu )
+{
+ Qt5Menu* pSalMenu = new Qt5Menu( bMenuBar );
+ pSalMenu->SetMenu( pVCLMenu );
+ return pSalMenu;
+}
+
+void Qt5Instance::DestroyMenu( SalMenu* pMenu )
+{
+ delete pMenu;
+}
+
+SalMenuItem* Qt5Instance::CreateMenuItem( const SalItemParams* pItemData )
+{
+ return new Qt5MenuItem( pItemData );
+}
+
+void Qt5Instance::DestroyMenuItem( SalMenuItem* pItem )
+{
+ delete pItem;
+}
+
SalTimer* Qt5Instance::CreateSalTimer() { return new Qt5Timer(); }
SalSystem* Qt5Instance::CreateSalSystem() { return new SvpSalSystem(); }
commit 8cb01fa33c43fd376c893e040ea1c6fd507ae561
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue May 8 16:05:59 2018 +0200
Basic skeleton of native menus
in the closet
Change-Id: Ic54b3853b53987b3e5a85444da0b9167a785bd81
diff --git a/vcl/Library_vclplug_qt5.mk b/vcl/Library_vclplug_qt5.mk
index 8894bee3f4e1..f08916decbab 100644
--- a/vcl/Library_vclplug_qt5.mk
+++ b/vcl/Library_vclplug_qt5.mk
@@ -91,6 +91,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
vcl/qt5/Qt5Graphics_Text \
vcl/qt5/Qt5Instance \
vcl/qt5/Qt5Instance_Print \
+ vcl/qt5/Qt5Menu \
vcl/qt5/Qt5Object \
vcl/qt5/Qt5Painter \
vcl/qt5/Qt5Printer \
diff --git a/vcl/inc/qt5/Qt5Menu.hxx b/vcl/inc/qt5/Qt5Menu.hxx
new file mode 100644
index 000000000000..cf7a715f5911
--- /dev/null
+++ b/vcl/inc/qt5/Qt5Menu.hxx
@@ -0,0 +1,66 @@
+/* -*- 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/.
+ */
+
+#pragma once
+
+#include <salmenu.hxx>
+
+class MenuItemList;
+class Qt5MenuItem;
+class Qt5Frame;
+
+class Qt5Menu : public SalMenu
+{
+private:
+ std::vector< Qt5MenuItem* > maItems;
+ VclPtr<Menu> mpVCLMenu;
+ Qt5Menu* mpParentSalMenu;
+ Qt5Frame* mpFrame;
+ bool mbMenuBar;
+
+public:
+ Qt5Menu( bool bMenuBar );
+ virtual ~Qt5Menu() override;
+
+ virtual bool VisibleMenuBar() override; // must return TRUE to actually DISPLAY native menu bars
+
+ virtual void InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos ) override;
+ virtual void RemoveItem( unsigned nPos ) override;
+ virtual void SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos ) override;
+ virtual void SetFrame( const SalFrame* pFrame ) override;
+ const Qt5Frame* GetFrame() const;
+ virtual void CheckItem( unsigned nPos, bool bCheck ) override;
+ virtual void EnableItem( unsigned nPos, bool bEnable ) override;
+ virtual void ShowItem( unsigned nPos, bool bShow ) override;
+ virtual void SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const OUString& rText ) override;
+ virtual void SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage) override;
+ virtual void SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName ) override;
+ virtual void GetSystemMenuData( SystemMenuData* pData ) override;
+
+ void SetMenu( Menu* pMenu ) { mpVCLMenu = pMenu; }
+ Menu* GetMenu() { return mpVCLMenu; }
+ unsigned GetItemCount() { return maItems.size(); }
+ Qt5MenuItem* GetItemAtPos( unsigned nPos ) { return maItems[ nPos ]; }
+};
+
+class Qt5MenuItem : public SalMenuItem
+{
+public:
+ Qt5MenuItem( const SalItemParams* );
+ virtual ~Qt5MenuItem() override;
+
+ sal_uInt16 mnId; // Item ID
+ MenuItemType mnType; // Item type
+ bool mbVisible; // Item visibility.
+ Menu* mpVCLMenu;
+ Qt5Menu* mpParentMenu; // The menu into which this menu item is inserted
+ Qt5Menu* mpSubMenu; // Submenu of this item (if defined)
+};
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/Qt5Menu.cxx b/vcl/qt5/Qt5Menu.cxx
new file mode 100644
index 000000000000..2471f779c463
--- /dev/null
+++ b/vcl/qt5/Qt5Menu.cxx
@@ -0,0 +1,89 @@
+/* -*- 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/.
+ */
+
+#include "Qt5Frame.hxx"
+#include "Qt5Menu.hxx"
+
+Qt5Menu::Qt5Menu( bool bMenuBar ) :
+ mpVCLMenu( nullptr ),
+ mpParentSalMenu( nullptr ),
+ mpFrame( nullptr ),
+ mbMenuBar( bMenuBar )
+{
+}
+
+Qt5Menu::~Qt5Menu()
+{
+}
+
+bool Qt5Menu::VisibleMenuBar()
+{
+ return false;
+}
+
+void Qt5Menu::InsertItem( SalMenuItem* pSalMenuItem, unsigned nPos )
+{
+}
+
+void Qt5Menu::RemoveItem( unsigned nPos )
+{
+}
+
+void Qt5Menu::SetSubMenu( SalMenuItem* pSalMenuItem, SalMenu* pSubMenu, unsigned nPos )
+{
+}
+
+void Qt5Menu::SetFrame( const SalFrame* pFrame )
+{
+
+ mpFrame = const_cast<Qt5Frame*>( static_cast<const Qt5Frame*>( pFrame ) );
+}
+
+void Qt5Menu::ShowItem( unsigned nPos, bool bCheck )
+{
+}
+
+void Qt5Menu::CheckItem( unsigned nPos, bool bCheck )
+{
+}
+
+void Qt5Menu::EnableItem( unsigned nPos, bool bEnable )
+{
+}
+
+void Qt5Menu::SetItemText( unsigned nPos, SalMenuItem* pSalMenuItem, const rtl::OUString& rText )
+{
+}
+
+void Qt5Menu::SetItemImage( unsigned nPos, SalMenuItem* pSalMenuItem, const Image& rImage)
+{
+}
+
+void Qt5Menu::SetAccelerator( unsigned nPos, SalMenuItem* pSalMenuItem, const vcl::KeyCode& rKeyCode, const OUString& rKeyName )
+{
+}
+
+void Qt5Menu::GetSystemMenuData( SystemMenuData* pData )
+{
+}
+
+
+Qt5MenuItem::Qt5MenuItem( const SalItemParams* pItemData ) :
+ mnId( pItemData->nId ),
+ mpVCLMenu( pItemData->pMenu ),
+ mpParentMenu( nullptr ),
+ mpSubMenu( nullptr )
+{
+}
+
+Qt5MenuItem::~Qt5MenuItem()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d09b169e4a5047a6eedea57895278c6337d20140
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 3 17:22:08 2018 +0200
Get rid of annoying focus rectangles in start centre
Change-Id: I7ef38b226cd2bab7641638c500341cf7c198026d
diff --git a/vcl/unx/kde5/KDE5SalData.cxx b/vcl/unx/kde5/KDE5SalData.cxx
index f995fa549768..1b0e2071770b 100644
--- a/vcl/unx/kde5/KDE5SalData.cxx
+++ b/vcl/unx/kde5/KDE5SalData.cxx
@@ -45,6 +45,7 @@ void KDE5SalData::initNWF()
pSVData->maNWFData.mbRolloverMenubar = true;
pSVData->maNWFData.mbNoFocusRects = true;
+ pSVData->maNWFData.mbNoFocusRectsForFlatButtons = true;
// Styled menus need additional space
QStyle *style = QApplication::style();
commit 327c17d72a17db8f3ef1cc8a0653726d2045c9fd
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 3 16:45:57 2018 +0200
Render list headers natively
they have somehow odd colour though
Change-Id: I645581cc594ba3e06c4475957565aadc633b9d20
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 92275052013a..070a18c0f57c 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -90,6 +90,9 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Pushbutton:
return (part == ControlPart::Entire) || (part == ControlPart::Focus);
+ case ControlType::ListHeader:
+ return (part == ControlPart::Button);
+
case ControlType::Menubar:
case ControlType::MenuPopup:
case ControlType::Editbox:
@@ -422,6 +425,12 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::PE_IndicatorBranch, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}
+ else if (type == ControlType::ListHeader)
+ {
+ QStyleOptionHeader option;
+ draw(QStyle::CE_HeaderSection, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
else if (type == ControlType::Checkbox)
{
if (part == ControlPart::Entire)
commit 604c918e5d57fba606db1ea20a44503b7f123a4d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Thu May 3 12:03:12 2018 +0200
Use QImage format with premultiplied alpha
as that's what cairo (almost) silently expects
Change-Id: If1ad6f28fcc6fb7ddc2ac4fcec0a31bad512cb2a
diff --git a/vcl/inc/qt5/Qt5Tools.hxx b/vcl/inc/qt5/Qt5Tools.hxx
index c7b47014beb0..d632a5ed8ce5 100644
--- a/vcl/inc/qt5/Qt5Tools.hxx
+++ b/vcl/inc/qt5/Qt5Tools.hxx
@@ -91,6 +91,7 @@ inline sal_uInt16 getFormatBits(QImage::Format eFormat)
case QImage::Format_RGB888:
return 24;
case Qt5_DefaultFormat32:
+ case QImage::Format_ARGB32_Premultiplied:
return 32;
default:
std::abort();
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 13b791943199..92275052013a 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -180,7 +180,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
//if no image, or resized, make a new image
if (!m_image || m_image->size() != widgetRect.size())
{
- m_image.reset(new QImage( widgetRect.width(), widgetRect.height(), QImage::Format_ARGB32 ) );
+ m_image.reset(new QImage( widgetRect.width(), widgetRect.height(), QImage::Format_ARGB32_Premultiplied ) );
}
// Default image color - just once
commit bab968c1198c9d92c56061db5e34490039a61104
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 2 16:42:56 2018 +0200
Native focus rectangles for push buttons
far from perfect, they also hide the button text (but at least focus
frame in contrast colour is visible)
Change-Id: I9a7c2b429ae14b8604f894de64a7328cde6cb270
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index e110c0b04722..13b791943199 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -80,7 +80,6 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
{
switch (type)
{
- case ControlType::Pushbutton:
case ControlType::Tooltip:
case ControlType::Progress:
case ControlType::ListNode:
@@ -88,6 +87,7 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Radiobutton:
case ControlType::Checkbox:
+ case ControlType::Pushbutton:
return (part == ControlPart::Entire) || (part == ControlPart::Focus);
case ControlType::Menubar:
@@ -203,7 +203,10 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
m_image->fill(QApplication::palette().color(QPalette::ToolTipBase).rgb());
break;
case ControlType::Pushbutton:
- m_image->fill(QApplication::palette().color(QPalette::Button).rgb());
+ if ( nControlState & ControlState::FOCUSED )
+ m_image->fill(QApplication::palette().color(QPalette::Highlight).rgb());
+ else
+ m_image->fill(QApplication::palette().color(QPalette::Button).rgb());
break;
case ControlType::Scrollbar:
if ((part == ControlPart::DrawBackgroundVert)
commit c58f097235098604944c01a87596dd3f6a7af402
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed May 2 14:00:01 2018 +0200
Native focus rectangles for radiobuttons
that suffer from the same problem (lack of transparency) as those
of checkboxes
Change-Id: I4bb81c5f95b07e57a7d6cdb86ba4e31ec7660f5a
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 849865641fb1..e110c0b04722 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -81,12 +81,12 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
switch (type)
{
case ControlType::Pushbutton:
- case ControlType::Radiobutton:
case ControlType::Tooltip:
case ControlType::Progress:
case ControlType::ListNode:
return (part == ControlPart::Entire);
+ case ControlType::Radiobutton:
case ControlType::Checkbox:
return (part == ControlPart::Entire) || (part == ControlPart::Focus);
@@ -501,9 +501,18 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
}
else if (type == ControlType::Radiobutton)
{
- QStyleOptionButton option;
- draw( QStyle::CE_RadioButton, &option, m_image.get(),
- vclStateValue2StateFlag(nControlState, value) );
+ if (part == ControlPart::Entire)
+ {
+ QStyleOptionButton option;
+ draw( QStyle::CE_RadioButton, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
+ else if (part == ControlPart::Focus)
+ {
+ QStyleOptionFocusRect option;
+ draw( QStyle::PE_FrameFocusRect, &option, m_image.get(),
+ vclStateValue2StateFlag(nControlState, value) );
+ }
}
else if (type == ControlType::Tooltip)
{
commit 425ea321652aeef3f3f6a2d04674a6c7c0f31031
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 e7075560d55a6a8b44104c7d9775cadaf67dbc49
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);
commit 93d10e07a5c2b95e6820a99ee5254a150623e54a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Fri Apr 27 10:04:14 2018 +0200
Remove IMAGE_BASED_PAINTING dead code
Change-Id: I2d30c61c2a8cbf69e04dd24098c0fffb7dac442d
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 1685a772a88b..59cdd1347fb9 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -157,39 +157,6 @@ namespace
}
}
-#if QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 )
-#define IMAGE_BASED_PAINTING
-#else
-#undef IMAGE_BASED_PAINTING
-#endif
-
-#ifdef IMAGE_BASED_PAINTING
-// There is a small catch with this function, although hopefully only philosophical.
-// Officially Xlib's vcl::Region is an opaque data type, with only functions for manipulating it.
-// However, whoever designed it apparently didn't give it that much thought, as it's impossible
-// to find out what exactly a region actually is (except for really weird ways like XClipBox()
-// and repeated XPointInRegion(), which would be awfully slow). Fortunately, the header file
-// describing the structure actually happens to be installed too, and there's at least one
-// widely used software using it (Compiz). So access the data directly too and assume that
-// everybody who compiles with Qt4 support has Xlib new enough and good enough to support this.
-// In case this doesn't work for somebody, try #include <X11/region.h> instead, or build
-// without IMAGE_BASED_PAINTING (in which case QApplication::setGraphicsSystem( "native" ) may
-// be needed too).
-#include <X11/Xregion.h>
-static QRegion XRegionToQRegion( Region xr )
-{
- QRegion qr;
- for( long i = 0;
- i < xr->numRects;
- ++i )
- {
- BOX& b = xr->rects[ i ];
- qr |= QRect( b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1 ); // x2,y2 is outside, not the bottom-right corner
- }
- return qr;
-}
-#endif
-
bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
const tools::Rectangle& rControlRegion, ControlState nControlState,
const ImplControlValue& value,
commit 2425faba74390a2b3f2a663656d6ee1850e51ace
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Apr 25 15:42:59 2018 +0200
Render tooltips natively
with this, all widgets that used to be rendered natively with kde4
are rendered natively also in kde5
Change-Id: If814b121e928a9d743c74836f000b3230b946caf
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 931b6a2d23b8..1685a772a88b 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -83,7 +83,7 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Pushbutton:
case ControlType::Radiobutton:
case ControlType::Checkbox:
- /*case ControlType::Tooltip:*/
+ case ControlType::Tooltip:
case ControlType::Progress:
case ControlType::ListNode:
return (part == ControlPart::Entire);
@@ -528,12 +528,12 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_RadioButton, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}
- /*else if (type == ControlType::Tooltip)
+ else if (type == ControlType::Tooltip)
{
QStyleOption option;
draw( QStyle::PE_PanelTipLabel, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }*/
+ }
else if (type == ControlType::Frame)
{
lcl_drawFrame( QStyle::PE_Frame, m_image.get(),
commit 6d37b1cb0805182cd335a0b2dc9a71d7c205db84
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Wed Apr 25 15:19:28 2018 +0200
Render scrollbars natively
Change-Id: I7f7e5bb8cf6e7307b0563a9ef84845a99dc54e1e
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 4c5a70a89a77..931b6a2d23b8 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -95,7 +95,7 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Combobox:
case ControlType::Toolbar:
case ControlType::Frame:
- /*case ControlType::Scrollbar:*/
+ case ControlType::Scrollbar:
case ControlType::WindowBackground:
case ControlType::Fixedline:
return true;
@@ -457,7 +457,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
vclStateValue2StateFlag(nControlState, value) );
//m_image->save("/tmp/checkbox.png");
}
- /*else if (type == ControlType::Scrollbar)
+ else if (type == ControlType::Scrollbar)
{
if ((part == ControlPart::DrawBackgroundVert) || (part == ControlPart::DrawBackgroundHorz))
{
@@ -495,7 +495,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
{
returnVal = false;
}
- }*/
+ }
else if (type == ControlType::Spinbox)
{
QStyleOptionSpinBox option;
@@ -857,7 +857,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- /*case ControlType::Scrollbar:
+ case ControlType::Scrollbar:
{
// core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(),
// for the rest also provide the track area (i.e. area not taken by buttons)
@@ -889,7 +889,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
retVal = true;
}
break;
- }*/
+ }
default:
break;
}
@@ -910,7 +910,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
/** Test whether the position is in the native widget.
- If the return value is TRUE, bIsInside contains information whether
+ If the return value is true, bIsInside contains information whether
aPos was or was not inside the native widget specified by the
nType/nPart combination.
*/
@@ -918,15 +918,15 @@ bool KDE5SalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart
const tools::Rectangle& rControlRegion, const Point& rPos,
bool& rIsInside )
{
- /*if ( nType == ControlType::Scrollbar )
+ if ( nType == ControlType::Scrollbar )
{
if( nPart != ControlPart::ButtonUp && nPart != ControlPart::ButtonDown
&& nPart != ControlPart::ButtonLeft && nPart != ControlPart::ButtonRight )
{ // we adjust only for buttons (because some scrollbars have 3 buttons,
// and LO core doesn't handle such scrollbars well)
- return FALSE;
+ return false;
}
- rIsInside = FALSE;
+ rIsInside = false;
bool bHorizontal = ( nPart == ControlPart::ButtonLeft || nPart == ControlPart::ButtonRight );
QRect rect = toQRect( rControlRegion );
QPoint pos( rPos.X(), rPos.Y());
@@ -952,8 +952,8 @@ bool KDE5SalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart
rIsInside = ( control == QStyle::SC_ScrollBarSubLine );
else // DOWN, RIGHT
rIsInside = ( control == QStyle::SC_ScrollBarAddLine );
- return TRUE;
- }*/
+ return true;
+ }
return false;
}
commit e4a3516e8d3145cd4c83b6ed89776a034079b1a1
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 16:45:55 2018 +0200
Render frames and window background natively
Change-Id: I947abe375fc74acbb8628076a0938d1074d1427c
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index bf58a1f6706f..4c5a70a89a77 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -94,9 +94,9 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::MultilineEditbox:
case ControlType::Combobox:
case ControlType::Toolbar:
- /*case ControlType::Frame:
- case ControlType::Scrollbar:
- case ControlType::WindowBackground:*/
+ case ControlType::Frame:
+ /*case ControlType::Scrollbar:*/
+ case ControlType::WindowBackground:
case ControlType::Fixedline:
return true;
@@ -533,7 +533,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
QStyleOption option;
draw( QStyle::PE_PanelTipLabel, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }
+ }*/
else if (type == ControlType::Frame)
{
lcl_drawFrame( QStyle::PE_Frame, m_image.get(),
@@ -545,7 +545,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
else if (type == ControlType::WindowBackground)
{
// Nothing to do - see "Default image color" switch ^^
- }*/
+ }
else if (type == ControlType::Fixedline)
{
QStyleOptionMenuItem option;
@@ -791,7 +791,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- /*case ControlType::Frame:
+ case ControlType::Frame:
{
if( part == ControlPart::Border )
{
@@ -805,7 +805,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
retVal = true;
}
break;
- }*/
+ }
case ControlType::Radiobutton:
{
const int h = QApplication::style()->pixelMetric(QStyle::PM_ExclusiveIndicatorHeight);
commit 431521dffc1df7d0f385ed03dae017ab770f989a
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 16:38:01 2018 +0200
Render toolbars natively
Change-Id: Ib3716fa63dfccce66a6e43ba183820dc15497d07
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 0ead29ea09fd..bf58a1f6706f 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -93,8 +93,8 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Editbox:
case ControlType::MultilineEditbox:
case ControlType::Combobox:
- /*case ControlType::Toolbar:
- case ControlType::Frame:
+ case ControlType::Toolbar:
+ /*case ControlType::Frame:
case ControlType::Scrollbar:
case ControlType::WindowBackground:*/
case ControlType::Fixedline:
@@ -377,7 +377,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_ToolBar, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}
- /*else if ( (type == ControlType::Toolbar)
+ else if ( (type == ControlType::Toolbar)
&& (part == ControlPart::ThumbVert || part == ControlPart::ThumbHorz) )
{ // reduce paint area only to the handle area
const int handleExtend = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
@@ -398,7 +398,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value), rect );
- }*/
+ }
else if (type == ControlType::Editbox || type == ControlType::MultilineEditbox)
{
lcl_drawFrame( QStyle::PE_FrameLineEdit, m_image.get(),
@@ -840,7 +840,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- /*case ControlType::Toolbar:
+ case ControlType::Toolbar:
{
const int nWorH = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
if( part == ControlPart::ThumbHorz )
@@ -857,7 +857,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- case ControlType::Scrollbar:
+ /*case ControlType::Scrollbar:
{
// core can't handle 3-button scrollbars well, so we fix that in hitTestNativeControl(),
// for the rest also provide the track area (i.e. area not taken by buttons)
commit d45867f9723412bce1c6a43538da9ed566391442
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 16:33:45 2018 +0200
Render list items natively
Change-Id: Id8560e3e89d09c44d6b7c7679f4b3f0d5b67a0ee
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 5916869a6aa5..0ead29ea09fd 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -85,7 +85,7 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Checkbox:
/*case ControlType::Tooltip:*/
case ControlType::Progress:
- /*case ControlType::ListNode:*/
+ case ControlType::ListNode:
return (part == ControlPart::Entire);
case ControlType::Menubar:
@@ -439,7 +439,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
break;
}
}
- /*else if (type == ControlType::ListNode)
+ else if (type == ControlType::ListNode)
{
QStyleOption option;
option.state = QStyle::State_Item | QStyle::State_Children;
@@ -449,7 +449,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::PE_IndicatorBranch, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }*/
+ }
else if (type == ControlType::Checkbox)
{
QStyleOptionButton option;
commit 89c920661544b014fbcb6c28f19a8ea3e7969d97
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 15:54:38 2018 +0200
Render menu bar and popups natively
Change-Id: I32554c8d21d8c2454236fcfd367e876049fdfbeb
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index d3c7aa512db4..5916869a6aa5 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -88,16 +88,16 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
/*case ControlType::ListNode:*/
return (part == ControlPart::Entire);
- /*case ControlType::Menubar:
- case ControlType::MenuPopup:*/
+ case ControlType::Menubar:
+ case ControlType::MenuPopup:
case ControlType::Editbox:
case ControlType::MultilineEditbox:
case ControlType::Combobox:
/*case ControlType::Toolbar:
case ControlType::Frame:
case ControlType::Scrollbar:
- case ControlType::WindowBackground:
- case ControlType::Fixedline:*/
+ case ControlType::WindowBackground:*/
+ case ControlType::Fixedline:
return true;
case ControlType::Listbox:
@@ -257,7 +257,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_PushButton, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}
- /*else if (type == ControlType::Menubar)
+ else if (type == ControlType::Menubar)
{
if (part == ControlPart::MenuItem)
{
@@ -377,7 +377,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_ToolBar, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}
- else if ( (type == ControlType::Toolbar)
+ /*else if ( (type == ControlType::Toolbar)
&& (part == ControlPart::ThumbVert || part == ControlPart::ThumbHorz) )
{ // reduce paint area only to the handle area
const int handleExtend = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
@@ -545,7 +545,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
else if (type == ControlType::WindowBackground)
{
// Nothing to do - see "Default image color" switch ^^
- }
+ }*/
else if (type == ControlType::Fixedline)
{
QStyleOptionMenuItem option;
@@ -554,7 +554,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_MenuItem, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }*/
+ }
else if (type == ControlType::Slider && (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea))
{
OSL_ASSERT( value.getType() == ControlType::Slider );
@@ -768,7 +768,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- /*case ControlType::MenuPopup:
+ case ControlType::MenuPopup:
{
int h, w;
switch ( part ) {
@@ -791,7 +791,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- case ControlType::Frame:
+ /*case ControlType::Frame:
{
if( part == ControlPart::Border )
{
commit 17bccf37f8cd356ee06e873e7340ac54645ea4d4
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 15:24:41 2018 +0200
Render progress bar natively
Change-Id: I71148c242ba0933677f7582ec2e36fc4903e2f3e
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index c8682bfd62ee..d3c7aa512db4 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -83,9 +83,9 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Pushbutton:
case ControlType::Radiobutton:
case ControlType::Checkbox:
- /*case ControlType::Tooltip:
+ /*case ControlType::Tooltip:*/
case ControlType::Progress:
- case ControlType::ListNode:*/
+ /*case ControlType::ListNode:*/
return (part == ControlPart::Entire);
/*case ControlType::Menubar:
@@ -573,7 +573,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CC_Slider, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) );
}
- /*else if( type == ControlType::Progress && part == ControlPart::Entire )
+ else if( type == ControlType::Progress && part == ControlPart::Entire )
{
QStyleOptionProgressBarV2 option;
option.minimum = 0;
@@ -584,7 +584,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_ProgressBar, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }*/
+ }
else
{
returnVal = false;
commit b4bc3fb9daf34a9f50b8efcdafa1d7d33efdf98f
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 13:47:30 2018 +0200
Drop duplicate implementation of conversion to QRect
use the one from Qt5Tools class
Change-Id: I4dc33b14fc6ab7fa7c426d6b1a56c299aed62c55
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 1a974bfbf089..c8682bfd62ee 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -71,16 +71,6 @@ void QImage2BitmapBuffer( QImage* pImg, BitmapBuffer* pBuf )
pBuf->mnScanlineSize = pImg->bytesPerLine();
}
-/**
- Convert tools::Rectangle to QRect.
- @param rControlRegion The tools::Rectangle to convert.
- @return The matching QRect
-*/
-QRect region2QRect( const tools::Rectangle& rControlRegion )
-{
- return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
-}
-
KDE5SalGraphics::KDE5SalGraphics()
: SvpSalGraphics()
{
@@ -216,7 +206,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
bool returnVal = true;
- QRect widgetRect = region2QRect(rControlRegion);
+ QRect widgetRect = toQRect(rControlRegion);
//if no image, or resized, make a new image
if (!m_image || m_image->size() != widgetRect.size())
@@ -342,7 +332,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
// is painted after menuitem highlight, otherwise there would be a grey area
assert( value.getType() == ControlType::MenuPopup );
const MenupopupValue* menuVal = static_cast<const MenupopupValue*>(&value);
- QRect menuItemRect( region2QRect( menuVal->maItemRect ));
+ QRect menuItemRect( toQRect( menuVal->maItemRect ));
QRect rect( menuItemRect.topLeft() - widgetRect.topLeft(),
widgetRect.size().expandedTo( menuItemRect.size()));
// checkboxes are always displayed next to images in menus, so are never centered
@@ -619,7 +609,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
{
bool retVal = false;
- QRect boundingRect = region2QRect( controlRegion );
+ QRect boundingRect = toQRect( controlRegion );
QRect contentRect = boundingRect;
QStyleOptionComplex styleOption;
@@ -938,7 +928,7 @@ bool KDE5SalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart
}
rIsInside = FALSE;
bool bHorizontal = ( nPart == ControlPart::ButtonLeft || nPart == ControlPart::ButtonRight );
- QRect rect = region2QRect( rControlRegion );
+ QRect rect = toQRect( rControlRegion );
QPoint pos( rPos.X(), rPos.Y());
// Adjust coordinates to make the widget appear to be at (0,0), i.e. make
// widget and screen coordinates the same. QStyle functions should use screen
commit 85a8c24421777d081539bb3e947207f2a4e3a3a9
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 13:43:14 2018 +0200
Render sliders and spinboxes natively
Change-Id: I307930eca8a82f3153f38362ee8f55cb121707b7
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index baaaa0fbdbb5..1a974bfbf089 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -113,11 +113,11 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
case ControlType::Listbox:
return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
- /*case ControlType::Spinbox:
+ case ControlType::Spinbox:
return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
case ControlType::Slider:
- return (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea);*/
+ return (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea);
default:
break;
@@ -505,7 +505,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
{
returnVal = false;
}
- }
+ }*/
else if (type == ControlType::Spinbox)
{
QStyleOptionSpinBox option;
@@ -531,7 +531,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CC_SpinBox, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }*/
+ }
else if (type == ControlType::Radiobutton)
{
QStyleOptionButton option;
@@ -564,7 +564,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CE_MenuItem, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
- }
+ }*/
else if (type == ControlType::Slider && (part == ControlPart::TrackHorzArea || part == ControlPart::TrackVertArea))
{
OSL_ASSERT( value.getType() == ControlType::Slider );
@@ -583,7 +583,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::CC_Slider, &option, m_image.get(), vclStateValue2StateFlag(nControlState, value) );
}
- else if( type == ControlType::Progress && part == ControlPart::Entire )
+ /*else if( type == ControlType::Progress && part == ControlPart::Entire )
{
QStyleOptionProgressBarV2 option;
option.minimum = 0;
@@ -729,7 +729,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- /*case ControlType::Spinbox:
+ case ControlType::Spinbox:
{
QStyleOptionSpinBox sbo;
sbo.frame = true;
@@ -778,7 +778,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- case ControlType::MenuPopup:
+ /*case ControlType::MenuPopup:
{
int h, w;
switch ( part ) {
@@ -833,7 +833,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
retVal = true;
break;
}
- /* case ControlType::Slider:
+ case ControlType::Slider:
{
const int w = QApplication::style()->pixelMetric(QStyle::PM_SliderLength);
if( part == ControlPart::ThumbHorz )
@@ -850,7 +850,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- case ControlType::Toolbar:
+ /*case ControlType::Toolbar:
{
const int nWorH = QApplication::style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
if( part == ControlPart::ThumbHorz )
commit 3bc2b1009bed4510b890e65d14f1166967f9d2fe
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Apr 24 12:23:58 2018 +0200
Render text edits (single and multiline) natively
also drop deprecated QStyleOptionFrameV3 and ancient code for
Qt < 4.5
Change-Id: I1f7cf92d23eebc032263b25bdf37651e14994c73
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 7a072938743a..baaaa0fbdbb5 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -99,9 +99,9 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
return (part == ControlPart::Entire);
/*case ControlType::Menubar:
- case ControlType::MenuPopup:
+ case ControlType::MenuPopup:*/
case ControlType::Editbox:
- case ControlType::MultilineEditbox:*/
+ case ControlType::MultilineEditbox:
case ControlType::Combobox:
/*case ControlType::Toolbar:
case ControlType::Frame:
@@ -159,23 +159,10 @@ namespace
void lcl_drawFrame( QStyle::PrimitiveElement element, QImage* image, QStyle::State const & state,
QStyle::PixelMetric eLineMetric = QStyle::PM_DefaultFrameWidth )
{
- #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
- QStyleOptionFrameV3 option;
+ QStyleOptionFrame option;
option.frameShape = QFrame::StyledPanel;
option.state = QStyle::State_Sunken;
option.lineWidth = QApplication::style()->pixelMetric( eLineMetric );
- #else
- QStyleOptionFrame option;
-
- QFrame aFrame( nullptr );
- aFrame.setFrameRect( QRect(0, 0, image->width(), image->height()) );
- aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
- aFrame.ensurePolished();
-
- option.initFrom( &aFrame );
- option.lineWidth = aFrame.lineWidth();
- option.midLineWidth = aFrame.midLineWidth();
- #endif
draw(element, &option, image, state);
}
}
@@ -421,12 +408,12 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::PE_IndicatorToolBarHandle, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value), rect );
- }
+ }*/
else if (type == ControlType::Editbox || type == ControlType::MultilineEditbox)
{
lcl_drawFrame( QStyle::PE_FrameLineEdit, m_image.get(),
vclStateValue2StateFlag(nControlState, value));
- }*/
+ }
else if (type == ControlType::Combobox)
{
QStyleOptionComboBox option;
@@ -653,10 +640,10 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
}
break;
- /*case ControlType::Editbox:
+ case ControlType::Editbox:
case ControlType::MultilineEditbox:
{
- QStyleOptionFrameV3 fo;
+ QStyleOptionFrame fo;
fo.frameShape = QFrame::StyledPanel;
fo.state = QStyle::State_Sunken;
fo.lineWidth = QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
@@ -676,7 +663,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
retVal = true;
break;
- }*/
+ }
case ControlType::Checkbox:
if (part == ControlPart::Entire)
{
commit e5ad297e53100a488bde42cdf6ef977931ab6d7d
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Apr 23 15:14:22 2018 +0200
Render listboxes and comboboxes natively
Change-Id: Ia8d46717df43b088bb72d1f937998a64795f663e
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index e686565b46f2..7a072938743a 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -101,19 +101,19 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
/*case ControlType::Menubar:
case ControlType::MenuPopup:
case ControlType::Editbox:
- case ControlType::MultilineEditbox:
+ case ControlType::MultilineEditbox:*/
case ControlType::Combobox:
- case ControlType::Toolbar:
+ /*case ControlType::Toolbar:
case ControlType::Frame:
case ControlType::Scrollbar:
case ControlType::WindowBackground:
- case ControlType::Fixedline:
+ case ControlType::Fixedline:*/
return true;
case ControlType::Listbox:
return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
- case ControlType::Spinbox:
+ /*case ControlType::Spinbox:
return (part == ControlPart::Entire || part == ControlPart::HasBackgroundTexture);
case ControlType::Slider:
@@ -426,7 +426,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
{
lcl_drawFrame( QStyle::PE_FrameLineEdit, m_image.get(),
vclStateValue2StateFlag(nControlState, value));
- }
+ }*/
else if (type == ControlType::Combobox)
{
QStyleOptionComboBox option;
@@ -462,7 +462,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
break;
}
}
- else if (type == ControlType::ListNode)
+ /*else if (type == ControlType::ListNode)
{
QStyleOption option;
option.state = QStyle::State_Item | QStyle::State_Children;
@@ -699,7 +699,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
retVal = true;
}
break;
- /*case ControlType::Combobox:
+ case ControlType::Combobox:
case ControlType::Listbox:
{
QStyleOptionComboBox cbo;
@@ -712,7 +712,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
case ControlPart::Entire:
{
// find out the minimum size that should be used
- // assume contents is a text ling
+ // assume contents is a text line
int nHeight = QApplication::fontMetrics().height();
QSize aContentSize( contentRect.width(), nHeight );
QSize aMinSize = QApplication::style()->
@@ -742,7 +742,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
}
break;
}
- case ControlType::Spinbox:
+ /*case ControlType::Spinbox:
{
QStyleOptionSpinBox sbo;
sbo.frame = true;
commit b1f3feabb1768991619009d9f295efb0757dbb54
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Mon Apr 23 14:39:42 2018 +0200
Render pushbuttons natively
Change-Id: I1a8e82d70841765cad3d5838877489aab4656678
diff --git a/vcl/unx/kde5/KDE5SalGraphics.cxx b/vcl/unx/kde5/KDE5SalGraphics.cxx
index 1556eac7c694..e686565b46f2 100644
--- a/vcl/unx/kde5/KDE5SalGraphics.cxx
+++ b/vcl/unx/kde5/KDE5SalGraphics.cxx
@@ -90,7 +90,7 @@ bool KDE5SalGraphics::IsNativeControlSupported( ControlType type, ControlPart pa
{
switch (type)
{
- /*case ControlType::Pushbutton:*/
+ case ControlType::Pushbutton:
case ControlType::Radiobutton:
case ControlType::Checkbox:
/*case ControlType::Tooltip:
@@ -274,13 +274,13 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
QRegion* localClipRegion = nullptr;
- /*if (type == ControlType::Pushbutton)
+ if (type == ControlType::Pushbutton)
{
QStyleOptionButton option;
draw( QStyle::CE_PushButton, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}
- else if (type == ControlType::Menubar)
+ /*else if (type == ControlType::Menubar)
{
if (part == ControlPart::MenuItem)
{
@@ -473,7 +473,7 @@ bool KDE5SalGraphics::drawNativeControl( ControlType type, ControlPart part,
draw( QStyle::PE_IndicatorBranch, &option, m_image.get(),
vclStateValue2StateFlag(nControlState, value) );
}*/
- if (type == ControlType::Checkbox)
+ else if (type == ControlType::Checkbox)
{
QStyleOptionButton option;
draw( QStyle::CE_CheckBox, &option, m_image.get(),
@@ -638,7 +638,7 @@ bool KDE5SalGraphics::getNativeControlRegion( ControlType type, ControlPart part
switch ( type )
{
- /*// Metrics of the push button
+ // Metrics of the push button
case ControlType::Pushbutton:
if (part == ControlPart::Entire)
{
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list