The article describes how to add tabs to QtCreator using an extension system (plug-in) that does not require modification of the source code of QtCreator itself.
When switching to using IDE QtCreator, the absence of the usual tabs for open files seems unusual. Over time, you get used to other means of navigating through the sources. QtCreator has at least six such products:
- It is convenient to use the F4 key to switch between .h and .cpp files;
- all open files are displayed in the “Open Documents” panel;
- Ctrl + Tab displays a list of all open files directly in the edit area;
- Ctrl + K displays a list of files with filtering as you type;
- Alt + Left allows you to navigate through the history of navigation between open files;
- You can also navigate the project tree.
All these methods are indispensable when editing multiple files at the same time. When editing a small number of sources, the use of tabs, in my humble opinion, is more convenient. Tabs are also supported by their widespread use in implementing MDI (Multi Document Interface) in development environments, text editors, viewers, and browsers.
The topic of tabs was repeatedly raised on the forums. The developers even included the question “Why doesn't Qt Creator not use tabs for editors?” In the
FAQ list. The following arguments are given in the answer to this question:
- Tabs are not a scalable solution. They work well with 5-6 open editors, but become cumbersome with 10. With a further increase in the number of editable files, navigation using tabs becomes very difficult.
- Tabs do not adapt to your working environment settings.
- Tabs force you to limit the number of open editors, because otherwise you will get confused.
So that this plugin does not go against the ideology of QtCreator, I propose to immediately limit its scope: editing a small (up to 10) number of files. The plugin of course allows you to open a larger number of editors, but in this case it is still better to use the features of QtCreator listed at the beginning of the article.
Key Features:
- harmonious QSS style of tabs (tabs do not make eyes black and eat only about 18 px);
- QtCreator color scheme support (Tools-> Options-Environment-> General-> Color);
- the ability to switch between 10 tabs key combination (Ctrl + Alt + N, where N is the key in the number row from 1 to 0). Tried to add shorter keyboard shortcuts, but they all turned out to be already “reserved”;
- displaying tabs in all modes (Edit, Design, etc), which allows you to switch between editing * .ui forms and the corresponding class file with one click on the tab (or using hot keys).
The plugin is not without flaws:
- Currently, the plugin does not fully support the split configuration of the editor window (when the editing area is divided into several sub-areas, the TabBar remains one for all).
PS Please take this small post as the announcement of another plug-in. I hope it will be useful to the Qt-programmers community.
')
References:
1.
Project page on Sourceforge.net (currently not supported, for new versions of QtCreator, see link 2).
2.
Fork developer Oleg Shparber on GitHub . Sources working in new versions of the plug-in should be found there.
To install the plugin, the contents of the archive must be unpacked into the directory where the plugins are located:
for Windows, typically C: \ Qt \ Tools \ QtCreator \ lib \ qtcreator \ plugins.
for Lunux-based systems /home/username/Qt5.2.0/Tools/QtCreator/lib/qtcreator/plugins when installing Qt in the user directory. Or (as an option) /opt/Qt5.2.0/Tools/QtCreator/lib/qtcreator/plugins (installed on Ubuntu).
for Mac OS X / Applications / Qt Creator.app/Contents/PlugIns