tdf#130857 qt weld: Introduce QtInstanceMenuButton
Add new QtInstanceMenuButton class as the native Qt weld::MenuButton implementation. The actual logic of the class methods still needs to be implemented, they all just trigger an assert when called right now. Create a QToolButton for "GtkMenuButton" objects in .ui files. Let QtInstanceBuilder::weld_menu_button create an instance of that new class and pass the button in the ctor. Change-Id: Ie5ba0bad8e351554323e8f4ec1281b2c5ae8fbc3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178963 Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
This commit is contained in:
@@ -29,6 +29,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLabel.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLevelBar.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceLinkButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceMenuButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceMessageDialog.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceNotebook.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceProgressBar.moc \
|
||||
|
||||
@@ -29,6 +29,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLabel.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLevelBar.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceLinkButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceMenuButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceMessageDialog.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceNotebook.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceProgressBar.moc \
|
||||
|
||||
@@ -115,6 +115,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
|
||||
vcl/qt5/QtInstanceLabel \
|
||||
vcl/qt5/QtInstanceLevelBar \
|
||||
vcl/qt5/QtInstanceLinkButton \
|
||||
vcl/qt5/QtInstanceMenuButton \
|
||||
vcl/qt5/QtInstanceMessageDialog \
|
||||
vcl/qt5/QtInstanceNotebook \
|
||||
vcl/qt5/QtInstanceProgressBar \
|
||||
|
||||
@@ -114,6 +114,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
|
||||
vcl/qt6/QtInstanceLabel \
|
||||
vcl/qt6/QtInstanceLevelBar \
|
||||
vcl/qt6/QtInstanceLinkButton \
|
||||
vcl/qt6/QtInstanceMenuButton \
|
||||
vcl/qt6/QtInstanceMessageDialog \
|
||||
vcl/qt6/QtInstanceNotebook \
|
||||
vcl/qt6/QtInstanceProgressBar \
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
weld_scrolled_window(const OUString& rId, bool bUserManagedScrolling = false) override;
|
||||
virtual std::unique_ptr<weld::Notebook> weld_notebook(const OUString& rId) override;
|
||||
virtual std::unique_ptr<weld::Button> weld_button(const OUString& rId) override;
|
||||
virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OUString&) override;
|
||||
virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OUString& rId) override;
|
||||
virtual std::unique_ptr<weld::MenuToggleButton>
|
||||
weld_menu_toggle_button(const OUString&) override;
|
||||
virtual std::unique_ptr<weld::LinkButton> weld_link_button(const OUString& rId) override;
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* 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 "QtInstanceToggleButton.hxx"
|
||||
|
||||
class QtInstanceMenuButton : public QtInstanceToggleButton, public virtual weld::MenuButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtInstanceMenuButton(QAbstractButton* pButton);
|
||||
|
||||
virtual void insert_item(int pos, const OUString& rId, const OUString& rStr,
|
||||
const OUString* pIconName, VirtualDevice* pImageSurface,
|
||||
TriState eCheckRadioFalse) override;
|
||||
|
||||
virtual void insert_separator(int pos, const OUString& rId) override;
|
||||
virtual void remove_item(const OUString& rId) override;
|
||||
virtual void clear() override;
|
||||
virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override;
|
||||
virtual void set_item_active(const OUString& rIdent, bool bActive) override;
|
||||
virtual void set_item_label(const OUString& rIdent, const OUString& rLabel) override;
|
||||
virtual OUString get_item_label(const OUString& rIdent) const override;
|
||||
virtual void set_item_visible(const OUString& rIdent, bool bVisible) override;
|
||||
|
||||
virtual void set_popover(weld::Widget* pPopover) override;
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -0,0 +1,12 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* 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 "../qt5/QtInstanceMenuButton.hxx"
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -316,7 +316,7 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, std:
|
||||
{
|
||||
pObject = new QPlainTextEdit(pParentWidget);
|
||||
}
|
||||
else if (sName == u"GtkToggleButton")
|
||||
else if (sName == u"GtkToggleButton" || sName == u"GtkMenuButton")
|
||||
{
|
||||
pObject = new QToolButton(pParentWidget);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <QtInstanceLevelBar.hxx>
|
||||
#include <QtInstanceLinkButton.hxx>
|
||||
#include <QtInstanceIconView.hxx>
|
||||
#include <QtInstanceMenuButton.hxx>
|
||||
#include <QtInstanceMessageDialog.hxx>
|
||||
#include <QtInstanceNotebook.hxx>
|
||||
#include <QtInstanceProgressBar.hxx>
|
||||
@@ -204,10 +205,12 @@ std::unique_ptr<weld::Button> QtInstanceBuilder::weld_button(const OUString& rId
|
||||
return xRet;
|
||||
}
|
||||
|
||||
std::unique_ptr<weld::MenuButton> QtInstanceBuilder::weld_menu_button(const OUString&)
|
||||
std::unique_ptr<weld::MenuButton> QtInstanceBuilder::weld_menu_button(const OUString& rId)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return nullptr;
|
||||
QAbstractButton* pButton = m_xBuilder->get<QAbstractButton>(rId);
|
||||
std::unique_ptr<weld::MenuButton> xRet(pButton ? std::make_unique<QtInstanceMenuButton>(pButton)
|
||||
: nullptr);
|
||||
return xRet;
|
||||
}
|
||||
|
||||
std::unique_ptr<weld::MenuToggleButton> QtInstanceBuilder::weld_menu_toggle_button(const OUString&)
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* 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 <QtInstanceMenuButton.hxx>
|
||||
#include <QtInstanceMenuButton.moc>
|
||||
|
||||
QtInstanceMenuButton::QtInstanceMenuButton(QAbstractButton* pButton)
|
||||
: QtInstanceToggleButton(pButton)
|
||||
{
|
||||
assert(pButton);
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::insert_item(int, const OUString&, const OUString&, const OUString*,
|
||||
VirtualDevice*, TriState)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::insert_separator(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::remove_item(const OUString&) { assert(false && "Not implemented yet"); }
|
||||
|
||||
void QtInstanceMenuButton::clear() { assert(false && "Not implemented yet"); }
|
||||
|
||||
void QtInstanceMenuButton::set_item_sensitive(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::set_item_active(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::set_item_label(const OUString&, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
OUString QtInstanceMenuButton::get_item_label(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return OUString();
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::set_item_visible(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceMenuButton::set_popover(weld::Widget*) { assert(false && "Not implemented yet"); }
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -0,0 +1,12 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* 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 "../qt5/QtInstanceMenuButton.cxx"
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
Reference in New Issue
Block a user