Mercurial > octave
changeset 31693:88119be1f926
eliminate some unnecessary uses of base_qobject
* dw-main-window.h, dw-main-window.cc (dw_main_window::m_octave_qobj):
Delete unused data member.
(dw_main_window::dw_main_window): Eliminate base_qobject argument.
Change all uses.
* octave-dock-widget.h, octave-dock-widget.cc
(octave_label_widget::m_octave_qobj): Delete unused data member.
(label_dock_widget::label_dock_widget): Eliminate base_qobject
argument. Change all uses.
(octave_dock_widget::m_octave_qobj): New data member.
(octave_dock_widget::octave_dock_widget): Initialize it here instead
of passing base_qobject argument to label_dock_widget base class
constructor.
* variable-editor.h, variable-editor.cc
(variable_dock_widget::variable_dock_widget,
variable_editor_stack::variable_editor_stack,
variable_editor_view::variable_editor_view): Eliminate base_qobject
argument. Change all uses.
(variable_editor_stack::m_octave_qobj): Delete unused data member.
(variable_editor_view::m_octave_qobj): Delete unused data member.
* documentation.h, documentation.cc (documentation::documentation):
Eliminate base_qobject argument. Change all uses.
(documentation::m_octave_qobj): Delete unused data member.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 25 Dec 2022 15:19:22 -0500 |
parents | 2422fb7f1e6c |
children | 5629d97c174f |
files | libgui/src/documentation-dock-widget.cc libgui/src/documentation.cc libgui/src/documentation.h libgui/src/dw-main-window.cc libgui/src/dw-main-window.h libgui/src/octave-dock-widget.cc libgui/src/octave-dock-widget.h libgui/src/variable-editor.cc libgui/src/variable-editor.h |
diffstat | 9 files changed, 33 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/documentation-dock-widget.cc Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/documentation-dock-widget.cc Sun Dec 25 15:19:22 2022 -0500 @@ -36,7 +36,7 @@ documentation_dock_widget::documentation_dock_widget (QWidget *p, base_qobject& oct_qobj) : octave_dock_widget ("DocumentationDockWidget", p, oct_qobj), - m_docs (new documentation (this, oct_qobj)) + m_docs (new documentation (this)) { set_title (tr ("Documentation")); setStatusTip (tr ("See the documentation for help."));
--- a/libgui/src/documentation.cc Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/documentation.cc Sun Dec 25 15:19:22 2022 -0500 @@ -49,6 +49,7 @@ #include <QMessageBox> #include <QTabWidget> #include <QTimer> +#include <QWheelEvent> #include <QVBoxLayout> #include "documentation.h" @@ -57,7 +58,6 @@ #include "gui-preferences-dc.h" #include "gui-preferences-sc.h" #include "gui-settings.h" -#include "octave-qobject.h" #include "defaults.h" #include "file-ops.h" @@ -67,9 +67,9 @@ // The documentation splitter, which is the main widget // of the doc dock widget - documentation::documentation (QWidget *p, base_qobject& oct_qobj) + documentation::documentation (QWidget *p) : QSplitter (Qt::Horizontal, p), - m_octave_qobj (oct_qobj), m_doc_widget (this), + m_doc_widget (this), m_tool_bar (new QToolBar (this)), m_query_string (QString ()), m_indexed (false),
--- a/libgui/src/documentation.h Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/documentation.h Sun Dec 25 15:19:22 2022 -0500 @@ -39,7 +39,6 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class base_qobject; class documentation; class documentation_bookmarks; @@ -99,7 +98,7 @@ public: - documentation (QWidget *parent, base_qobject& oct_qobj); + documentation (QWidget *parent); ~documentation (void); /*! @@ -160,8 +159,6 @@ //! Select all occurrences of a string in the doc browser void select_all_occurrences (const QString& text); - base_qobject& m_octave_qobj; - QHelpEngine *m_help_engine; QString m_internal_search; documentation_browser *m_doc_browser;
--- a/libgui/src/dw-main-window.cc Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/dw-main-window.cc Sun Dec 25 15:19:22 2022 -0500 @@ -33,17 +33,17 @@ #endif #include <QDockWidget> +#include <QEvent> #include <QMenu> #include "dw-main-window.h" #include "gui-preferences-sc.h" #include "gui-settings.h" -#include "octave-qobject.h" OCTAVE_BEGIN_NAMESPACE(octave) - dw_main_window::dw_main_window (base_qobject& oct_qobj, QWidget *p) - : QMainWindow (p), m_octave_qobj (oct_qobj) + dw_main_window::dw_main_window (QWidget *p) + : QMainWindow (p) { gui_settings settings;
--- a/libgui/src/dw-main-window.h Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/dw-main-window.h Sun Dec 25 15:19:22 2022 -0500 @@ -30,15 +30,13 @@ OCTAVE_BEGIN_NAMESPACE(octave) - class base_qobject; - class dw_main_window : public QMainWindow { Q_OBJECT public: - dw_main_window (base_qobject& oct_qboj, QWidget *parent = nullptr); + dw_main_window (QWidget *parent = nullptr); ~dw_main_window (void) = default; @@ -74,8 +72,6 @@ QAction * add_action (QMenu *menu, const QIcon& icon, const QString& text, const char *member, QWidget *receiver); - base_qobject& m_octave_qobj; - QList<QDockWidget *> m_dw_list; QAction *m_close_action;
--- a/libgui/src/octave-dock-widget.cc Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/octave-dock-widget.cc Sun Dec 25 15:19:22 2022 -0500 @@ -49,9 +49,9 @@ OCTAVE_BEGIN_NAMESPACE(octave) - label_dock_widget::label_dock_widget (QWidget *p, base_qobject& oct_qobj) - : QDockWidget (p), m_octave_qobj (oct_qobj), - m_default_float_button (nullptr), m_default_close_button (nullptr) + label_dock_widget::label_dock_widget (QWidget *p) + : QDockWidget (p), m_default_float_button (nullptr), + m_default_close_button (nullptr) { QStyle *st = style (); m_icon_size = 0.75*st->pixelMetric (QStyle::PM_SmallIconSize); @@ -191,7 +191,8 @@ octave_dock_widget::octave_dock_widget (const QString& obj_name, QWidget *p, base_qobject& oct_qobj) - : label_dock_widget (p, oct_qobj), m_adopted (false), + : label_dock_widget (p), m_octave_qobj (oct_qobj), + m_main_window (nullptr), m_adopted (false), m_custom_style (false), m_focus_follows_mouse (false), m_recent_float_geom (), m_recent_dock_geom (), m_waiting_for_mouse_button_release (false)
--- a/libgui/src/octave-dock-widget.h Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/octave-dock-widget.h Sun Dec 25 15:19:22 2022 -0500 @@ -46,7 +46,7 @@ public: - label_dock_widget (QWidget *p, base_qobject& oct_qobj); + label_dock_widget (QWidget *p); ~label_dock_widget (void) = default; @@ -69,8 +69,6 @@ protected: - base_qobject& m_octave_qobj; - int m_icon_size; QWidget *m_title_widget; QToolButton *m_dock_button; @@ -163,6 +161,12 @@ void set_focus_predecessor (void); void store_geometry (void); + protected: + + base_qobject& m_octave_qobj; + + private: + //! Stores the parent, since we are reparenting to 0. main_window *m_main_window;
--- a/libgui/src/variable-editor.cc Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/variable-editor.cc Sun Dec 25 15:19:22 2022 -0500 @@ -84,9 +84,8 @@ // Variable dock widget - variable_dock_widget::variable_dock_widget (QWidget *p, - base_qobject& oct_qobj) - : label_dock_widget (p, oct_qobj) + variable_dock_widget::variable_dock_widget (QWidget *p) + : label_dock_widget (p) // See Octave bug #53807 and https://bugreports.qt.io/browse/QTBUG-44813 #if (QT_VERSION >= 0x050302) && (QT_VERSION <= QTBUG_44813_FIX_VERSION) , m_waiting_for_mouse_move (false) @@ -365,10 +364,8 @@ // Variable editor stack - variable_editor_stack::variable_editor_stack (QWidget *p, - base_qobject& oct_qobj) - : QStackedWidget (p), m_octave_qobj (oct_qobj), - m_edit_view (new variable_editor_view (this, m_octave_qobj)) + variable_editor_stack::variable_editor_stack (QWidget *p) + : QStackedWidget (p), m_edit_view (new variable_editor_view (this)) { setFocusPolicy (Qt::StrongFocus); @@ -528,9 +525,8 @@ // Custom editable variable table view - variable_editor_view::variable_editor_view (QWidget *p, - base_qobject& oct_qobj) - : QTableView (p), m_octave_qobj (oct_qobj), m_var_model (nullptr) +variable_editor_view::variable_editor_view (QWidget *p) + : QTableView (p), m_var_model (nullptr) { setWordWrap (false); setContextMenuPolicy (Qt::CustomContextMenu); @@ -1096,7 +1092,7 @@ variable_editor::variable_editor (QWidget *p, base_qobject& oct_qobj) : octave_dock_widget ("VariableEditor", p, oct_qobj), - m_main (new dw_main_window (oct_qobj)), + m_main (new dw_main_window ()), m_tool_bar (new QToolBar (m_main)), m_default_width (30), m_default_height (100), @@ -1228,8 +1224,7 @@ return; } - variable_dock_widget *page - = new variable_dock_widget (this, m_octave_qobj); + variable_dock_widget *page = new variable_dock_widget (this); page->setObjectName (name); m_main->addDockWidget (Qt::LeftDockWidgetArea, page); @@ -1256,8 +1251,7 @@ page, SLOT (refloat ()), Qt::QueuedConnection); #endif - variable_editor_stack *stack - = new variable_editor_stack (page, m_octave_qobj); + variable_editor_stack *stack = new variable_editor_stack (page); stack->setObjectName (name); page->setWidget (stack);
--- a/libgui/src/variable-editor.h Sun Dec 25 12:46:53 2022 -0500 +++ b/libgui/src/variable-editor.h Sun Dec 25 15:19:22 2022 -0500 @@ -57,7 +57,7 @@ public: - variable_dock_widget (QWidget *p, base_qobject& oct_qobj); + variable_dock_widget (QWidget *p); ~variable_dock_widget (void) = default; @@ -130,7 +130,7 @@ public: - variable_editor_stack (QWidget *p, base_qobject& oct_qobj); + variable_editor_stack (QWidget *p); ~variable_editor_stack (void) = default; @@ -161,8 +161,6 @@ QTextEdit * make_disp_view (QWidget *parent); - base_qobject& m_octave_qobj; - variable_editor_view *m_edit_view; QTextEdit *m_disp_view; @@ -174,7 +172,7 @@ public: - variable_editor_view (QWidget *p, base_qobject& oct_qobj); + variable_editor_view (QWidget *p); ~variable_editor_view (void) = default; @@ -220,8 +218,6 @@ void add_edit_actions (QMenu *menu, const QString& qualifier_string); - base_qobject& m_octave_qobj; - variable_editor_model *m_var_model; };