26 #if defined (HAVE_CONFIG_H)
30 #include <QApplication>
36 #include <QVBoxLayout>
53 setStatusTip (tr (
"Browse and search the command history."));
70 lst.append (hist_entry);
74 bool at_bottom = scroll_bar->maximum () - scroll_bar->value () < 1;
100 for (
int i = 0; i <
m_filter->count (); i++)
101 mru.append (
m_filter->itemText (i));
111 QString text =
m_filter->currentText ();
112 int index =
m_filter->findText (text);
154 if (index.isValid () && index.column () == 0)
158 menu.addAction (rmgr.
icon (
"edit-copy"), tr (
"Copy"),
this,
160 menu.addAction (tr (
"Evaluate"),
this,
162 menu.addAction (rmgr.
icon (
"document-new"), tr (
"Create script"),
this,
166 menu.addAction (tr (
"Hide filter"),
this,
169 menu.addAction (tr (
"Show filter"),
this,
184 QModelIndexList rows = selectionModel->selectedRows ();
185 bool prev_valid_row =
false;
186 for (
auto it = rows.begin (); it != rows.end (); it++)
188 if ((*it).isValid ())
192 text += (*it).data ().toString ();
193 prev_valid_row =
true;
196 QApplication::clipboard ()->setText (text);
202 QModelIndexList rows = selectionModel->selectedRows ();
203 for (
auto it = rows.begin () ; it != rows.end (); it++)
205 if ((*it).isValid ())
214 QModelIndexList rows = selectionModel->selectedRows ();
216 bool prev_valid_row =
false;
217 for (
auto it = rows.begin (); it != rows.end (); it++)
219 if ((*it).isValid ())
223 text += (*it).data ().toString ();
224 prev_valid_row =
true;
228 if (text.length () > 0)
244 if (
m_filter->lineEdit ()->hasFocus ()
245 &&
m_filter->lineEdit ()->hasSelectedText ())
247 QClipboard *clipboard = QApplication::clipboard ();
248 clipboard->setText (
m_filter->lineEdit ()->selectedText ());
254 if (
m_filter->lineEdit ()->hasFocus ())
256 QClipboard *clipboard = QApplication::clipboard ();
257 QString str = clipboard->text ();
258 if (str.length () > 0)
259 m_filter->lineEdit ()->insert (str);
265 if (
m_filter->lineEdit ()->hasFocus ())
266 m_filter->lineEdit ()->selectAll ();
292 (tr (
"Double-click a command to transfer it to the Command Window."));
299 m_filter->setToolTip (tr (
"Enter text to filter the command history"));
302 m_filter->setInsertPolicy (QComboBox::NoInsert);
304 (QComboBox::AdjustToMinimumContentsLengthWithIcon);
305 QSizePolicy sizePol (QSizePolicy::Expanding, QSizePolicy::Preferred);
307 m_filter->completer ()->setCaseSensitivity (Qt::CaseSensitive);
317 QHBoxLayout *filter_layout =
new QHBoxLayout ();
318 filter_layout->addWidget (filter_label);
320 filter_layout->addWidget (
m_filter);
321 filter_layout->setMargin(0);
324 QVBoxLayout *hist_layout =
new QVBoxLayout ();
328 hist_layout->setMargin (2);
329 hist_layout->setSpacing (0);
330 widget ()->setLayout (hist_layout);
348 connect (
m_filter, &QComboBox::editTextChanged,
350 &QSortFilterProxyModel::setFilterWildcard);
353 connect (
m_filter->lineEdit (), &QLineEdit::editingFinished,
364 QFont font = QFont ();
366 font.setStyleHint (QFont::TypeWriter);
Base class for Octave interfaces that use Qt.
resource_manager & get_resource_manager(void)
void handle_contextmenu_evaluate(bool flag)
QStringListModel * m_history_model
Stores the current history_model.
QCheckBox * m_filter_checkbox
void set_history(const QStringList &hist)
void handle_contextmenu_filter(void)
void ctxMenu(const QPoint &pos)
void set_filter_focus(bool focus)
void handle_contextmenu_create_script(bool flag)
QSortFilterProxyModel m_sort_filter_proxy_model
void pasteClipboard(void)
void command_double_clicked(const QString &command)
Signal emitted whenever the user double-clicks a command in the history.
void append_history(const QString &hist_entry)
void filter_activate(bool enable)
void command_create_script(const QString &commands)
Signal emitted whenever the user selects commands and chooses "Create script" from the popup menu.
void update_filter_history(void)
void handle_contextmenu_copy(bool flag)
QListView * m_history_list_view
virtual void handle_visibility(bool visible)
void notice_settings(const gui_settings *)
void handle_double_click(QModelIndex modelIndex)
QWidget * m_filter_widget
gui_settings * get_settings(void) const
QIcon icon(const QString &icon_name, bool octave_only=false, const QString &icon_alt_name=QString())
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
const gui_pref cs_font_size("terminal/fontSize", QVariant(10))
const gui_pref cs_font("terminal/fontName", QVariant())
const gui_pref global_mono_font("monospace_font", global_font_family)
const gui_pref hw_filter_active("history_dock_widget/filter_active", QVariant(false))
const gui_pref hw_filter_shown("history_dock_widget/filter_shown", QVariant(true))
const gui_pref hw_mru_list("history_dock_widget/mru_list", QVariant())
static uint32_t state[624]