Some more refactoring - further abstracting layout view from container widget

This commit is contained in:
Matthias Koefferlein
2022-09-03 01:48:50 +02:00
parent ec9f91b3d4
commit f788818d12
28 changed files with 424 additions and 373 deletions
@@ -413,15 +413,7 @@ LayoutViewBase::finish ()
{
// if we're the root dispatcher initialize the menu and build the context menus. No other menus are built so far.
if (dispatcher () == this) {
#if defined(HAVE_QT)
set_menu_parent_widget (widget ());
init_menu ();
if (widget ()) {
menu ()->build (0, 0);
}
#else
init_menu ();
#endif
}
}
@@ -3457,14 +3449,6 @@ LayoutViewBase::box () const
return mp_canvas->viewport ().box ();
}
#if defined(HAVE_QT)
QWidget *
LayoutViewBase::widget ()
{
return 0;
}
#endif
LayoutView *
LayoutViewBase::get_ui ()
{
+2 -16
View File
@@ -1662,10 +1662,6 @@ public:
/**
* @brief Gets the canvas object (where the layout is drawn and view objects are placed)
*
* This method intentionally delivers the ViewObjectWidget, not the
* LayoutCanvas to emphasize that the LayoutCanvas object shall not
* be modified.
*/
lay::LayoutCanvas *canvas ()
{
@@ -1690,7 +1686,7 @@ public:
}
/**
* @brief Gets the hierarchy panel
* @brief Gets the editor options page
*/
virtual lay::EditorOptionsPages *editor_options_pages ()
{
@@ -1863,9 +1859,6 @@ public:
/**
* @brief Get the Drawings interface
*
* Although the Drawings interface is implemented by LayoutCanvas,
* it is a different interface from ViewObjectWidget.
*/
lay::Drawings *drawings ()
{
@@ -2647,13 +2640,6 @@ public:
virtual void deactivate_all_browsers ();
#if defined(HAVE_QT)
/**
* @brief Gets the QWidget interface
*/
virtual QWidget *widget ();
#endif
/**
* @brief Gets the LayoutView interface
*/
@@ -2866,9 +2852,9 @@ protected:
void free_resources ();
void shutdown ();
void finish ();
void init_menu ();
virtual void finish ();
virtual tl::Color default_background_color ();
virtual void do_set_background_color (tl::Color color, tl::Color contrast);
virtual void do_paste ();
+3 -3
View File
@@ -216,8 +216,8 @@ ViewService::set_cursor (lay::Cursor::cursor_shape cursor)
class ViewObjectQWidget : public QWidget
{
public:
ViewObjectQWidget (ViewObjectUI *view)
: QWidget (), mp_view (view)
ViewObjectQWidget (QWidget *parent, ViewObjectUI *view)
: QWidget (parent), mp_view (view)
{
// .. nothing yet ..
}
@@ -529,7 +529,7 @@ ViewObjectUI::init_ui (QWidget *parent)
tl_assert (parent != 0);
tl_assert (mp_widget == 0);
mp_widget = new ViewObjectQWidget (this);
mp_widget = new ViewObjectQWidget (parent, this);
mp_widget->setMouseTracking (true);
mp_widget->setAcceptDrops (true);
}