Qt Creator: is it possible to change the font size of the side bar?
-
I like having the side bar open in Qt Creator, but it takes up just enough horizontal screen space that it makes it impractical for me to split my main window vertically into two editors. Is it possible for me to change the text font the side bar uses so that it renders with a smaller, perhaps narrower font?
Also, is there any way to hide or narrow the left margin of the text editor? (i.e. the space for setting breakpoints.) It's something I rarely ever use and all I want to reclaim all the horizontal screen space I can.
-
I discovered that this is possible using a custom style sheet with Qt Creator. Information was in this thread: https://forum.qt.io/topic/32243/change-font-size-for-qt-creator-side-bar/3
However, I also found that if I used a condensed font with the sidebar it not only didn't render the text (as there is no way to set the stretch of a font using qss) but it adversely affected other UI elements in Qt Creator.
So I just downloaded the source code to Qt Creator and made some changes. I was also able to reduce the width of the text editor's left margin too, since that's not possible with qss alone.
-
What source code changes have you done? Can you please share the change you've done?
-
@Gowtham_rg said in Qt Creator: is it possible to change the font size of the side bar?:
What source code changes have you done? Can you please share the change you've done?
Those changes were all the way back in 2016 so I can't say if they're likely to still apply to the most recent version of Qt Creator. And now that I have a larger monitor I'm just running unmodified Qt Creator at this point, so I haven't merged these changes into a later version since probably 2017. But I made the following two changes.
Right before the call to
initView()
in the constructor ofProjectTreeWidget
insrc/plugins/projectexplorer/projecttreewidget.cpp
I added:m_view->setIndentation(12); m_view->setIconSize(QSize(8, 8)); QFont font(tr("Your Font Here"), 13); font.setStretch(QFont::SemiCondensed); m_view->setFont(font); initView();
and I added the line
markWidth *= 0.6;
intoTextEditorWidget::extraAreaWidth
insrc/plugins/texteditor/texteditor.cpp
thusly:if (d->m_marksVisible) { markWidth += documentLayout->maxMarkWidthFactor * fm.lineSpacing() + 2; // if (documentLayout->doubleMarkCount) // markWidth += fm.lineSpacing() / 3; markWidth *= 0.6; space += markWidth; } else { space += 2; }
Again, this was Qt Creator 3.6.0, so I can't say if these changes will still work.