//TODO - learn about DPI and point sizes and others; now is purely written by trial and error int Utils::estimateQToolButtonSize() { const int MIN_SIZE = 15; //under 15 pixel should be an error const int PIXEL_FROM_FONT_SCALE = 2; const float POINT_FROM_FONT_SCALE = 3; const float SCREEN_RATIO_SCALE = 0.4; const int DEFAULT_SIZE = 35; QFont font; float defaultFontSize = font.pixelSize() * PIXEL_FROM_FONT_SCALE; //increasingly desperate computations: if (defaultFontSize <= MIN_SIZE) { defaultFontSize = font.pointSize() * POINT_FROM_FONT_SCALE; printf("%s - warning, trying QFont.pointSize():%f\n", __func__, defaultFontSize); } if (defaultFontSize <= MIN_SIZE) { QScreen* screen = QGuiApplication::primaryScreen(); float auxFontSize = SCREEN_RATIO_SCALE * screen->geometry().width(); defaultFontSize = auxFontSize; printf("%s - warning, screen geometry:%f\n", __func__, defaultFontSize); } if (defaultFontSize <= MIN_SIZE) { defaultFontSize = DEFAULT_SIZE; printf("%s - warning, will assume dumb size:%f\n", __func__, defaultFontSize); } return defaultFontSize; }
void Vruler::drawNumber(QString num, int starty, QPainter *p) { int textY = starty; for (int a = 0; a < num.length(); ++a) { QString txt = num.mid(a, 1); #ifndef Q_WS_MAC p->drawText(1, textY, txt); #else static const int SCALE = 16; QFontMetrics fm = p->fontMetrics(); QRect bbox = fm.boundingRect(txt); static QPixmap pix; if (pix.width() < bbox.width()*SCALE || pix.height() < bbox.height()*SCALE) pix = QPixmap(bbox.width()*SCALE, bbox.height()*SCALE); QFont fnt = p->font(); QPainter p2; pix.fill(); p2.begin( &pix ); if (fnt.pointSize() > 0) fnt.setPointSize(SCALE*fnt.pointSize()-SCALE/2); else if (fnt.pixelSize() > 0) fnt.setPixelSize(SCALE*fnt.pixelSize()-SCALE/2); else fnt.setPixelSize(SCALE); p2.setFont(fnt); p2.drawText(-bbox.x()*SCALE, -bbox.y()*SCALE, txt); p2.end(); p->scale(1.0/SCALE,1.0/SCALE); p->drawPixmap(1*SCALE, (textY+bbox.top())*SCALE, pix, 0, 0, bbox.width()*SCALE, bbox.height()*SCALE); p->scale(SCALE,SCALE); #endif textY += 11; } }
//------------------------------------------------------------------------------ // Provides required font size for wrapping text without clipping inside a given rect //------------------------------------------------------------------------------ int MercuryPalette::GetFontSizePxForRectWrapped( QRect rect, QFont font, QString stringToFit ) { // QFontMetrics::bouncingRect(), when supplied with a rect, constrains the result to that rect. We therefore supply // a heightened version of the required rect, and decrease font size until we fall within the needed size. QFontMetrics fm( font ); QRect heightenedTestRect = QRect( rect.left(), rect.top(), rect.width(), rect.height() * 2 ); while( fm.boundingRect( heightenedTestRect, Qt::TextWordWrap, stringToFit ).height() > rect.height() ) { if( font.pixelSize() > 0 ) { font.setPixelSize( font.pixelSize() - 1 ); fm = QFontMetrics( font ); } else { break; } } // now adjust pixel size so that it fits for width while( fm.boundingRect( heightenedTestRect, Qt::TextWordWrap, stringToFit ).width() > rect.width() ) { if( font.pixelSize() > 0 ) { font.setPixelSize( font.pixelSize() - 1 ); fm = QFontMetrics( font ); } else { break; } } return font.pixelSize(); }
void message_view::setFont(const QFont& font) { m_headersv->setFont(font); QString s="body {"; if (!font.family().isEmpty()) { s.append("font-family:\"" + font.family() + "\";"); } if (font.pointSize()>1) { s.append(QString("font-size:%1 pt;").arg(font.pointSize())); } else if (font.pixelSize()>1) { s.append(QString("font-size:%1 px;").arg(font.pixelSize())); } if (font.bold()) { s.append("font-weight: bold;"); } if (font.style()==QFont::StyleItalic) { s.append("font-style: italic;"); } else if (font.style()==QFont::StyleOblique) { s.append("font-style: oblique;"); } s.append("}\n"); m_bodyv->set_body_style(s); // m_bodyv->redisplay(); }
void body_view::set_font(const QFont& font) { QString s; if (!font.family().isEmpty()) { s.append("font-family:\"" + font.family() + "\";"); } if (font.pointSize()>1) { s.append(QString("font-size:%1 pt;").arg(font.pointSize())); } else if (font.pixelSize()>1) { s.append(QString("font-size:%1 px;").arg(font.pixelSize())); } if (font.bold()) { s.append("font-weight: bold;"); } if (font.style()==QFont::StyleItalic) { s.append("font-style: italic;"); } else if (font.style()==QFont::StyleOblique) { s.append("font-style: oblique;"); } m_font_css=s; set_body_style(); }
static void zoom(QWidget *w, double factor) { QFont font = w->font(); if (font.pointSize() > 0) font.setPointSize(qBound(6., factor * font.pointSize(), 10000.)); else if (font.pixelSize() > 0) font.setPixelSize(qBound(6., factor * font.pixelSize(), 10000.)); else qCritical("%s: oops", Q_FUNC_INFO); w->setFont(font); }
QString qssifyFont(QFont font) { return QString("%1 %2px \"%3\"") .arg(font.weight()*8) .arg(font.pixelSize()) .arg(font.family()); }
void KexiTitleLabel::updateFont() { if (!d->updateFontEnabled) return; KexiUtils::BoolBlocker guard(d->updateFontEnabled, false); qreal factor; QRect geo = QApplication::desktop()->availableGeometry(this); QFont f = font(); if (geo.width() > 600 && geo.height() > 600) { factor = 2.0; } else { factor = 1.2; f.setBold(true); } //kDebug() << f.pointSize() << f.pixelSize(); if (f.pointSize() == -1) { f.setPixelSize(qreal(f.pixelSize()) * factor); } else { f.setPointSize(f.pointSizeF() * factor); } setFont(f); }
int QFontProto::pixelSize() const { QFont *item = qscriptvalue_cast<QFont*>(thisObject()); if (item) return item->pixelSize(); return 0; }
CalamaresApplication::CalamaresApplication( int& argc, char *argv[] ) : QApplication( argc, argv ) , m_mainwindow( 0 ) { setOrganizationName( QLatin1String( CALAMARES_ORGANIZATION_NAME ) ); setOrganizationDomain( QLatin1String( CALAMARES_ORGANIZATION_DOMAIN ) ); setApplicationName( QLatin1String( CALAMARES_APPLICATION_NAME ) ); setApplicationVersion( QLatin1String( CALAMARES_VERSION ) ); QString startupLocale = QLocale::system().uiLanguages().first(); CalamaresUtils::installTranslator( startupLocale, this ); QFont f = font(); cDebug() << "Default font =====" << "\nPixel size: " << f.pixelSize() << "\nPoint size: " << f.pointSize() << "\nPoint sizeF: " << f.pointSizeF() << "\nFont family: " << f.family() << "\nMetric height:" << QFontMetrics( f ).height(); // The following line blocks for 15s on Qt 5.1.0 cDebug() << "Font height:" << QFontMetrics( f ).height(); CalamaresUtils::setDefaultFontSize( f.pointSize() ); cDebug() << "Available languages:" << QString( CALAMARES_TRANSLATION_LANGUAGES ).split( ';' ); }
QWidget *CustCharacteristicDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /*style*/, const QModelIndex & index) const { if(index.column()!=1) return 0; QModelIndex idx = index.sibling(index.row(), 0); q.prepare("SELECT charass_value" " FROM charass, char" " WHERE ((charass_char_id=char_id)" " AND (charass_target_type='CT')" " AND (charass_target_id=:custtype_id)" " AND (char_id=:char_id) );"); q.bindValue(":char_id", idx.model()->data(idx, Qt::UserRole)); q.bindValue(":custtype_id", index.model()->data(index, Qt::UserRole)); q.exec(); QComboBox *editor = new QComboBox(parent); editor->setEditable(true); #ifdef Q_WS_MAC QFont boxfont = editor->font(); boxfont.setPointSize((boxfont.pointSize() == -1) ? boxfont.pixelSize() - 3 : boxfont.pointSize() - 3); editor->setFont(boxfont); #endif while(q.next()) editor->addItem(q.value("charass_value").toString()); editor->installEventFilter(const_cast<CustCharacteristicDelegate*>(this)); return editor; }
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; } }
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) font.setStyleStrategy(QFont::NoAntialias); #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) if (description.fontSmoothing() == AutoSmoothing && !Font::shouldUseSmoothing()) font.setStyleStrategy(QFont::NoAntialias); #endif 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 PrimitivePainter::drawPointLabel(QPointF C, QString str, QString strBg, QPainter* thePainter, qreal PixelPerM) const { LineParameters lp = labelBoundary(); qreal WW = PixelPerM*lp.Proportional+lp.Fixed; if (WW < 10) return; QFont font = getLabelFont(); font.setPixelSize(int(WW)); QFontMetrics metrics(font); int modX = 0; int modY = 0; QPainterPath textPath; QPainterPath bgPath; if (!str.isEmpty()) { modX = - (metrics.width(str)/2); if (DrawIcon && !IconName.isEmpty() ) { QImage pm(IconName); modY = - pm.height(); if (DrawLabelBackground) modY -= BG_SPACING; } textPath.addText(modX, modY, font, str); thePainter->translate(C); } if (DrawLabelBackground && !strBg.isEmpty()) { modX = - (metrics.width(strBg)/2); if (DrawIcon && !IconName.isEmpty() ) { QImage pm(IconName); modY = - pm.height(); if (DrawLabelBackground) modY -= BG_SPACING; } textPath.addText(modX, modY, font, strBg); thePainter->translate(C); bgPath.addRect(textPath.boundingRect().adjusted(-BG_SPACING, -BG_SPACING, BG_SPACING, BG_SPACING)); thePainter->setPen(QPen(LabelColor, BG_PEN_SZ)); thePainter->setBrush(LabelBackgroundColor); thePainter->drawPath(bgPath); } if (getLabelHalo()) { thePainter->setPen(QPen(Qt::white, font.pixelSize()/5)); thePainter->drawPath(textPath); } thePainter->setPen(Qt::NoPen); thePainter->setBrush(LabelColor); thePainter->drawPath(textPath); if (DrawLabelBackground && !strBg.isEmpty()) { QRegion rg = thePainter->clipRegion(); rg -= textPath.boundingRect().toRect().translated(C.toPoint()); thePainter->setClipRegion(rg); } }
void CScheduleListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { painter->save(); QLinearGradient grad(option.rect.topLeft(),option.rect.bottomLeft()); grad.setColorAt(0,QColor(0,192,255,16)); grad.setColorAt(0.5,QColor(0,192,255,192)); grad.setColorAt(1,QColor(0,192,255,16)); QBrush brush(grad); if(option.state & QStyle::State_Selected) { painter->fillRect(option.rect.adjusted(0,0,-1,-1),brush); } const CScheduleItem& item = index.data(CScheduleView::ScheduleItemRole).value<CScheduleItem>(); //-F- Drawing Item QFont bigFont = painter->font(); bigFont.setPixelSize(bigFont.pixelSize()*2); bigFont.setBold(true); int delta = option.rect.height()/2.2; QString strWeekDays; if((item.WeekDays&0x7F)==0x7F) { strWeekDays="Every Day"; } else if((item.WeekDays&0x1F)==0x1F) { strWeekDays="Every Working Day"; } else { for(int i=0;i<7;i++) { strWeekDays+= (item.WeekDays&(1<<i) ? strDays[i] : ""); strWeekDays+= " "; } } painter->drawText(option.rect.left()+130,option.rect.top()+(int)(delta*0.9),strWeekDays); painter->drawText(option.rect.left()+130,option.rect.top()+(int)(delta*1.9),item.Description); painter->setFont(bigFont); QRect rect= option.rect; rect.setRight(130); rect.setLeft(40); painter->drawText(rect,Qt::AlignVCenter | Qt::AlignLeft ,item.Time.toString("HH:mm")); //-F- Painting Icon if(item.Type>CScheduleItem::DISABLED) { painter->drawImage(5,(rect.height()-images[(int)item.Type-1].height())/2+rect.top(),images[(int)item.Type-1]); } painter->restore(); }
QWidget *CustCharacteristicDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /*style*/, const QModelIndex & index) const { if(index.column()!=1) return 0; QModelIndex idx = index.sibling(index.row(), 0); characteristic::Type chartype = characteristic::Text; // Determine what type we have XSqlQuery qry; qry.prepare("SELECT char_id, char_type " "FROM char " "WHERE (char_id=:char_id); "); qry.bindValue(":char_id", idx.model()->data(idx, Qt::UserRole)); qry.exec(); if (qry.first()) chartype = (characteristic::Type)qry.value("char_type").toInt(); if (chartype == characteristic::Text || chartype == characteristic::List) { q.prepare("SELECT charass_value " "FROM char, charass " " LEFT OUTER JOIN charopt ON ((charopt_char_id=charass_char_id) " " AND (charopt_value=charass_value)) " "WHERE ((charass_char_id=char_id)" " AND (charass_target_type='CT')" " AND (charass_target_id=:custtype_id)" " AND (char_id=:char_id) ) " "ORDER BY COALESCE(charopt_order,0), charass_value;"); q.bindValue(":char_id", idx.model()->data(idx, Qt::UserRole)); q.bindValue(":custtype_id", index.model()->data(index, Xt::IdRole)); q.exec(); QComboBox *editor = new QComboBox(parent); editor->setEditable(chartype == characteristic::Text); #ifdef Q_WS_MAC QFont boxfont = editor->font(); boxfont.setPointSize((boxfont.pointSize() == -1) ? boxfont.pixelSize() - 3 : boxfont.pointSize() - 3); editor->setFont(boxfont); #endif while(q.next()) editor->addItem(q.value("charass_value").toString()); editor->installEventFilter(const_cast<CustCharacteristicDelegate*>(this)); return editor; } else if (chartype == characteristic::Date) { DLineEdit *editor = new DLineEdit(parent); return editor; } return 0; }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tTripTabPage::GenerateLayout() { // Create common tab controls m_pTripEnableCheck = new tCheckBox( false, this ); m_pStatusMessage = new QLabel( this ); QFont statusFont = m_pStatusMessage->font(); statusFont.setPixelSize( qRound( statusFont.pixelSize() * 0.9 ) ); m_pStatusMessage->setFont( statusFont ); m_pShowResetOptionsButton = new tPushButton( this ); m_pShowResetOptionsButton->setMinimumWidth( 75 ); m_pShowResetOptionsButton->setText( tr( "Reset" ) + "..." ); m_pShowResetOptionsButton->setToolTip( tr( "Reset individual or all counters." ) ); Connect( m_pShowResetOptionsButton, SIGNAL( clicked( bool ) ), this, SLOT( OnShowResetOptions() ) ); m_pShowResetOptionsButton->installEventFilter( this ); m_pAdjustButton = new tPushButton( this ); m_pAdjustButton->setMinimumWidth( 75 ); m_pAdjustButton->setText( tr( "Adjust" ) + "..." ); m_pAdjustButton->setToolTip( tr( "Adjust Threshold" ) ); Connect( m_pAdjustButton, SIGNAL( clicked( bool ) ), this, SLOT( ShowAdjustDialog() ) ); m_pAdjustButton->installEventFilter( this ); // Create gauges that will display trip info tDataId dataId = tDataId( DATA_TYPE_TRIP_DISTANCE, (char)m_InstanceId, DATA_ENGINE_MISCELLANEOUS ); m_pDistanceGauge = tDigitalGauge::Create( dataId, this ); m_pDistanceGauge->SetBezelEnabled( false ); m_pDistanceGauge->SetInvertedText( false ); dataId.SetDataType( DATA_TYPE_WATER_DISTANCE ); m_pWaterDistanceGauge = tDigitalGauge::Create( dataId, this ); m_pWaterDistanceGauge->SetBezelEnabled( false ); m_pWaterDistanceGauge->SetInvertedText( false ); dataId.SetDataType( DATA_TYPE_TRIP_TIME ); m_pTimeGauge = tDigitalGauge::Create( dataId, this ); m_pTimeGauge->SetBezelEnabled( false ); m_pTimeGauge->SetInvertedText( false ); dataId.SetDataType( DATA_TYPE_SPEED_TRIP_AVG ); m_pAverageSpeedGauge = tDigitalGauge::Create( dataId, this ); m_pAverageSpeedGauge->SetBezelEnabled( false ); m_pAverageSpeedGauge->SetInvertedText( false ); dataId.SetDataType( DATA_TYPE_SPEED_TRIP_MAX ); m_pMaximumSpeedGauge = tDigitalGauge::Create( dataId, this ); m_pMaximumSpeedGauge->SetBezelEnabled( false ); m_pMaximumSpeedGauge->SetInvertedText( false ); m_GaugeList << m_pDistanceGauge << m_pWaterDistanceGauge << m_pTimeGauge << m_pAverageSpeedGauge << m_pMaximumSpeedGauge; // Configure specific differences for standard v Today trip tabs if( m_eLogType == eTripLog ) { m_pTripEnableCheck->setChecked( tDigitalDataManager::Instance()->GetTripLogSettings()->Enabled( m_InstanceId ) ); UpdateTripEnableToolTip(); Connect( m_pTripEnableCheck, SIGNAL( toggled( bool ) ), this, SLOT( OnEnabledChanged( bool ) ) ); }
void MainWindow::setFont(QFont font) { ui_.editChinese->setFont(font); model_->setChFont(font); qDebug() << "Font set to: " << font.rawName() << " " << font.pixelSize() << " px"; font_ = font; }
// // Calculates and sets the correct font size in points // depending on the size multiplier and base font. // void QQuickStyledTextPrivate::setFontSize(int size, QTextCharFormat &format) { static const qreal scaling[] = { 0.7, 0.8, 1.0, 1.2, 1.5, 2.0, 2.4 }; if (baseFont.pointSizeF() != -1) format.setFontPointSize(baseFont.pointSize() * scaling[size - 1]); else format.setFontPointSize(baseFont.pixelSize() * qreal(72.) / qreal(qt_defaultDpi()) * scaling[size - 1]); *fontSizeModified = true; }
QString QtPropertyBrowserUtils::fontValueText(const QFont &f) { int size = f.pointSize(); if (size == -1) size = f.pixelSize(); return QCoreApplication::translate("QtPropertyBrowserUtils", "[%1, %2]") .arg(f.family()).arg(size); }
QString QPF::fileNameForFont(const QFont &f) { QString fileName = f.family().toLower() + "_" + QString::number(f.pixelSize()) + "_" + QString::number(f.weight()) + (f.italic() ? "_italic" : "") + ".qpf2"; fileName.replace(QLatin1Char(' '), QLatin1Char('_')); return fileName; }
void GeneralForm::on_txtChatFont_currentFontChanged(const QFont& f) { QFont tmpFont = f; const int fontSize = bodyUI->txtChatFontSize->value(); if (tmpFont.pixelSize() != fontSize) tmpFont.setPixelSize(fontSize); Settings::getInstance().setChatMessageFont(tmpFont); }
//Subclassed functions void LuminaThemeStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole) const{ /*QFont cfont = painter->font(); cfont.setHintingPreference(QFont::PreferFullHinting); QFont outfont = cfont; outfont.setStretch(101); outfont.setLetterSpacing(QFont::PercentageSpacing, 99); //Paint the background outline if(darkfont){ painter->setPen(QPen(Qt::white)); } else{ painter->setPen(QPen(Qt::black)); } painter->setFont(outfont); //QRect outline = QRect(rect.left()+2, rect.top()+2, rect.right()+2, rect.bottom()+2); painter->drawText(rect, text); //Paint the text itself (Make this respect the "enabled" flag later) painter->setFont(cfont); if(darkfont){ painter->setPen(QPen(Qt::black)); } else{ painter->setPen(QPen(Qt::white)); } painter->drawText(rect, text);*/ QFont font = painter->font(); QFont cfont = font; //save for later if(font.pixelSize()>0){ font.setPixelSize( font.pixelSize()-4); } else{ font.setPointSize(font.pointSize()-1); } painter->setFont(font); //Create the path QPainterPath path; //path.setFillRule(Qt::WindingFill); path.addText(rect.left(), rect.center().y()+(painter->fontMetrics().xHeight()/2), painter->font(), text); //Now set the border/fill colors QPen pen; pen.setWidth(2); if(darkfont){ pen.setColor(Qt::white); painter->fillPath(path,Qt::black); }else{ pen.setColor(Qt::black); painter->fillPath(path,Qt::white); } painter->setPen(pen); painter->drawPath(path); painter->setFont(cfont); //reset back to original font }
const QFont FontUtils::small() { static QFont font; static bool initialized = false; if (!initialized) { initialized = true; font.setPointSize(font.pointSize()*.85); if (font.pixelSize() < MIN_PIXEL_SIZE) font.setPixelSize(MIN_PIXEL_SIZE); } return font; }
void MeasureDisplay::resizeEvent(QResizeEvent *event) { Q_UNUSED(event); // Get font and font matrics QFontMetrics metrics(ui->lblMeasurement->font()); QFont labelFont = ui->lblMeasurement->font(); // Calculate widths int stringWidth = metrics.width(ui->lblMeasurement->text()); // Find out how much can the font grow float widthRatio = (float)ui->lblMeasurement->width() / (float)stringWidth; int newFontSize = (int) ((labelFont.pixelSize() == -1 ? labelFont.pointSize() : labelFont.pixelSize()) * widthRatio); labelFont.setPointSize(std::min(newFontSize, ui->lblMeasurement->height())); ui->lblMeasurement->setFont(labelFont); }
//------------------------------------------------------------------------------ // Provides required font size to scale down single line of text to a given width //------------------------------------------------------------------------------ int MercuryPalette::GetFontSizePxForWidth( int reqWidth, QFont font, QString stringToFit ) { if ( reqWidth > 0 ) { QFontMetrics fm( font ); while( fm.width( stringToFit ) > reqWidth ) { if( font.pixelSize() > 0 ) { font.setPixelSize( font.pixelSize() - 1 ); fm = QFontMetrics( font ); } else { break; } } } return font.pixelSize(); }
void FontPickerButton::setSelectedFont(const QFont &f) { QFont display = selectedFont = f; if(display.pointSize() > -1) display.setPointSize(qMin(display.pointSize(), 24)); else display.setPixelSize(qMin(display.pixelSize(), 50)); setFont(display); }
ChatMessage::Ptr ChatMessage::createBusyNotification() { ChatMessage::Ptr msg = ChatMessage::Ptr(new ChatMessage); QFont baseFont = Settings::getInstance().getChatMessageFont(); baseFont.setPixelSize(baseFont.pixelSize() + 2); baseFont.setBold(true); msg->addColumn(new Text(QObject::tr("Resizing"), baseFont, false, ""), ColumnFormat(1.0, ColumnFormat::VariableSize, ColumnFormat::Center)); return msg; }
void GeneralForm::on_txtChatFontSize_valueChanged(int arg1) { Settings& s = Settings::getInstance(); QFont tmpFont = s.getChatMessageFont(); if (tmpFont.pixelSize() != arg1) { tmpFont.setPixelSize(arg1); s.setChatMessageFont(tmpFont); } }
float QMMLPainter::fontSize() const { QFont f = p->font(); float size; if (f.pointSize() == -1) { size = f.pixelSize()*72/dpi(false); } else { size = f.pointSizeF(); } return size; }