2

am creating a tool with QT creator, that should run on linux only

now i am setting the font for my whole app, this is how:

QApplication myApplication(argc, argv);

auto id{QFontDatabase::addApplicationFont(":/someFont.ttf")};
QString family{QFontDatabase::applicationFontFamilies(id).at(0)};
QFont myFont(family);
myApplication.setFont(myFont);

however, am not able until now to set the font taking effect on the window title, message boxes or custom dialogs...

is this not supported at all because of the windows manager??

enter image description here

enter image description here

enter image description here

ΦXocę 웃 Пepeúpa ツ
  • 47,427
  • 17
  • 69
  • 97

1 Answers1

0

If your question concerns the font associated to the title, i do not think there is a way to change it because it is managed by the Window Manager according to this and this and also here

May be a resource to try to draw the window title bar in QT can be found here, which I tried but it is a little of a hack where you hide the real title bar and redraw a text over it and then you format the text using a css. Other resources but using Python (How to customize title bar and window of desktop application)

Pat. ANDRIA
  • 2,330
  • 1
  • 13
  • 27
  • the font is working in all elements of the dialog, only the title is not taking the changes – ΦXocę 웃 Пepeúpa ツ Feb 25 '21 at 15:25
  • Ah sorry, i understand now. I do not think you can modify the title font of a QMainWindow or a Qdialog as it is managed by the Window Manager (https://forum.qt.io/topic/72247/change-title-font-of-qt-main-window). Or may be a solution here but I did not test yet https://forum.qt.io/topic/3258/how-to-draw-to-the-windows-title-bar-with-qt-is-this-possible/2 – Pat. ANDRIA Feb 25 '21 at 15:27