tdf#130857 qt weld: Introduce QtInstanceToolbar
Introduce QtInstanceToolbar as the native Qt implementation
for weld::Toolbar that uses a QToolBar widget.
This mostly adds the basic structure and lets Qt{,Instance}Builder
create an instance of the class when encountering a
"GtkToolbar" object in a .ui file.
The actual logic for the QtInstanceToolbar methods
still needs to be implemented. Calling them currently
triggers an assert.
Change-Id: I2734e5b931d5cb9608ec4d01222634a8ffada299
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179883
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -41,6 +41,7 @@ $(call gb_CustomTarget_get_target,vcl/qt5) : \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceSpinButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTextView.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceToggleButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceToolbar.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceTreeView.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWidget.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt5/QtInstanceWindow.moc \
|
||||
|
||||
@@ -41,6 +41,7 @@ $(call gb_CustomTarget_get_target,vcl/qt6) : \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceSpinButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTextView.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceToggleButton.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceToolbar.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceTreeView.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWidget.moc \
|
||||
$(gb_CustomTarget_workdir)/vcl/qt6/QtInstanceWindow.moc \
|
||||
|
||||
@@ -127,6 +127,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt5,\
|
||||
vcl/qt5/QtInstanceSpinButton \
|
||||
vcl/qt5/QtInstanceTextView \
|
||||
vcl/qt5/QtInstanceToggleButton \
|
||||
vcl/qt5/QtInstanceToolbar \
|
||||
vcl/qt5/QtInstanceTreeView \
|
||||
vcl/qt5/QtInstanceWidget \
|
||||
vcl/qt5/QtInstanceWindow \
|
||||
|
||||
@@ -126,6 +126,7 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_qt6,\
|
||||
vcl/qt6/QtInstanceSpinButton \
|
||||
vcl/qt6/QtInstanceTextView \
|
||||
vcl/qt6/QtInstanceToggleButton \
|
||||
vcl/qt6/QtInstanceToolbar \
|
||||
vcl/qt6/QtInstanceTreeView \
|
||||
vcl/qt6/QtInstanceWidget \
|
||||
vcl/qt6/QtInstanceWindow \
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
void* pUserData = nullptr) override;
|
||||
virtual std::unique_ptr<weld::Menu> weld_menu(const OUString& rId) override;
|
||||
virtual std::unique_ptr<weld::Popover> weld_popover(const OUString& rId) override;
|
||||
virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString&) override;
|
||||
virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OUString& rId) override;
|
||||
virtual std::unique_ptr<weld::Scrollbar> weld_scrollbar(const OUString&) override;
|
||||
virtual std::unique_ptr<weld::SizeGroup> create_size_group() override;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/* -*- 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 "QtInstanceWidget.hxx"
|
||||
|
||||
#include <QtWidgets/QToolBar>
|
||||
|
||||
class QtInstanceToolbar : public QtInstanceWidget, public virtual weld::Toolbar
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QToolBar* m_pToolBar;
|
||||
|
||||
public:
|
||||
QtInstanceToolbar(QToolBar* pToolBar);
|
||||
|
||||
virtual void set_item_sensitive(const OUString& rIdent, bool bSensitive) override;
|
||||
virtual bool get_item_sensitive(const OUString& rIdent) const override;
|
||||
virtual void set_item_active(const OUString& rIdent, bool bActive) override;
|
||||
virtual bool get_item_active(const OUString& rIdent) const override;
|
||||
virtual void set_menu_item_active(const OUString& rIdent, bool bActive) override;
|
||||
virtual bool get_menu_item_active(const OUString& rIdent) const override;
|
||||
virtual void set_item_menu(const OUString& rIdent, weld::Menu* pMenu) override;
|
||||
virtual void set_item_popover(const OUString& rIdent, weld::Widget* pPopover) override;
|
||||
virtual void set_item_visible(const OUString& rIdent, bool bVisible) override;
|
||||
virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) override;
|
||||
virtual bool get_item_visible(const OUString& rIdent) const 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_tooltip_text(const OUString& rIdent, const OUString& rTip) override;
|
||||
virtual OUString get_item_tooltip_text(const OUString& rIdent) const override;
|
||||
virtual void set_item_icon_name(const OUString& rIdent, const OUString& rIconName) override;
|
||||
virtual void set_item_image_mirrored(const OUString& rIdent, bool bMirrored) override;
|
||||
virtual void set_item_image(const OUString& rIdent,
|
||||
const css::uno::Reference<css::graphic::XGraphic>& rIcon) override;
|
||||
virtual void set_item_image(const OUString& rIdent, VirtualDevice* pDevice) override;
|
||||
|
||||
virtual void insert_item(int pos, const OUString& rId) override;
|
||||
virtual void insert_separator(int pos, const OUString& rId) override;
|
||||
|
||||
virtual int get_n_items() const override;
|
||||
virtual OUString get_item_ident(int nIndex) const override;
|
||||
virtual void set_item_ident(int nIndex, const OUString& rIdent) override;
|
||||
virtual void set_item_label(int nIndex, const OUString& rLabel) override;
|
||||
virtual void set_item_image(int nIndex,
|
||||
const css::uno::Reference<css::graphic::XGraphic>& rIcon) override;
|
||||
virtual void set_item_tooltip_text(int nIndex, const OUString& rTip) override;
|
||||
virtual void set_item_accessible_name(int nIndex, const OUString& rName) override;
|
||||
virtual void set_item_accessible_name(const OUString& rIdent, const OUString& rName) override;
|
||||
|
||||
virtual vcl::ImageType get_icon_size() const override;
|
||||
virtual void set_icon_size(vcl::ImageType eType) override;
|
||||
|
||||
virtual sal_uInt16 get_modifier_state() const override;
|
||||
|
||||
virtual int get_drop_index(const Point& rPoint) const 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/QtInstanceToolbar.hxx"
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <QtWidgets/QSlider>
|
||||
#include <QtWidgets/QSplitter>
|
||||
#include <QtWidgets/QTabWidget>
|
||||
#include <QtWidgets/QToolBar>
|
||||
#include <QtWidgets/QToolButton>
|
||||
#include <QtWidgets/QTreeView>
|
||||
|
||||
@@ -340,6 +341,10 @@ QObject* QtBuilder::makeObject(QObject* pParent, std::u16string_view sName, std:
|
||||
{
|
||||
pObject = new QToolButton(pParentWidget);
|
||||
}
|
||||
else if (sName == u"GtkToolbar")
|
||||
{
|
||||
pObject = new QToolBar(pParentWidget);
|
||||
}
|
||||
else if (sName == u"GtkTreeView")
|
||||
{
|
||||
QTreeView* pTreeView = new QTreeView(pParentWidget);
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <QtInstanceSpinButton.hxx>
|
||||
#include <QtInstanceTextView.hxx>
|
||||
#include <QtInstanceToggleButton.hxx>
|
||||
#include <QtInstanceToolbar.hxx>
|
||||
#include <QtInstanceTreeView.hxx>
|
||||
|
||||
#include <QtWidgets/QToolButton>
|
||||
@@ -405,10 +406,12 @@ std::unique_ptr<weld::Popover> QtInstanceBuilder::weld_popover(const OUString& r
|
||||
return xRet;
|
||||
}
|
||||
|
||||
std::unique_ptr<weld::Toolbar> QtInstanceBuilder::weld_toolbar(const OUString&)
|
||||
std::unique_ptr<weld::Toolbar> QtInstanceBuilder::weld_toolbar(const OUString& rId)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return nullptr;
|
||||
QToolBar* pToolBar = m_xBuilder->get<QToolBar>(rId);
|
||||
std::unique_ptr<weld::Toolbar> xRet(pToolBar ? std::make_unique<QtInstanceToolbar>(pToolBar)
|
||||
: nullptr);
|
||||
return xRet;
|
||||
}
|
||||
|
||||
std::unique_ptr<weld::Scrollbar> QtInstanceBuilder::weld_scrollbar(const OUString&)
|
||||
|
||||
@@ -0,0 +1,192 @@
|
||||
/* -*- 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 <QtInstanceToolbar.hxx>
|
||||
#include <QtInstanceToolbar.moc>
|
||||
|
||||
QtInstanceToolbar::QtInstanceToolbar(QToolBar* pToolBar)
|
||||
: QtInstanceWidget(pToolBar)
|
||||
, m_pToolBar(pToolBar)
|
||||
{
|
||||
assert(m_pToolBar);
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_sensitive(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
bool QtInstanceToolbar::get_item_sensitive(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return false;
|
||||
}
|
||||
void QtInstanceToolbar::set_item_active(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
bool QtInstanceToolbar::get_item_active(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_menu_item_active(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
bool QtInstanceToolbar::get_menu_item_active(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_menu(const OUString&, weld::Menu*)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
void QtInstanceToolbar::set_item_popover(const OUString&, weld::Widget*)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_visible(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_help_id(const OUString&, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
bool QtInstanceToolbar::get_item_visible(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_label(const OUString&, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
OUString QtInstanceToolbar::get_item_label(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return OUString();
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_tooltip_text(const OUString&, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
OUString QtInstanceToolbar::get_item_tooltip_text(const OUString&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return OUString();
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_icon_name(const OUString&, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_image_mirrored(const OUString&, bool)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_image(const OUString&,
|
||||
const css::uno::Reference<css::graphic::XGraphic>&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_image(const OUString&, VirtualDevice*)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::insert_item(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::insert_separator(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
int QtInstanceToolbar::get_n_items() const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return 0;
|
||||
}
|
||||
|
||||
OUString QtInstanceToolbar::get_item_ident(int) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return OUString();
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_ident(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_label(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_image(int, const css::uno::Reference<css::graphic::XGraphic>&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_tooltip_text(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_accessible_name(int, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_item_accessible_name(const OUString&, const OUString&)
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
}
|
||||
|
||||
vcl::ImageType QtInstanceToolbar::get_icon_size() const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return vcl::ImageType::Size32;
|
||||
}
|
||||
|
||||
void QtInstanceToolbar::set_icon_size(vcl::ImageType) { assert(false && "Not implemented yet"); }
|
||||
|
||||
sal_uInt16 QtInstanceToolbar::get_modifier_state() const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int QtInstanceToolbar::get_drop_index(const Point&) const
|
||||
{
|
||||
assert(false && "Not implemented yet");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 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/QtInstanceToolbar.cxx"
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
Reference in New Issue
Block a user