Mercurial > hg > octave-nkf
changeset 15984:1eb3c67139f6
Add full-length-name tool tip to editor file tab when name is not full length.
* file-editor-tab.cc (file_editor_tab::update_window_title): Add and construct
tooltip variable then signal file_name_changed() with second input string.
* file-editor-tab.h (file_editor_tab::file_name_changed): Add second input
string to accommodate tool tip.
* file-editor.cc, file-editor.h (file_editor::handle_file_name_changed): Add
second input string and set tool tip via Qt setTabToolTip() member function.
author | Daniel J Sebald <daniel.sebald@ieee.org> |
---|---|
date | Sun, 27 Jan 2013 18:44:53 -0600 |
parents | 200dab2eecd4 |
children | f75ffcc82acb |
files | libgui/src/m-editor/file-editor-tab.cc libgui/src/m-editor/file-editor-tab.h libgui/src/m-editor/file-editor.cc libgui/src/m-editor/file-editor.h |
diffstat | 4 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc +++ b/libgui/src/m-editor/file-editor-tab.cc @@ -658,6 +658,7 @@ file_editor_tab::update_window_title (bool modified) { QString title (""); + QString tooltip (""); if (_file_name.isEmpty () || _file_name.at (_file_name.count () - 1) == '/') title = tr("<unnamed>"); else @@ -668,15 +669,16 @@ { QFileInfo file(_file_name); title = file.fileName(); + tooltip = _file_name; } } if ( modified ) { - emit file_name_changed (title.prepend("* ")); + emit file_name_changed (title.prepend("* "), tooltip); } else - emit file_name_changed (title); + emit file_name_changed (title, tooltip); } void
--- a/libgui/src/m-editor/file-editor-tab.h +++ b/libgui/src/m-editor/file-editor-tab.h @@ -86,7 +86,7 @@ void file_has_changed (const QString& fileName); signals: - void file_name_changed (const QString& fileName); + void file_name_changed (const QString& fileName, const QString& toolTip); void editor_state_changed (bool copy_available, const QString& fileName); void tab_remove_request (); void add_filename_to_list (const QString& fileName);
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -423,7 +423,7 @@ } void -file_editor::handle_file_name_changed (const QString& fileName) +file_editor::handle_file_name_changed (const QString& fileName, const QString& toolTip) { QObject *fileEditorTab = sender(); if (fileEditorTab) @@ -433,6 +433,7 @@ if (_tab_widget->widget (i) == fileEditorTab) { _tab_widget->setTabText (i, fileName); + _tab_widget->setTabToolTip (i, toolTip); } } } @@ -766,8 +767,8 @@ _tab_widget->addTab (f, fn); // Signals from the file editor_tab - connect (f, SIGNAL (file_name_changed (const QString&)), - this, SLOT (handle_file_name_changed (const QString&))); + connect (f, SIGNAL (file_name_changed (const QString&, const QString&)), + this, SLOT (handle_file_name_changed (const QString&, const QString&))); connect (f, SIGNAL (editor_state_changed (bool, const QString&)), this, SLOT (handle_editor_state_changed (bool, const QString&))); connect (f, SIGNAL (tab_remove_request ()),
--- a/libgui/src/m-editor/file-editor.h +++ b/libgui/src/m-editor/file-editor.h @@ -113,7 +113,7 @@ void request_uncomment_selected_text (); void request_find (); - void handle_file_name_changed (const QString& fileName); + void handle_file_name_changed (const QString& fileName, const QString& toolTip); void handle_tab_close_request (int index); void handle_tab_remove_request (); void handle_add_filename_to_list (const QString& fileName);