Mercurial > hg > octave-nkf
diff libgui/src/m-editor/file-editor.cc @ 18411:3df71e1d3b24 gui-release
improve width of editor tabs when showing complete file path
* settings-dialog.ui (editor tab): new option for min tab width
* settings-dialog.cc (constructor): init new spin box for min tab width;
(write-changed-settings): read value from new spin box for min tab width
* file-editor.cc (notice-settings): elife mode and style sheet for tabs
width new min. and max. option only when displaying complete path
author | Torsten <ttl@justmail.de> |
---|---|
date | Thu, 23 Jan 2014 19:35:43 +0100 |
parents | 106da7544504 |
children | dfc6ef6ac455 |
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor.cc +++ b/libgui/src/m-editor/file-editor.cc @@ -856,10 +856,26 @@ int icon_size = settings->value ("toolbar_icon_size", 16).toInt (); _tool_bar->setIconSize (QSize (icon_size, icon_size)); - int tab_width = settings->value ("editor/notebook_tab_width", 300).toInt (); - QString style_sheet = QString ("QTabBar::tab {max-height: 4ex; " - "max-width: %1px; text-align: right }"). - arg (tab_width); + int tab_width_min = settings->value ("editor/notebook_tab_width_min", 160) + .toInt (); + int tab_width_max = settings->value ("editor/notebook_tab_width_max", 300) + .toInt (); + + QString style_sheet; + if (settings->value ("editor/longWindowTitle", false).toBool ()) + { + style_sheet = QString ("QTabBar::tab {max-height: 4ex; " + "min-width: %1px; max-width: %2px;}") + .arg (tab_width_min).arg (tab_width_max); + _tab_widget->setElideMode (Qt::ElideLeft); + } + else + { + style_sheet = QString ("QTabBar::tab {max-height: 4ex;}"); + _tab_widget->setElideMode (Qt::ElideNone); + } + + _tab_widget->setUsesScrollButtons (true); _tab_widget->setStyleSheet (style_sheet); // Relay signal to file editor tabs. @@ -894,8 +910,6 @@ #ifdef HAVE_QTABWIDGET_SETMOVABLE _tab_widget->setMovable (true); #endif - _tab_widget->setElideMode (Qt::ElideLeft); - QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"), tr ("&New File"), _tool_bar);