3 #include <QFontDatabase> 10 QMenuBar::paintEvent(event);
12 int font_id = QFontDatabase::addApplicationFont(
"://resources/DejaVuSans-ExtraLight.ttf");
13 QString family = QFontDatabase::applicationFontFamilies(font_id).at(0);
15 font.setStyleStrategy(QFont::PreferAntialias);
17 QPainter painter(
this);
18 painter.setFont( QFont(family, 12) );
20 int width_plot = painter.fontMetrics().width(
"Plot");
21 int width_juggler = painter.fontMetrics().width(
"Juggler");
22 int text_width = width_plot + width_juggler;
24 QPoint topleft( this->rect().width() - text_width - 12 , 0);
25 QSize rect_size( width_plot, this->rect().height() );
26 painter.setPen( QColor(
"#ce0e73"));
27 painter.drawText( QRect(topleft, rect_size),
28 Qt::AlignHCenter | Qt::AlignVCenter,
"Plot" );
31 QPoint topleft( this->rect().width() - width_juggler - 10 , 0);
32 QSize rect_size( width_juggler, this->rect().height() );
33 painter.setPen( QColor(
"#1b72cf"));
34 painter.drawText( QRect(topleft, rect_size),
35 Qt::AlignHCenter | Qt::AlignVCenter,
"Juggler" );