Mercurial > octave-nkf
comparison libgui/src/m-editor/file-editor.cc @ 18281:4dadae02bd4c gui-release
max. width of editor tabs limited and configurable
* settings-dialog.ui: new spin box for max. tab width
* settings-dialog.cc (constructor): set spin box value from settings file;
(write_changed_settings): write spin box value into settings file
* file-editor.cc (construct): set right text alignment in editor tabs;
(notice_settings): set tab's style sheet depending on tab width
author | Torsten <ttl@justmail.de> |
---|---|
date | Tue, 14 Jan 2014 22:51:43 +0100 |
parents | f227bb47314f |
children | 01646e48a650 |
comparison
equal
deleted
inserted
replaced
18279:8d98ebeceab4 | 18281:4dadae02bd4c |
---|---|
840 void | 840 void |
841 file_editor::notice_settings (const QSettings *settings) | 841 file_editor::notice_settings (const QSettings *settings) |
842 { | 842 { |
843 int icon_size = settings->value ("toolbar_icon_size", 16).toInt (); | 843 int icon_size = settings->value ("toolbar_icon_size", 16).toInt (); |
844 _tool_bar->setIconSize (QSize (icon_size, icon_size)); | 844 _tool_bar->setIconSize (QSize (icon_size, icon_size)); |
845 | |
846 int tab_width = settings->value ("editor/tab_width", 300).toInt (); | |
847 QString style_sheet = QString ("QTabBar::tab {max-height: 4ex; " | |
848 "max-width: %1px; text-align: right }"). | |
849 arg (tab_width); | |
850 _tab_widget->setStyleSheet (style_sheet); | |
851 | |
845 // Relay signal to file editor tabs. | 852 // Relay signal to file editor tabs. |
846 emit fetab_settings_changed (settings); | 853 emit fetab_settings_changed (settings); |
847 } | 854 } |
848 | 855 |
849 void | 856 void |
872 _tab_widget = new QTabWidget (editor_widget); | 879 _tab_widget = new QTabWidget (editor_widget); |
873 _tab_widget->setTabsClosable (true); | 880 _tab_widget->setTabsClosable (true); |
874 #ifdef HAVE_QTABWIDGET_SETMOVABLE | 881 #ifdef HAVE_QTABWIDGET_SETMOVABLE |
875 _tab_widget->setMovable (true); | 882 _tab_widget->setMovable (true); |
876 #endif | 883 #endif |
877 _tab_widget->setStyleSheet ("QTabBar::tab {max-height: 4ex; }"); | 884 _tab_widget->setElideMode (Qt::ElideLeft); |
878 | |
879 | 885 |
880 | 886 |
881 QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"), | 887 QAction *new_action = new QAction (QIcon (":/actions/icons/filenew.png"), |
882 tr ("&New File"), _tool_bar); | 888 tr ("&New File"), _tool_bar); |
883 | 889 |