void ConnectDialog::populateSlotList(const QString &signal) { QString selectedName; if (const QListWidgetItem * item = m_ui.slotList->currentItem()) selectedName = item->text(); m_ui.slotList->clear(); QMap<QString, QString> memberToClassName = getMatchingSlots(m_formWindow->core(), m_destination, signal, showAllSignalsSlots()); QFont font = QApplication::font(); font.setItalic(true); QVariant variantFont = QVariant::fromValue(font); QListWidgetItem *curr = 0; QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin(); const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd(); while (itMember != itMemberEnd) { const QString member = itMember.key(); const bool qt3Slot = isQt3Slot(m_formWindow->core(), m_destination, member); QListWidgetItem *item = new QListWidgetItem(m_ui.slotList); item->setText(member); if (member == selectedName) curr = item; if (qt3Slot) { item->setData(Qt::FontRole, variantFont); item->setData(Qt::ForegroundRole, Qt::red); } ++itMember; } if (curr) m_ui.slotList->setCurrentItem(curr); if (m_ui.slotList->selectedItems().isEmpty()) setOkButtonEnabled(false); }
CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, ICodeStylePreferences *codeStyle, QWidget *parent) : QWidget(parent), m_factory(factory), m_codeStyle(codeStyle) { m_layout = new QVBoxLayout(this); CodeStyleSelectorWidget *selector = new CodeStyleSelectorWidget(factory, this); selector->setCodeStyle(codeStyle); m_preview = new SnippetEditorWidget(this); m_preview->setFontSettings(TextEditorSettings::fontSettings()); DisplaySettings displaySettings = m_preview->displaySettings(); displaySettings.m_visualizeWhitespace = true; m_preview->setDisplaySettings(displaySettings); ISnippetProvider *provider = factory->snippetProvider(); if (provider) provider->decorateEditor(m_preview); QLabel *label = new QLabel( tr("Edit preview contents to see how the current settings " "are applied to custom code snippets. Changes in the preview " "do not affect the current settings."), this); QFont font = label->font(); font.setItalic(true); label->setFont(font); label->setWordWrap(true); m_layout->addWidget(selector); m_layout->addWidget(m_preview); m_layout->addWidget(label); connect(codeStyle, SIGNAL(currentTabSettingsChanged(TextEditor::TabSettings)), this, SLOT(updatePreview())); connect(codeStyle, SIGNAL(currentValueChanged(QVariant)), this, SLOT(updatePreview())); connect(codeStyle, SIGNAL(currentPreferencesChanged(TextEditor::ICodeStylePreferences*)), this, SLOT(updatePreview())); m_preview->setCodeStyle(m_codeStyle); m_preview->setPlainText(factory->previewText()); updatePreview(); }
void LinkLabel::setLook(LinkLook *look) // FIXME: called externaly (so, without setLink()) it's buggy (icon not { m_look = look; QFont font; font.setBold(look->bold()); font.setUnderline(look->underlineOutside()); font.setItalic(look->italic()); m_title->setFont(font); QPalette palette; if (m_isSelected) palette.setColor(m_title->foregroundRole(), KApplication::palette().color(QPalette::Text)); else palette.setColor(m_title->foregroundRole(), look->effectiveColor()); m_title->setPalette(palette); m_icon->setVisible(m_icon->pixmap() && ! m_icon->pixmap()->isNull()); setAlign(m_hAlign, m_vAlign); }
void Setting::updateFont(QFont &font, QString entry) { // do font stuff QString s = readEntry(entry); if (!s) return; #ifdef Q_WS_X11_xxx font.setRawName(s); #else QString fs = element(s, 0, "-"); font.setFamily(fs); // qDebug("FAMILY: %s", fs.latin1()); for (int i=1; i<6; i++) { int n = element(s, i, "-").toInt(); switch (i) { case 1: font.setPointSize(n); break; case 2: font.setWeight(n); break; case 3: font.setItalic(n); break; case 4: font.setUnderline(n); break; case 5: font.setStrikeOut(n); break; default: qWarning("Unknown font attribut!"); } } #endif }
void QgsValueMapConfigDlg::setRow( int row, const QString &value, const QString &description ) { QgsSettings settings; QTableWidgetItem *valueCell = nullptr; QTableWidgetItem *descriptionCell = new QTableWidgetItem( description ); tableWidget->insertRow( row ); if ( value == QgsValueMapFieldFormatter::NULL_VALUE ) { QFont cellFont; cellFont.setItalic( true ); valueCell = new QTableWidgetItem( QgsApplication::nullRepresentation() ); valueCell->setFont( cellFont ); valueCell->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); descriptionCell->setFont( cellFont ); } else { valueCell = new QTableWidgetItem( value ); } tableWidget->setItem( row, 0, valueCell ); tableWidget->setItem( row, 1, descriptionCell ); }
QFont pFont::create(const string &description) { lstring part; part.split(",", description); for(auto &item : part) item.trim(" "); string family = "Sans"; unsigned size = 8u; bool bold = false; bool italic = false; if(part[0] != "") family = part[0]; if(part.size() >= 2) size = decimal(part[1]); if(part.size() >= 3) bold = part[2].position("Bold"); if(part.size() >= 3) italic = part[2].position("Italic"); QFont qtFont; qtFont.setFamily(family); qtFont.setPointSize(size); if(bold) qtFont.setBold(true); if(italic) qtFont.setItalic(true); return qtFont; }
IdentityWidget::IdentityWidget(QString name/*=QString()*/, QWidget *parent/*=0*/) : FlowLayoutItem(name, parent), ui(new Ui::IdentityWidget) { ui->setupUi(this); _haveGXSId = false; _havePGPDetail = false; m_myName = name; ui->labelName->setText(m_myName); ui->labelName->setToolTip(m_myName); QFont font = ui->labelName->font(); font.setItalic(false); ui->labelName->setFont(font); _keyId=""; ui->labelKeyId->setText(_keyId); ui->labelKeyId->setToolTip(_keyId); ui->labelKeyId->setVisible(false); ui->labelGXSId->setText(_keyId); ui->labelGXSId->setToolTip(_keyId); ui->labelGXSId->setVisible(false); ui->pbAdd->setVisible(false); QObject::connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(pbAdd_clicked())); _scene = new QGraphicsScene(this); ui->graphicsView->setScene(_scene); //To grab events ui->graphicsView->setEnabled(false); ui->graphicsView->setAlignment(Qt::AlignLeft | Qt::AlignTop); setIsCurrent(false); setIsSelected(false); setAcceptDrops(true); }
QSize ConfigDelegateBase::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const { int width = QStyledItemDelegate::sizeHint( option, index ).width(); QStyleOptionViewItemV4 opt = option; initStyleOption( &opt, index ); QFont name = opt.font; name.setPointSize( name.pointSize() + 2 ); name.setBold( true ); QFont path = opt.font; path.setItalic( true ); path.setPointSize( path.pointSize() - 1 ); QFontMetrics bfm( name ); QFontMetrics sfm( path ); return QSize( width, 2 * PADDING + bfm.height() + sfm.height() ); }
void SoundItem::slotMediaStateChanged(Phonon::State newstate, Phonon::State /*oldstate*/) { if ( newstate == Phonon::ErrorState ) { KMessageBox::detailedError( (QWidget*)(this), i18n("%1 is damaged and may not be playable.", m_url.fileName()), m_mediaObject->errorString(), i18n("Phonon error") ); m_artist = m_url.fileName(); m_title = i18n("This file is damaged and may not be playable."); setText(artist().append(" - ").append(title())); setBackground(QBrush(Qt::red)); setForeground(QBrush(Qt::white)); QFont errorFont = font(); errorFont.setBold(true); errorFont.setItalic(true); setFont(errorFont); return; } if ( newstate != Phonon::StoppedState ) return; long int total = m_mediaObject->totalTime(); int hours = (int)(total / (long int)( 60 * 60 * 1000 )); int mins = (int)((total / (long int)( 60 * 1000 )) - (long int)(hours * 60)); int secs = (int)((total / (long int)1000) - (long int)(hours * 60 * 60) - (long int)(mins * 60)); m_totalTime = QTime(hours, mins, secs); m_artist = (m_mediaObject->metaData(Phonon::ArtistMetaData)).join(","); m_title = (m_mediaObject->metaData(Phonon::TitleMetaData)).join(","); if ( m_artist.isEmpty() && m_title.isEmpty() ) setText(m_url.fileName()); else setText(artist().append(" - ").append(title())); emit signalTotalTimeReady(m_url, m_totalTime); }
void ViewTable::setRowTextBold(int row, bool c) { if( row < 0 ) return; if( row >= rowCount() ) return; Cell *cl = NULL; QFont font; for(int i = 0; i < columnCount(); i++ ) { cl = cell(row, i); if(!cl) continue; font = cl->font(); font.setBold( c ); font.setItalic( c ); cl->setFont( font ); } }
void FontsConfig::updateQtFont() { // FIXME: the change does not apply to some currently running Qt programs. // FIXME: does not work with KDE apps // TODO: also write the config values to GTK+ config files (gtk-2.0.rc and gtk3/settings.ini) // FIXME: the selected font does not apply to our own application. Why? QFont font = ui->fontName->currentFont(); int size = ui->fontSize->value(); bool bold = false; bool italic = false; switch(ui->fontStyle->currentIndex()) { case 1: bold = true; break; case 2: italic = true; break; case 3: bold = italic = true; } font.setPointSize(size); font.setBold(bold); font.setItalic(italic); mQtSettings->beginGroup(QLatin1String("Qt")); mQtSettings->setValue("font", font.toString()); mQtSettings->endGroup(); mQtSettings->sync(); #ifdef Q_WS_X11 qt_x11_apply_settings_in_all_apps(); #endif update(); }
QVariant data(const QModelIndex &index, int role) const { if (!m_descriptions || !m_scheme) return QVariant(); const FormatDescription &description = m_descriptions->at(index.row()); switch (role) { case Qt::DisplayRole: return description.displayName(); case Qt::ForegroundRole: { QColor foreground = m_scheme->formatFor(description.id()).foreground(); if (foreground.isValid()) return foreground; else return m_scheme->formatFor(C_TEXT).foreground(); } case Qt::BackgroundRole: { QColor background = m_scheme->formatFor(description.id()).background(); if (background.isValid()) return background; else break; } case Qt::FontRole: { QFont font = m_baseFont; auto format = m_scheme->formatFor(description.id()); font.setBold(format.bold()); font.setItalic(format.italic()); font.setUnderline(format.underlineStyle() != QTextCharFormat::NoUnderline); return font; } case Qt::ToolTipRole: { return description.tooltipText(); } } return QVariant(); }
void ConnectDialog::populateSignalList() { QString selectedName; if (const QListWidgetItem *item = m_ui.signalList->currentItem()) selectedName = item->text(); m_ui.signalList->clear(); QMap<QString, QString> memberToClassName = getSignals(m_formWindow->core(), m_source, showAllSignalsSlots()); QFont font = QApplication::font(); font.setItalic(true); QVariant variantFont = QVariant::fromValue(font); QListWidgetItem *curr = 0; QMap<QString, QString>::ConstIterator itMember = memberToClassName.constBegin(); const QMap<QString, QString>::ConstIterator itMemberEnd = memberToClassName.constEnd(); while (itMember != itMemberEnd) { const QString member = itMember.key(); QListWidgetItem *item = new QListWidgetItem(m_ui.signalList); item->setText(member); if (!selectedName.isEmpty() && member == selectedName) curr = item; ++itMember; } if (curr) { m_ui.signalList->setCurrentItem(curr); } else { selectedName.clear(); } populateSlotList(selectedName); if (!curr) m_ui.slotList->setEnabled(false); }
void ZLQtPaintContext::setFont(const std::string &family, int size, bool bold, bool italic) { if (myPainter->device() == 0) { myFontIsStored = true; myStoredFamily = family; myStoredSize = size; myStoredBold = bold; myStoredItalic= italic; } else { QFont font = myPainter->font(); bool fontChanged = false; if (font.family() != family.c_str()) { font.setFamily(family.c_str()); fontChanged = true; } if (font.pointSize() != size) { font.setPointSize(size); fontChanged = true; } if ((font.weight() != (bold ? QFont::Bold : QFont::Normal))) { font.setWeight(bold ? QFont::Bold : QFont::Normal); fontChanged = true; } if (font.italic() != italic) { font.setItalic(italic); fontChanged = true; } if (fontChanged) { myPainter->setFont(font); mySpaceWidth = -1; myDescent = myPainter->fontMetrics().descent(); } } }
void CMainWindow::on_trvCharts_itemDoubleClicked(QTreeWidgetItem *item, int column) { QString lFname(item->data(0, Qt::UserRole).toString()); QFont fnt = item->font(0); fnt.setBold(false); fnt.setItalic(false); item->setFont(0, fnt); if(lFname.right(4).toLower() == ".pdf") { #ifdef Q_OS_WIN QStringList lArg(lFname); QProcess lReader; QString pdfRead(mopt->pdfExe()); lReader.startDetached(pdfRead, lArg); #endif #ifdef Q_OS_LINUX lFname.insert(0, "file://"); QUrl lUrl(lFname); QDesktopServices::openUrl(lUrl); #endif } }
FontPlatformData::FontPlatformData(const FontDescription& description, const AtomicString& familyName, int wordSpacing, int letterSpacing) : m_data(adoptRef(new FontPlatformDataPrivate())) { QFont font; int requestedSize = description.computedPixelSize(); font.setFamily(familyName); if (requestedSize) font.setPixelSize(requestedSize); font.setItalic(description.italic()); font.setWeight(toQFontWeight(description.weight())); font.setWordSpacing(wordSpacing); font.setLetterSpacing(QFont::AbsoluteSpacing, letterSpacing); if (description.fontSmoothing() == NoSmoothing || (description.fontSmoothing() == AutoSmoothing && !Font::shouldUseSmoothing())) font.setStyleStrategy(QFont::NoAntialias); m_data->bold = font.bold(); // WebKit allows font size zero but QFont does not. We will return // m_data->size if a font size of zero is requested and pixelSize() // otherwise. m_data->size = (!requestedSize) ? requestedSize : font.pixelSize(); m_data->rawFont = QRawFont::fromFont(font, QFontDatabase::Any); }
void KDirListBoxItem::paint( QPainter *p ) { if(italic) { p->save(); QFont f = p->font(); f.setItalic(true); p->setFont(f); } p->drawPixmap( 3, 2, *pm ); QFontMetrics fm = p->fontMetrics(); int yPos; // vertical text position if ( (pm->height()) < fm.height() ) yPos = fm.ascent() + fm.leading()/2; else yPos = pm->height()/2 - fm.height()/2 + fm.ascent(); yPos= yPos+2; p->drawText( pm->width() + 5, yPos, text() ); if(italic) p->restore(); }
// Based on kconfigbase.cpp static QFont Str2Font(const QString &aValue) { uint nFontBits; QFont aRetFont; QString chStr; QStringList sl = QStringList::split(QString::fromLatin1(","), aValue); if(sl.count() == 1) { /* X11 font spec */ aRetFont = QFont(aValue); aRetFont.setRawMode(true); } else if(sl.count() == 10) { /* qt3 font spec */ aRetFont.fromString(aValue); } else if(sl.count() == 6) { /* backward compatible kde2 font spec */ aRetFont = QFont(sl[0], sl[1].toInt(), sl[4].toUInt()); aRetFont.setStyleHint((QFont::StyleHint)sl[2].toUInt()); nFontBits = sl[5].toUInt(); aRetFont.setItalic((nFontBits & 0x01) != 0); aRetFont.setUnderline((nFontBits & 0x02) != 0); aRetFont.setStrikeOut((nFontBits & 0x04) != 0); aRetFont.setFixedPitch((nFontBits & 0x08) != 0); aRetFont.setRawMode((nFontBits & 0x20) != 0); } aRetFont.setStyleStrategy((QFont::StyleStrategy)(QFont::PreferMatch | (_antiAliasing ? QFont::PreferAntialias : QFont::NoAntialias))); return aRetFont; }
QVariant FilteredSpawnModel::data(const QModelIndex& index, int role) const { if (role == Qt::ForegroundRole) { QModelIndex sourceIndex = mapToSource(index); const Item* item = m_spawnModel->item(sourceIndex); uint32_t filterFlags = 0; if (item != NULL) filterFlags = item->filterFlags(); if (filterFlags & FILTER_FLAG_FILTERED) return QBrush(Qt::gray); return m_spawnModel->data(sourceIndex, role); } else if (role == Qt::FontRole) { QModelIndex sourceIndex = mapToSource(index); const Item* item = m_spawnModel->item(sourceIndex); uint32_t filterFlags = 0; if (item != NULL) filterFlags = item->filterFlags(); QFont font; font.setBold((filterFlags & FILTER_FLAG_ALERT) != 0); font.setItalic((filterFlags & FILTER_FLAG_LOCATE) != 0); font.setUnderline((filterFlags & FILTER_FLAG_CAUTION) || (filterFlags & FILTER_FLAG_DANGER)); return font; } return QSortFilterProxyModel::data(index, role); }
QFont Calligra::Sheets::NativeFormat::toFont(KoXmlElement & element) { QFont f; f.setFamily(element.attribute("family")); bool ok; const int size = element.attribute("size").toInt(&ok); if (ok) f.setPointSize(size); const int weight = element.attribute("weight").toInt(&ok); if (!ok) f.setWeight(weight); if (element.hasAttribute("italic") && element.attribute("italic") == "yes") f.setItalic(true); if (element.hasAttribute("bold") && element.attribute("bold") == "yes") f.setBold(true); if (element.hasAttribute("underline") && element.attribute("underline") == "yes") f.setUnderline(true); if (element.hasAttribute("strikeout") && element.attribute("strikeout") == "yes") f.setStrikeOut(true); /* Uncomment when charset is added to kspread_dlg_layout + save a document-global charset if ( element.hasAttribute( "charset" ) ) KGlobal::charsets()->setQFont( f, element.attribute("charset") ); else */ // ######## Not needed anymore in 3.0? //KGlobal::charsets()->setQFont( f, KGlobal::locale()->charset() ); return f; }
CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory, ICodeStylePreferences *codeStyle, QWidget *parent) : CodeStyleEditorWidget(parent), m_factory(factory), m_codeStyle(codeStyle) { m_layout = new QVBoxLayout(this); auto selector = new CodeStyleSelectorWidget(factory, this); selector->setCodeStyle(codeStyle); m_preview = new SnippetEditorWidget(this); DisplaySettings displaySettings = m_preview->displaySettings(); displaySettings.m_visualizeWhitespace = true; m_preview->setDisplaySettings(displaySettings); QString groupId = factory->snippetProviderGroupId(); SnippetProvider::decorateEditor(m_preview, groupId); QLabel *label = new QLabel( tr("Edit preview contents to see how the current settings " "are applied to custom code snippets. Changes in the preview " "do not affect the current settings."), this); QFont font = label->font(); font.setItalic(true); label->setFont(font); label->setWordWrap(true); m_layout->addWidget(selector); m_layout->addWidget(m_preview); m_layout->addWidget(label); connect(codeStyle, &ICodeStylePreferences::currentTabSettingsChanged, this, &CodeStyleEditor::updatePreview); connect(codeStyle, &ICodeStylePreferences::currentValueChanged, this, &CodeStyleEditor::updatePreview); connect(codeStyle, &ICodeStylePreferences::currentPreferencesChanged, this, &CodeStyleEditor::updatePreview); m_preview->setCodeStyle(m_codeStyle); m_preview->setPlainText(factory->previewText()); updatePreview(); }
QFont FontButton::parseFont(const QString& string) { QStringList list = string.split(" ", QString::SkipEmptyParts); bool bold = false; bool italic = false; while(!list.empty()) { if (list.last() == "Bold") { bold = true; list.pop_back(); } else if (list.last() == "Italic") { italic = true; list.pop_back(); } else break; } QString family = list.join(" "); QFont font; font.setFamily(family); font.setBold(bold); font.setItalic(italic); return font; }
// Returns the font of the text for a style. QFont QsciLexerPython::defaultFont(int style) const { QFont f; switch (style) { case Keyword: case ClassName: case HighlightedIdentifier: f = QsciLexer::defaultFont(style); f.setBold(true); break; case Decorator: f = QsciLexer::defaultFont(style); f.setItalic(true); break; default: f = QsciLexer::defaultFont(style); } return f; }
QVariant TranslationsModel::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); Row node = m_nodes.at(index.row()); if (role == Qt::DisplayRole || role == Qt::EditRole) { switch (index.column()) { case 0: return node.context; case 1: return node.sourceText; case 2: return node.disambiguation; case 3: return node.translation; } } if (role == Qt::FontRole && index.column() == 3 && node.isOverriden) { QFont font; font.setItalic(true); return font; } return QVariant(); }
/* * Configures display properties of the List view attached to this model */ QVariant ActivityModel::data(const QModelIndex &index, int role) const { switch (role) { case Qt::DisplayRole: if (!index.isValid()) { return QVariant(); } if (index.row() >= string_list_.size()) { return QVariant(); } return string_list_.at(index.row()); break; case Qt::TextAlignmentRole: if (index.row() == tag_row_ && index.column() == 0) { return Qt::AlignCenter; } break; case Qt::FontRole: if (index.row() == tag_row_ && index.column() == 0) { QFont font; font.setItalic(true); return font; } break; case Qt::ForegroundRole: QBrush text; if (index.row() == 0) { text.setColor(Qt::gray); return text; } break; } return QVariant(); }
void ChatListviewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyledItemDelegate::paint(painter, option, index); painter->save(); QFont font = QApplication::font(); QFont timeFont = QApplication::font(); QFont messagefont = QApplication::font(); timeFont.setItalic(true); font.setBold(true); QFontMetrics fm(font); QString senderAlias = index.data(senderAliasRole).toString() + QLatin1String(":"); QString message = index.data(messageRole).toString(); QString time = index.data(messageTimeRole).toString(); QRect aliasRect = option.rect; QRect messageRect = option.rect; QRect timeRect = option.rect; messageRect.setLeft(fm.width(senderAlias)); painter->setFont(font); painter->drawText(aliasRect, senderAlias); painter->setFont(messagefont); painter->drawText(messageRect, message); painter->setFont(timeFont); painter->drawText(timeRect, Qt::AlignRight, time); painter->restore(); }
QSize ClassifierWidget::calculateTemplatesBoxSize() { UMLTemplateList list = classifier()->getTemplateList(); int count = list.count(); if (count == 0) { return QSize(0, 0); } int width, height; height = width = 0; QFont font = UMLWidget::font(); font.setItalic(false); font.setUnderline(false); font.setBold(false); const QFontMetrics fm(font); height = count * fm.lineSpacing() + (MARGIN*2); foreach (UMLTemplate *t , list ) { int textWidth = fm.size(0, t->toString() ).width(); if (textWidth > width) width = textWidth; }
void FilePropsDialog::addInfoSection(QString name) { if(_value.isEmpty()) return; int y = m_ui->tableWidget->rowCount(); m_ui->tableWidget->setRowCount(y+2); QFont fontBold = m_ui->tableWidget->font(); fontBold.setBold(true); QFont fontItalic = m_ui->tableWidget->font(); fontItalic.setItalic(true); QTableWidgetItem * item1 = new QTableWidgetItem(name); item1->setFont(fontBold); m_ui->tableWidget->setItem(y, 0, item1); QTableWidgetItem * item2 = new QTableWidgetItem(_value); item2->setData(Qt::UserRole, QVariant(2)); item2->setFont(fontItalic); m_ui->tableWidget->setItem(y+1, 0, item2); _value.clear(); }
void TraceDock::updateState(int index) { QListWidgetItem * item = trace_->item(index); if(!item) return; item->setText(printChildren(sim_->topLevelSymbols(index), index)); // set font QFont fnt = item->font(); fnt.setItalic(sim_->isAccepting(index)); item->setFont(fnt); // and background colour QPalette def; if (!sim_->isValid(index)) { item->setForeground(error_); } else if (sim_->transitionCount(index) == 0) { item->setForeground(deadlock_); } else { item->setForeground(def.color(QPalette::Text)); } }
//------------------------------------------------------------------------ QFont qt_dbtreemodel_impl::_FontRole( int section ) const { QFont font; const TreeModel::Header *header = _header( section ); if( ! header ) return font; const TreeModel::Canvas *canvas = header->canvas(); if( canvas ) { const TreeModel::Font* ptr = canvas->font(); if( ptr ) { font.setFamily ( ptr->family().c_str() ); font.setPointSize( ptr->pointSize() ); font.setItalic ( ptr->italic() ); font.setUnderline( ptr->underline() ); font.setBold ( ptr->bold() ); } } return font; }