void EnvironmentSettingsDialog::on_fontUnderline_toggled(bool checked) { QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE"); int style; if ( ui->applyAll->isChecked() ) { for ( style = 0; style < (1<<m_lexer->styleBitsNeeded()); style++ ) { if ( !m_lexer->description(style).isEmpty() ) { QFont font = m_lexer->font(style); font.setUnderline(checked); m_lexer->setFont(font,style); if ( style == QsciLexerCA65::CA65_Default ) { m_scintilla->setMarginsFont(font); } } } } else { style = ui->styleName->itemData(ui->styleName->currentIndex()).toInt(); QFont font = m_lexer->font(style); font.setUnderline(checked); m_lexer->setFont(font,style); if ( style == QsciLexerCA65::CA65_Default ) { m_scintilla->setMarginsFont(font); } } }
void init_font() { NormalFont = QApplication::font(); if (! hasCodec()) NormalFont.setFamily("Helvetica"); BoldFont = NormalFont; BoldFont.setBold(TRUE); ItalicFont = NormalFont; ItalicFont.setItalic(TRUE); BoldItalicFont = ItalicFont; BoldItalicFont.setBold(TRUE); UnderlineFont = NormalFont; UnderlineFont.setUnderline(TRUE); BoldUnderlineFont = BoldFont; BoldUnderlineFont.setUnderline(TRUE); StrikeOutFont = NormalFont; StrikeOutFont.setStrikeOut(TRUE); }
void BaseObjectView::setFontStyle(const QString &id, QTextCharFormat font_fmt) { QFont font; if(id!=ParsersAttributes::GLOBAL) { font=font_config[ParsersAttributes::GLOBAL].font(); font.setItalic(font_fmt.font().italic()); font.setBold(font_fmt.font().bold()); font.setUnderline(font_fmt.font().underline()); font_fmt.setFont(font); } else { map<QString, QTextCharFormat>::iterator itr, itr_end; itr=font_config.begin(); itr_end=font_config.end(); font=font_fmt.font(); while(itr!=itr_end) { font.setItalic((itr->second).font().italic()); font.setBold((itr->second).font().bold()); font.setUnderline((itr->second).font().underline()); (itr->second).setFont(font); itr++; } } if(font_config.count(id)) font_config[id]=font_fmt; }
//---------------------------------------------------------------------- // // paintCell // // overridden from base class in order to change color and style attributes // void SpawnListItem::paintCell( QPainter *p, const QColorGroup &cg, int column, int width, int alignment ) { QColorGroup newCg( cg ); newCg.setColor( QColorGroup::Text, m_textColor); QFont font = this->listView()->font(); uint32_t filterFlags = 0; if (m_item != NULL) filterFlags = m_item->filterFlags(); if (!(filterFlags & (FILTER_FLAG_FILTERED | FILTER_FLAG_ALERT | FILTER_FLAG_LOCATE | FILTER_FLAG_CAUTION | FILTER_FLAG_DANGER))) { font.setBold(false); font.setItalic(false); font.setUnderline(false); } else { // color filtered spawns grey if (filterFlags & FILTER_FLAG_FILTERED) newCg.setColor( QColorGroup::Text, Qt::gray); if (filterFlags & FILTER_FLAG_ALERT) font.setBold(true); else font.setBold(false); if (filterFlags & FILTER_FLAG_LOCATE) font.setItalic(true); else font.setItalic(false); if ((filterFlags & FILTER_FLAG_CAUTION) || (filterFlags & FILTER_FLAG_DANGER)) font.setUnderline(true); else font.setUnderline(false); } p->setFont(font); QListViewItem::paintCell( p, newCg, column, width, alignment ); }
QFont LinkDisplay::labelFont(QFont font, bool isIconButtonHovered) const { if (m_look->italic()) font.setItalic(true); if (m_look->bold()) font.setBold(true); if (isIconButtonHovered) { if (m_look->underlineInside()) font.setUnderline(true); } else { if (m_look->underlineOutside()) font.setUnderline(true); } return font; }
void BearerEx::showConfigurations() { listWidget->clear(); QListWidgetItem* listItem; QNetworkConfiguration defaultConfig = m_NetworkConfigurationManager.defaultConfiguration(); if (defaultConfig.type() == QNetworkConfiguration::UserChoice) { listItem = new QListWidgetItem(); QFont font = listItem->font(); font.setBold(true); font.setUnderline(true); listItem->setFont(font); listItem->setText(" UserChoice"); listItem->setData(Qt::UserRole, qVariantFromValue(defaultConfig)); listWidget->addItem(listItem); } QList<QNetworkConfiguration> configurations = m_NetworkConfigurationManager.allConfigurations(); for (int i=0; i<configurations.count(); i++) { listItem = new QListWidgetItem(); QString text; if (configurations[i].type() == QNetworkConfiguration::InternetAccessPoint) { text.append("(IAP,"); } else if (configurations[i].type() == QNetworkConfiguration::ServiceNetwork) { text.append("(SNAP,"); } if ((configurations[i].state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { text.append("Act) "); } else if ((configurations[i].state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { text.append("Disc) "); } else { text.append("Def) "); } text.append(configurations[i].name()); if (defaultConfig.isValid() && defaultConfig == configurations[i]) { QFont font = listItem->font(); font.setBold(true); font.setUnderline(true); listItem->setFont(font); } listItem->setText(text); listItem->setData(Qt::UserRole, qVariantFromValue(configurations[i])); listWidget->addItem(listItem); } }
bool fromString(const QString & szValue, QFont & buffer) { KviCString str = szValue; KviCString family, pointSize, styleHint, weight, options; str.getToken(family, ','); str.getToken(pointSize, ','); str.getToken(styleHint, ','); str.getToken(weight, ','); if(!family.isEmpty()) buffer.setFamily(family.ptr()); int i; bool bOk; i = pointSize.toInt(&bOk); if(bOk && (i > 0)) buffer.setPointSize(i); i = styleHint.toInt(&bOk); if(bOk && (i >= 0)) buffer.setStyleHint((QFont::StyleHint)i); i = weight.toInt(&bOk); if(bOk && (i >= 0)) buffer.setWeight(i); buffer.setBold(str.contains("b")); buffer.setItalic(str.contains("i")); buffer.setUnderline(str.contains("u")); buffer.setStrikeOut(str.contains("s")); buffer.setFixedPitch(str.contains("f")); return true; }
void tst_QStaticText::drawUnderlinedText() { QPixmap imageDrawText(1000, 1000); QPixmap imageDrawStaticText(1000, 1000); imageDrawText.fill(Qt::white); imageDrawStaticText.fill(Qt::white); QString s = QString::fromLatin1("Foobar"); QFont font; font.setUnderline(true); { QPainter p(&imageDrawText); p.setFont(font); p.drawText(QPointF(50, 50), s); } { QPainter p(&imageDrawStaticText); QStaticText text = QStaticText(s); p.setFont(font); p.drawStaticText(QPointF(50, 50 - QFontMetricsF(p.font()).ascent()), text); } #if defined(DEBUG_SAVE_IMAGE) imageDrawText.save("drawUnderlinedText_imageDrawText.png"); imageDrawStaticText.save("drawUnderlinedText_imageDrawStaticText.png"); #endif QCOMPARE(imageDrawText, imageDrawStaticText); }
/*! * Обновление информации. */ bool UserItem::reload() { setText(m_user->name()); setIcon(ChatIcons::icon(m_user)); const int acl = ClientFeeds::match(m_channel, m_user); if (acl != -1) { QFont font = this->font(); if (m_user->status() != Status::Offline) { m_bold = acl & Acl::Edit || acl & Acl::SpecialWrite; m_italic = !(acl & Acl::Write) || Hooks::MessagesImpl::isIgnored(m_user); m_underline = acl & Acl::SpecialEdit; } else { m_bold = false; m_italic = true; m_underline = false; } font.setBold(m_bold); font.setItalic(m_italic); font.setUnderline(m_underline); setFont(font); } setForeground(color()); setData(QString::number(weight()) + m_user->name().toLower()); return true; }
//对字体的支持 QFont obs_data_get_qfont(obs_data_t *data, const char *name){ obs_data_t *font_obj = obs_data_get_obj(data, name); const char *face = obs_data_get_string(font_obj, "face"); const char *style = obs_data_get_string(font_obj, "style"); int size = (int)obs_data_get_int(font_obj, "size"); uint32_t flags = (uint32_t)obs_data_get_int(font_obj, "flags"); QFont font; if (face) { font.setFamily(face); font.setStyleName(style); } if (size) font.setPointSize(size); if (flags & OBS_FONT_BOLD) font.setBold(true); if (flags & OBS_FONT_ITALIC) font.setItalic(true); if (flags & OBS_FONT_UNDERLINE) font.setUnderline(true); if (flags & OBS_FONT_STRIKEOUT) font.setStrikeOut(true); return font; }
void FormText::clearFormat() { QTextCursor c = textCursor(); if( c.hasSelection() ) { QTextCharFormat fmt = c.charFormat(); fmt.setFontUnderline( false ); fmt.setFontItalic( false ); fmt.setFontWeight( QFont::Normal ); fmt.setFontPointSize( 10 ); textCursor().setCharFormat( fmt ); } else { QFont f = font(); f.setUnderline( false ); f.setItalic( false ); f.setWeight( QFont::Normal ); f.setPointSize( 10.0 ); setFont( f ); } QRectF r = boundingRect(); r.moveTo( pos() ); d->m_proxy->setRect( r ); }
void FormText::underline( bool on ) { QTextCursor c = textCursor(); if( c.hasSelection() ) { if( c.position() != c.selectionEnd() ) c.setPosition( c.selectionEnd() ); QTextCharFormat fmt = c.charFormat(); fmt.setFontUnderline( on ); textCursor().setCharFormat( fmt ); } else { QFont f = font(); f.setUnderline( on ); setFont( f ); } QRectF r = boundingRect(); r.moveTo( pos() ); d->m_proxy->setRect( r ); }
void XURLLabel::setFont(const QFont & f) { QFont newFont = f; newFont.setUnderline(TRUE); QLabel::setFont(newFont); }
void KUrlLabel::setFont( const QFont& font ) { QFont newFont = font; newFont.setUnderline( d->textUnderlined ); QLabel::setFont( newFont ); }
void Entity::paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { RoundedRectObject::paint(painter, option, widget); // Couper la region déssinée painter->setClipRect(boundingRect()); // Declaration de variables QFontMetrics fontMetrics = painter->fontMetrics(); const qreal padding = 5 ; qreal descent = padding + fontMetrics.descent(); qreal fontHeight = fontMetrics.height(); // Erire le nom de l'entité QString name = m_entity->name() ; qreal x = width() / 2 - padding / 2 - fontMetrics.width(name) / 2 ; qreal y = padding + fontHeight; painter->drawText(x, y, name); // Tracer un trait qreal lineY = fontHeight + 2 * padding + descent; painter->drawLine(0, lineY, width(), lineY); // Ecrire les proprietes QFont underlined = style()->font(); underlined.setUnderline(true); QList<Logic::Property*> pts = m_entity->properties(); for(int i=0; i<pts.size(); i++) { // sourligner les identifiants painter->setFont(pts[i]->isIdentifier()? underlined : style()->font()); qreal pHeight = lineY + (padding + fontHeight)*(i + 1); painter->drawText(padding, pHeight, pts[i]->name()); } }
//------------------------------------------------------------------------ QFont qt_dbtreemodel_impl::_FontRole( const QModelIndex& index ) const { QFont font; const row *r = ( row* ) index.internalPointer(); if( !r ) return font; const TreeModel::Canvas *canvas = _canvas( _content( r->level(), index.column() ), r ); 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; }
/** * Draw the object as an object (default). */ void ObjectWidget::paintObject(QPainter *painter) { QFont oldFont = painter->font(); QFont font = UMLWidget::font(); font.setUnderline(true); painter->setFont(font); setPenFromSettings(painter); if(UMLWidget::useFillColor()) painter->setBrush(UMLWidget::fillColor()); else painter->setBrush(m_scene->backgroundColor()); const int w = width(); const int h = height(); const QString t = m_instanceName + QLatin1String(" : ") + name(); int multiInstOfst = 0; if (m_multipleInstance) { painter->drawRect(10, 10, w - 10, h - 10); painter->drawRect(5, 5, w - 10, h - 10); multiInstOfst = 10; } painter->drawRect(0, 0, w - multiInstOfst, h - multiInstOfst); painter->setPen(textColor()); painter->drawText(O_MARGIN, O_MARGIN, w - O_MARGIN * 2 - multiInstOfst, h - O_MARGIN * 2 - multiInstOfst, Qt::AlignCenter, t); painter->setFont(oldFont); }
void FlyLinks::PopulateTreeWidgetItems( const QMap<QString,QString>& objDataMap) { QMapIterator<QString,QString> objIterMap(objDataMap); QFont font; font.setPointSizeF(8.25); font.setUnderline(true); m_pObjPopup->setSortingEnabled(false); QBrush brush(QColor(85, 0, 255, 255)); brush.setStyle(Qt::NoBrush); QTreeWidgetItem *pItem = new QTreeWidgetItem(m_pObjPopup); pItem = m_pObjPopup->headerItem(); pItem->setText(0,tr("1")); pItem->setFont(0, font); pItem->setForeground(0, brush); pItem->setTextAlignment(0, Qt::AlignLeft); m_pObjTreeItemsVec.push_back(pItem); int iCount = 0; while(objIterMap.hasNext()) { objIterMap.next(); QBrush brush(QColor(85, 0, 255, 255)); brush.setStyle(Qt::NoBrush); QTreeWidgetItem *pItem = new QTreeWidgetItem(m_pObjPopup); pItem = m_pObjPopup->topLevelItem(iCount++); pItem->setText(0,objIterMap.key()); pItem->setData(0,Qt::UserRole,objIterMap.value()); pItem->setFont(0, font); pItem->setForeground(0, brush); pItem->setTextAlignment(0, Qt::AlignLeft); } }
void URLLabel::setFont( const QFont& f ) { QFont newFont = f; newFont.setUnderline( d->Underline ); QLabel::setFont(newFont); }
void TextEdit::setupTextActions() { QMenu *menu = new QMenu(tr("F&ormat"), this); menuBar()->addMenu(menu); actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this); actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); QFont bold; bold.setBold(true); actionTextBold->setFont(bold); connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold())); menu->addAction(actionTextBold); actionTextBold->setCheckable(true); actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this); actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); QFont italic; italic.setItalic(true); actionTextItalic->setFont(italic); connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic())); menu->addAction(actionTextItalic); actionTextItalic->setCheckable(true); actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this); actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); QFont underline; underline.setUnderline(true); actionTextUnderline->setFont(underline); connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline())); menu->addAction(actionTextUnderline); actionTextUnderline->setCheckable(true); menu->addSeparator(); QActionGroup *grp = new QActionGroup(this); connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *))); actionAlignLeft = new QAction(QIcon(rsrcPath + "/textleft.png"), tr("&Left"), grp); actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); actionAlignLeft->setCheckable(true); actionAlignCenter = new QAction(QIcon(rsrcPath + "/textcenter.png"), tr("C&enter"), grp); actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); actionAlignCenter->setCheckable(true); actionAlignRight = new QAction(QIcon(rsrcPath + "/textright.png"), tr("&Right"), grp); actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); actionAlignRight->setCheckable(true); actionAlignJustify = new QAction(QIcon(rsrcPath + "/textjustify.png"), tr("&Justify"), grp); actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); actionAlignJustify->setCheckable(true); menu->addActions(grp->actions()); menu->addSeparator(); QPixmap pix(16, 16); pix.fill(Qt::black); actionTextColor = new QAction(pix, tr("&Color..."), this); connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor())); menu->addAction(actionTextColor); }
AjoutPrecedence::AjoutPrecedence(QWidget *parent) : QDialog(parent), ui(new Ui::AjoutPrecedence), nbTachesAjoutees(0) { ui->setupUi(this); this->setModal(true); ui->treeView->setEditTriggers(0); EditeurTache::predecesseurs.clear(); for(QMap<QString, Projet*>::const_iterator it= ProjetManager::getInstance().getProjets().cbegin(); it!=ProjetManager::getInstance().getProjets().cend(); it++){//parcours des projets QStandardItem* item = new QStandardItem((*it)->getNom()); QFont f = QFont(); f.setBold(true); f.setUnderline(true); item->setFont(f); modele.appendRow(item); for(QMap<QString, Tache*>::const_iterator it2 = (*it)->getTaches().cbegin(); it2!=(*it)->getTaches().cend(); it2++){//parcours des taches de chaque projet QStandardItem* item2 = new QStandardItem((*it2)->getId());//création de l'identifiant de la tache item2->setCheckable(true); //ajout de la checkbox item->appendRow(item2); //ajout de item2 au projet nbTachesAjoutees++; } } ui->treeView->setModel(&modele); QObject::connect(ui->pushButtonAnnuler, SIGNAL(clicked()),this,SLOT(close())); QObject::connect(ui->pushButtonOK, SIGNAL(clicked()),this,SLOT(EnregistrerPred())); }
QFont stripStyleName(QFont &f, QFontDatabase &db) { const QString &styleName = f.styleName(); if (styleName.isEmpty()) { return f; } else { QFont g = (db.styleString(f) != styleName) ? db.font(f.family(), styleName, f.pointSize()) : QFont(f.family(), f.pointSize(), f.weight()); if (auto s = f.pixelSize() > 0) { g.setPixelSize(s); } g.setStyleHint(f.styleHint(), f.styleStrategy()); g.setStyle(f.style()); if (f.underline()) { g.setUnderline(true); } if (f.strikeOut()) { g.setStrikeOut(true); } if (f.fixedPitch()) { g.setFixedPitch(true); } return g; } }
DetailsViewer::DetailsViewer(Node *node, GraphWidget *graphWidget, QTabWidget *tabs, QWidget *parent): QWidget(parent), m_node(node), m_mapper(new QSignalMapper()), m_tabs(tabs), m_rows(), m_rowCount(0), m_graphWidget(graphWidget) { QVBoxLayout *mainLayout = new QVBoxLayout(); QVBoxLayout *dataTypesBox = new QVBoxLayout(); m_table = new QTableWidget(node->getAllSubData().count(), 4); // Title m_title = new QLabel(node->fqdn()); QFont font = m_title->font(); font.setBold(true); font.setUnderline(true); font.setPointSize(16); m_title->setFont(font); m_title->setAlignment(Qt::AlignCenter); dataTypesBox->addWidget(m_title); // // Data Collected Info // dataTypesBox->addWidget(m_table); int itemnum = 0; m_table->setHorizontalHeaderItem(itemnum++, new QTableWidgetItem(tr("Record Type"))); m_table->setHorizontalHeaderItem(itemnum++, new QTableWidgetItem(tr("Status"))); m_table->setHorizontalHeaderItem(itemnum++, new QTableWidgetItem(tr("Data"))); m_table->verticalHeader()->hide(); setNode(node); mainLayout->addWidget(m_table); setLayout(mainLayout); }
/** * Overrides the standard paint event. */ void UseCaseWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); setPenFromSettings(painter); if (UMLWidget::useFillColor()) painter->setBrush(UMLWidget::fillColor()); QFont font = UMLWidget::font(); font.setUnderline(false); font.setBold(false); font.setItalic(m_umlObject->isAbstract()); painter->setFont(font); const QFontMetrics &fm = getFontMetrics(FT_NORMAL); const int fontHeight = fm.lineSpacing(); const int w = width(); const int h = height(); //int middleX = w / 2; bool drawStereotype = umlObject() && !umlObject()->stereotype().isEmpty(); const int textStartY = (h / 2) - (drawStereotype ? fontHeight / 4 : fontHeight / 2); painter->drawEllipse(0, 0, w, h); painter->setPen(textColor()); if (drawStereotype) painter->drawText(UC_MARGIN, textStartY-fontHeight, w - UC_MARGIN * 2, fontHeight, Qt::AlignCenter, umlObject()->stereotype(true)); painter->drawText(UC_MARGIN, textStartY, w - UC_MARGIN * 2, fontHeight, Qt::AlignCenter, name()); setPenFromSettings(painter); UMLWidget::paint(painter, option, widget); }
// The QItemDelegate documentation says // "When displaying items from a custom model in a standard view, it is // often sufficient to simply ensure that the model returns appropriate // data for each of the roles that determine the appearance of items in // views." // We might want to move this to a delegate regardless. QVariant ProtoTreeModel::data(const QModelIndex &index, int role) const { ProtoNode index_node = protoNodeFromIndex(index); FieldInformation finfo(index_node.protoNode()); if (!finfo.isValid()) { return QVariant(); } switch (role) { case Qt::DisplayRole: return index_node.labelText(); case Qt::BackgroundRole: { switch(finfo.flag(PI_SEVERITY_MASK)) { case(0): break; case(PI_COMMENT): return ColorUtils::expert_color_comment; case(PI_CHAT): return ColorUtils::expert_color_chat; case(PI_NOTE): return ColorUtils::expert_color_note; case(PI_WARN): return ColorUtils::expert_color_warn; case(PI_ERROR): return ColorUtils::expert_color_error; default: g_warning("%s:%d Unhandled severity flag: %u", G_STRFUNC, __LINE__, finfo.flag(PI_SEVERITY_MASK)); } if(finfo.headerInfo().type == FT_PROTOCOL) { return QApplication::palette().window(); } return QApplication::palette().base(); } case Qt::ForegroundRole: { if(finfo.flag(PI_SEVERITY_MASK)) { return ColorUtils::expert_color_foreground; } if (finfo.isLink()) { return QApplication::palette().link(); } if(finfo.headerInfo().type == FT_PROTOCOL) { return QApplication::palette().windowText(); } return QApplication::palette().text(); } case Qt::FontRole: if (finfo.isLink()) { QFont font; font.setUnderline(true); return font; } default: break; } return QVariant(); }
void ComponentWidget::draw(QPainter & p, int offsetX, int offsetY) { UMLComponent *umlcomp = static_cast<UMLComponent*>(m_pObject); if (umlcomp == NULL) return; UMLWidget::setPen(p); if ( umlcomp->getExecutable() ) { QPen thickerPen = p.pen(); thickerPen.setWidth(2); p.setPen(thickerPen); } if ( UMLWidget::getUseFillColour() ) { p.setBrush( UMLWidget::getFillColour() ); } else { p.setBrush( m_pView->viewport()->backgroundColor() ); } const int w = width(); const int h = height(); QFont font = UMLWidget::getFont(); font.setBold(true); const QFontMetrics &fm = getFontMetrics(FT_BOLD); const int fontHeight = fm.lineSpacing(); QString name = getName(); const QString stereotype = m_pObject->getStereotype(); p.drawRect(offsetX + 2*COMPONENT_MARGIN, offsetY, w - 2*COMPONENT_MARGIN, h); p.drawRect(offsetX, offsetY + h/2 - fontHeight/2 - fontHeight, COMPONENT_MARGIN*4, fontHeight); p.drawRect(offsetX, offsetY + h/2 + fontHeight/2, COMPONENT_MARGIN*4, fontHeight); p.setPen( QPen(Qt::black) ); p.setFont(font); int lines = 1; if (!stereotype.isEmpty()) { p.drawText(offsetX + (COMPONENT_MARGIN*4), offsetY + (h/2) - fontHeight, w - (COMPONENT_MARGIN*4), fontHeight, Qt::AlignCenter, m_pObject->getStereotype(true)); lines = 2; } if ( UMLWidget::getIsInstance() ) { font.setUnderline(true); p.setFont(font); name = UMLWidget::getInstanceName() + " : " + name; } if (lines == 1) { p.drawText(offsetX + (COMPONENT_MARGIN*4), offsetY + (h/2) - (fontHeight/2), w - (COMPONENT_MARGIN*4), fontHeight, Qt::AlignCenter, name ); } else { p.drawText(offsetX + (COMPONENT_MARGIN*4), offsetY + (h/2), w - (COMPONENT_MARGIN*4), fontHeight, Qt::AlignCenter, name ); } if(m_bSelected) { drawSelected(&p, offsetX, offsetY); } }
void TextItem::setUnderline(bool u) { QFont f = font(); if(u != f.underline()) { f.setUnderline(u); QGraphicsTextItem::setFont(f); } }
OverlayHistoryWindow( const QString& title, const OverlayHistoryList& history, int width, int padding, int rowSpacing, float titleFontSize, float rowFontSize ) : mTitle( title ), mHistory( history ), mWidth( width ), mPadding( padding ), mRowSpacing( rowSpacing ) { mRowFont.setPointSize( titleFontSize ); mTitleFont.setPointSize( rowFontSize ); mTitleFont.setUnderline( true ); mTitleFont.setBold( true ); }
LinkLabel::LinkLabel(QWidget *parent, const char *name) : QLabel(parent, name) { setCursor(QCursor(PointingHandCursor)); QFont f = font(); f.setUnderline(true); setFont(f); }
/** * Receives the correct frequency signal. * Makes the UI to visualize correct frequency event. */ void GuitarTunerUI::correctFrequencyObtained() { qDebug() << "CORRECT FREQUENCY"; QFont font; font.setBold(true); font.setUnderline(true); ui->noteLabel->setFont(font); }