Mercurial > hg > octave-lojdl
changeset 16518:59dbdaeeea40
* main_window.cc(construct_tool_bar): code cleanup and tool tips for combo box
author | Torsten <ttl@justmail.de> |
---|---|
date | Sun, 14 Apr 2013 21:34:47 +0200 |
parents | b348c5835ce4 |
children | 3e8fd0c479b4 |
files | libgui/src/main-window.cc |
diffstat | 1 files changed, 10 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/main-window.cc +++ b/libgui/src/main-window.cc @@ -359,7 +359,7 @@ // the combo box will triggers the "activated" signal to change to the // directory. - QString dir = _current_directory_line_edit->text (); + QString dir = _current_directory_combo_box->currentText (); int index = _current_directory_combo_box->findText (dir); @@ -1261,25 +1261,27 @@ main_tool_bar->addSeparator (); - _current_directory_line_edit = new QLineEdit (this); _current_directory_combo_box = new QComboBox (this); _current_directory_combo_box->setFixedWidth (current_directory_width); _current_directory_combo_box->setEditable (true); - // setLineEdit takes ownership -> no need to delete line_edit in ~main_window - _current_directory_combo_box->setLineEdit (_current_directory_line_edit); - _current_directory_combo_box->setInsertPolicy (QComboBox::InsertAtTop); + _current_directory_combo_box->setInsertPolicy(QComboBox::NoInsert); + _current_directory_combo_box->setToolTip (tr ("Enter directory name")); _current_directory_combo_box->setMaxVisibleItems (current_directory_max_visible); _current_directory_combo_box->setMaxCount (current_directory_max_count); + QSizePolicy sizePol(QSizePolicy::Expanding, QSizePolicy::Preferred); + _current_directory_combo_box->setSizePolicy(sizePol); QToolButton *current_directory_tool_button = new QToolButton (this); current_directory_tool_button->setIcon (QIcon (":/actions/icons/search.png")); + current_directory_tool_button->setToolTip (tr ("Browse directories")); QToolButton *current_directory_up_tool_button = new QToolButton (this); current_directory_up_tool_button->setIcon (QIcon (":/actions/icons/up.png")); + current_directory_up_tool_button->setToolTip (tr ("One directory up")); // addWidget takes ownership of the objects so there is no // need to delete these upon destroying this main_window. - main_tool_bar->addWidget (new QLabel (tr ("Current Directory:"))); + main_tool_bar->addWidget (new QLabel (tr ("Current Directory: "))); main_tool_bar->addWidget (_current_directory_combo_box); main_tool_bar->addWidget (current_directory_tool_button); main_tool_bar->addWidget (current_directory_up_tool_button); @@ -1287,8 +1289,8 @@ connect (_current_directory_combo_box, SIGNAL (activated (QString)), this, SLOT (set_current_working_directory (QString))); - connect (_current_directory_line_edit, SIGNAL (returnPressed ()), - this, SLOT (accept_directory_line_edit ())); + connect (_current_directory_combo_box->lineEdit(), SIGNAL (returnPressed ()), + this, SLOT (accept_directory_line_edit ())); connect (current_directory_tool_button, SIGNAL (clicked ()), this, SLOT (browse_for_directory ()));