Mercurial > octave-nkf
comparison libgui/src/history-dockwidget.cc @ 16057:c3057d80cf91
Created common octave_dock_widget class
* octave_dock_widget.h : New class octave_dock_widget with common dock widget
methods, slots and signals
* file_editor_interface.h: Now inherit from octave_dock_widget, removed common
dock widget code
* file_editor.h: Now inherit from octave_dock_widget, removed common
dock widget code
* file_editor.cc: Now inherit from octave_dock_widget, removed common
dock widget code
* files_dockwidget.h: Now inherit from octave_dock_widget, removed common
dock widget code
* files_dockwidget.cc: Now inherit from octave_dock_widget, removed common
dock widget code
* history_dockwidget.h: Now inherit from octave_dock_widget, removed common
dock widget code
* history_dockwidget.cc: Now inherit from octave_dock_widget, removed common
dock widget methods
* terminal_dockwidget.h: Now inherit from octave_dock_widget, removed common
dock widget code
* terminal_dockwidget.cc: Now inherit from octave_dock_widget, removed common
dock widget code
* module.mk: Added octave_dock_widget
author | Richard Crozier <richard.crozier@yahoo.co.uk> |
---|---|
date | Wed, 06 Feb 2013 21:45:04 +0000 |
parents | 80e99730e5d4 |
children | 0486a29d780f |
comparison
equal
deleted
inserted
replaced
16056:f4f0aea29b21 | 16057:c3057d80cf91 |
---|---|
35 | 35 |
36 #include "history-dockwidget.h" | 36 #include "history-dockwidget.h" |
37 #include "octave-link.h" | 37 #include "octave-link.h" |
38 | 38 |
39 history_dock_widget::history_dock_widget (QWidget * p) | 39 history_dock_widget::history_dock_widget (QWidget * p) |
40 : QDockWidget (p) | 40 : octave_dock_widget (p) |
41 { | 41 { |
42 setObjectName ("HistoryDockWidget"); | 42 setObjectName ("HistoryDockWidget"); |
43 construct (); | 43 construct (); |
44 } | 44 } |
45 | 45 |
69 vbox_layout->addWidget (_filter_line_edit); | 69 vbox_layout->addWidget (_filter_line_edit); |
70 vbox_layout->setMargin (2); | 70 vbox_layout->setMargin (2); |
71 | 71 |
72 widget ()->setLayout (vbox_layout); | 72 widget ()->setLayout (vbox_layout); |
73 | 73 |
74 connect (_filter_line_edit, | 74 connect (_filter_line_edit, SIGNAL (textEdited (QString)), |
75 SIGNAL (textEdited (QString)), | 75 &_sort_filter_proxy_model, SLOT (setFilterWildcard (QString))); |
76 &_sort_filter_proxy_model, | |
77 SLOT (setFilterWildcard (QString))); | |
78 | 76 |
79 connect (_history_list_view, | 77 connect (_history_list_view, SIGNAL (doubleClicked (QModelIndex)), |
80 SIGNAL (doubleClicked (QModelIndex)), | 78 this, SLOT (handle_double_click (QModelIndex))); |
81 this, | |
82 SLOT (handle_double_click (QModelIndex))); | |
83 | |
84 connect (this, | |
85 SIGNAL (visibilityChanged (bool)), | |
86 this, | |
87 SLOT (handle_visibility_changed (bool))); | |
88 | |
89 // topLevelChanged is emitted when floating property changes (floating = true) | |
90 connect (this, SIGNAL (topLevelChanged(bool)), this, SLOT(top_level_changed(bool))); | |
91 | 79 |
92 _update_history_model_timer.setInterval (200); | 80 _update_history_model_timer.setInterval (200); |
93 _update_history_model_timer.setSingleShot (true); | 81 _update_history_model_timer.setSingleShot (true); |
94 | 82 |
95 connect (&_update_history_model_timer, | 83 connect (&_update_history_model_timer, |
140 { | 128 { |
141 emit command_double_clicked (modelIndex.data().toString()+"\n"); | 129 emit command_double_clicked (modelIndex.data().toString()+"\n"); |
142 } | 130 } |
143 | 131 |
144 void | 132 void |
145 history_dock_widget::handle_visibility_changed (bool visible) | |
146 { | |
147 if (visible) | |
148 emit active_changed (true); | |
149 } | |
150 | |
151 void | |
152 history_dock_widget::request_history_model_update () | 133 history_dock_widget::request_history_model_update () |
153 { | 134 { |
154 octave_link::post_event (this, &history_dock_widget::update_history_callback); | 135 octave_link::post_event (this, &history_dock_widget::update_history_callback); |
155 } | 136 } |
156 | 137 |
157 void | 138 void |
158 history_dock_widget::reset_model () | 139 history_dock_widget::reset_model () |
159 { | 140 { |
160 _history_model->setStringList (QStringList ()); | 141 _history_model->setStringList (QStringList ()); |
161 } | |
162 | |
163 void | |
164 history_dock_widget::closeEvent (QCloseEvent *e) | |
165 { | |
166 emit active_changed (false); | |
167 QDockWidget::closeEvent (e); | |
168 } | |
169 | |
170 // slot for signal that is emitted when floating property changes | |
171 void | |
172 history_dock_widget::top_level_changed (bool floating) | |
173 { | |
174 if(floating) | |
175 { | |
176 setWindowFlags(Qt::Window); // make a window from the widget when floating | |
177 show(); // make it visible again since setWindowFlags hides it | |
178 } | |
179 } | 142 } |
180 | 143 |
181 void | 144 void |
182 history_dock_widget::update_history_callback (void) | 145 history_dock_widget::update_history_callback (void) |
183 { | 146 { |