Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: is it possible to change the font size of the side bar?
Forum Updated to NodeBB v4.3 + New Features

Qt Creator: is it possible to change the font size of the side bar?

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
4 Posts 2 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Guy GizmoG Offline
    Guy GizmoG Offline
    Guy Gizmo
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • Guy GizmoG Offline
      Guy GizmoG Offline
      Guy Gizmo
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gowtham_rg
        wrote on last edited by
        #3

        What source code changes have you done? Can you please share the change you've done?

        Guy GizmoG 1 Reply Last reply
        0
        • G Gowtham_rg

          What source code changes have you done? Can you please share the change you've done?

          Guy GizmoG Offline
          Guy GizmoG Offline
          Guy Gizmo
          wrote on last edited by
          #4

          @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 of ProjectTreeWidget in src/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; into TextEditorWidget::extraAreaWidth in src/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.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved