void tst_QRawFont::explicitRawFontNotAvailableInSystem() { QFETCH(QFont::HintingPreference, hintingPreference); QRawFont rawfont(QLatin1String(SRCDIR "testfont.ttf"), 10, hintingPreference); { QFont font(rawfont.familyName(), 10); QVERIFY(!font.exactMatch()); QVERIFY(font.family() != QFontInfo(font).family()); } }
void tst_QFontDialog::setFont() { /* The font should be the same before as it is after if nothing changed while the font dialog was open. Task #27662 */ bool ok = FALSE; #if defined Q_OS_HPUX QString fontName = "Courier"; int fontSize = 25; #elif defined Q_OS_AIX QString fontName = "Charter"; int fontSize = 13; #else QString fontName = "Arial"; int fontSize = 24; #endif QFont f1(fontName, fontSize); f1.setPixelSize(QFontInfo(f1).pixelSize()); QTimer::singleShot(2000, this, SLOT(postKeyReturn())); QFont f2 = QFontDialog::getFont(&ok, f1); QCOMPARE(QFontInfo(f2).pointSize(), QFontInfo(f1).pointSize()); }
void tst_QFontComboBox::currentFont_data() { QTest::addColumn<QFont>("currentFont"); // Normalize the names QFont defaultFont; QTest::newRow("default") << defaultFont; defaultFont.setPointSize(defaultFont.pointSize() + 10); QTest::newRow("default") << defaultFont; QFontDatabase db; QStringList list = db.families(); for (int i = 0; i < list.count(); ++i) { QFont f = QFont(QFontInfo(QFont(list.at(i))).family()); QTest::newRow(qPrintable(list.at(i))) << f; } }
AbstractClipItem::AbstractClipItem(const ItemInfo &info, const QRectF& rect, double fps) : QObject() , QGraphicsRectItem(rect) , m_info(info) , m_visibleParam(0) , m_selectedEffect(-1) , m_fps(fps) , m_isMainSelectedClip(false) , m_keyframeView(QFontInfo(QApplication::font()).pixelSize() * 0.7, this) { setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); setPen(Qt::NoPen); connect(&m_keyframeView, SIGNAL(updateKeyframes(const QRectF&)), this, SLOT(doUpdate(const QRectF&))); }
void EditorRichText::setDefaultFont(QFont font) { // Some default fonts on Windows have a default size of 7.8, // which results in complicated rich text generated by toHtml(). // Use an integer value. const int pointSize = qRound(font.pointSizeF()); if (pointSize > 0 && !qFuzzyCompare(qreal(pointSize), font.pointSizeF())) font.setPointSize(pointSize); document()->setDefaultFont(font); if (font.pointSize() > 0) setFontPointSize(font.pointSize()); else setFontPointSize(QFontInfo(font).pointSize()); emit textChanged(); }
QFont KgvGlobal::_defaultFont() { QFont font = KGlobalSettings::generalFont(); // we have to use QFontInfo, in case the font was specified with a pixel size if ( font.pointSize() == -1 ) { // cache size into m_pointSize, since QFontInfo loads the font -> slow if ( m_pointSize == -1 ) m_pointSize = QFontInfo(font).pointSize(); Q_ASSERT( m_pointSize != -1 ); font.setPointSize( m_pointSize ); } //kDebug()<<"QFontInfo(font).pointSize() :"<<QFontInfo(font).pointSize(); //kDebug()<<"font.name() :"<<font.family (); return font; }
static inline void qwtUnscaleFont( QPainter *painter ) { if ( painter->font().pixelSize() >= 0 ) return; const QSize screenResolution = qwtScreenResolution(); const QPaintDevice *pd = painter->device(); if ( pd->logicalDpiX() != screenResolution.width() || pd->logicalDpiY() != screenResolution.height() ) { QFont pixelFont( painter->font(), QApplication::desktop() ); pixelFont.setPixelSize( QFontInfo( pixelFont ).pixelSize() ); painter->setFont( pixelFont ); } }
void tst_QFontComboBox::currentFont_data() { QTest::addColumn<QFont>("currentFont"); // Normalize the names QFont defaultFont; QFontInfo fi(defaultFont); defaultFont = QFont(fi.family()); // make sure we have a real font name and not something like 'Sans Serif'. QTest::newRow("default") << defaultFont; defaultFont.setPointSize(defaultFont.pointSize() + 10); QTest::newRow("default2") << defaultFont; QFontDatabase db; QStringList list = db.families(); for (int i = 0; i < list.count(); ++i) { QFont f = QFont(QFontInfo(QFont(list.at(i))).family()); QTest::newRow(qPrintable(list.at(i))) << f; } }
//BEGIN class PinItem PinItem::PinItem( FlowCodeDocument* _view, QPoint position, bool _onLeft, PinSettings * pinSettings ) : KtlQCanvasRectangle(0) { m_pinSettings = pinSettings; view = _view; onLeft = _onLeft; connect( m_pinSettings, SIGNAL(settingsChanged()), this, SLOT(updateDrawing()) ); if ( QFontInfo(m_font).pixelSize() > 11 ) // It has to be > 11, not > 12, as (I think) pixelSize() rounds off the actual size m_font.setPixelSize(12); setCanvas( view->canvas() ); move ( position.x(), position.y() ); initItem(); setZ( (ICNDocument::Z::RaisedItem + ICNDocument::Z::ResizeHandle)/2 + 1 ); // Hackish, but whatever }
QFont Style::getFont(Style::Font font) { // fonts as defined in // https://github.com/ItsDuke/Tox-UI/blob/master/UI%20GUIDELINES.md static int defSize = QFontInfo(QFont()).pixelSize(); static QFont fonts[] = { appFont(defSize + 3, QFont::Bold), // extra big appFont(defSize + 1, QFont::Normal), // big appFont(defSize + 1, QFont::Bold), // big bold appFont(defSize, QFont::Normal), // medium appFont(defSize, QFont::Bold), // medium bold appFont(defSize - 1, QFont::Normal), // small appFont(defSize - 1, QFont::Light), // small light }; return fonts[font]; }
QFont Style::getFont(Style::Font font) { // fonts as defined in // https://github.com/ItsDuke/Tox-UI/blob/master/UI%20GUIDELINES.md static int defSize = QFontInfo(QFont()).pixelSize(); static QFont fonts[] = { appFont(defSize + 2, QFont::Bold), appFont(defSize , QFont::Normal), appFont(defSize , QFont::Bold), appFont(defSize - 1, QFont::Normal), appFont(defSize - 1, QFont::Bold), appFont(defSize - 2, QFont::Normal), appFont(defSize - 2, QFont::Light), }; return fonts[font]; }
const QString Style::resolve(const QString& filename, const QFont& baseFont) { QFile file{filename}; if (!file.open(QFile::ReadOnly | QFile::Text)) { qWarning() << "Stylesheet " << filename << " not found"; return QString(""); } QString qss = file.readAll(); if (dict.isEmpty()) { dict = {// colors {"@green", Style::getColor(Style::Green).name()}, {"@yellow", Style::getColor(Style::Yellow).name()}, {"@red", Style::getColor(Style::Red).name()}, {"@black", Style::getColor(Style::Black).name()}, {"@darkGrey", Style::getColor(Style::DarkGrey).name()}, {"@mediumGrey", Style::getColor(Style::MediumGrey).name()}, {"@mediumGreyLight", Style::getColor(Style::MediumGreyLight).name()}, {"@lightGrey", Style::getColor(Style::LightGrey).name()}, {"@white", Style::getColor(Style::White).name()}, {"@orange", Style::getColor(Style::Orange).name()}, {"@themeDark", Style::getColor(Style::ThemeDark).name()}, {"@themeMediumDark", Style::getColor(Style::ThemeMediumDark).name()}, {"@themeMedium", Style::getColor(Style::ThemeMedium).name()}, {"@themeLight", Style::getColor(Style::ThemeLight).name()}, // fonts {"@baseFont", QString::fromUtf8("'%1' %2px").arg(baseFont.family()).arg(QFontInfo(baseFont).pixelSize())}, {"@extraBig", qssifyFont(Style::getFont(Style::ExtraBig))}, {"@big", qssifyFont(Style::getFont(Style::Big))}, {"@bigBold", qssifyFont(Style::getFont(Style::BigBold))}, {"@medium", qssifyFont(Style::getFont(Style::Medium))}, {"@mediumBold", qssifyFont(Style::getFont(Style::MediumBold))}, {"@small", qssifyFont(Style::getFont(Style::Small))}, {"@smallLight", qssifyFont(Style::getFont(Style::SmallLight))}}; } for (const QString& key : dict.keys()) { qss.replace(QRegularExpression(QString("%1\\b").arg(key)), dict[key]); } return qss; }
// public QFont currentFont() const void tst_QFontComboBox::currentFont() { QFETCH(QFont, currentFont); SubQFontComboBox box; QSignalSpy spy0(&box, SIGNAL(currentFontChanged(QFont const&))); QFont oldCurrentFont = box.currentFont(); box.setCurrentFont(currentFont); QString boxFontFamily = QFontInfo(box.currentFont()).family(); QRegExp foundry(" \\[.*\\]"); if (!currentFont.family().contains(foundry)) boxFontFamily.remove(foundry); QCOMPARE(boxFontFamily, currentFont.family()); if (oldCurrentFont != box.currentFont()) { //the signal may be emit twice if there is a foundry into brackets QVERIFY(spy0.count() >= 1); } }
KeyframeHelper::KeyframeHelper(QWidget *parent) : QWidget(parent) , frameLength(1) , m_geom(NULL) , m_position(0) , m_scale(0) , m_movingKeyframe(false) , m_movingItem() , m_hoverKeyframe(-1) , m_seekPosition(SEEK_INACTIVE) { setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); setMouseTracking(true); QPalette p = palette(); m_size = QFontInfo(font()).pixelSize() * 1.8; m_lineHeight = m_size / 2; setMinimumHeight(m_size); setMaximumHeight(m_size); KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); m_selected = scheme.decoration(KColorScheme::HoverColor).color(); m_keyframe = scheme.foreground(KColorScheme::LinkText).color(); }
void tst_QFont::setFontRaw() { #ifndef Q_WS_X11 QSKIP("Only tested on X11"); #else QFont f; f.setRawName("-*-fixed-bold-r-normal--0-0-*-*-*-0-iso8859-1"); // qDebug("font family: %s", f.family().utf8()); QFontDatabase fdb; QStringList families = fdb.families(); bool found = false; for (int i = 0; i < families.size(); ++i) { QString str = families.at(i); if (str.contains('[')) str = str.left(str.indexOf('[')-1); if (str.toLower() == "fixed") found = true; } if (!found) QSKIP("Fixed font not available."); QCOMPARE(QFontInfo(f).family().left(5).toLower(), QString("fixed")); #endif }
void tst_QRawFont::textLayout() { QFontDatabase fontDatabase; int id = fontDatabase.addApplicationFont(SRCDIR "testfont.ttf"); QVERIFY(id >= 0); QString familyName = QString::fromLatin1("QtBidiTestFont"); QFont font(familyName); font.setPixelSize(18.0); #ifdef Q_WS_QPA QEXPECT_FAIL("", "QTBUG-20976 fails on qpa", Abort); #endif QCOMPARE(QFontInfo(font).family(), familyName); QTextLayout layout(QLatin1String("Foobar")); layout.setFont(font); layout.beginLayout(); layout.createLine(); layout.endLayout(); QList<QGlyphRun> glyphRuns = layout.glyphRuns(); QCOMPARE(glyphRuns.size(), 1); QGlyphRun glyphs = glyphRuns.at(0); QRawFont rawFont = glyphs.rawFont(); QVERIFY(rawFont.isValid()); QCOMPARE(rawFont.familyName(), familyName); QCOMPARE(rawFont.pixelSize(), 18.0); QVector<quint32> expectedGlyphIndices; expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86; QCOMPARE(glyphs.glyphIndexes(), expectedGlyphIndices); QVERIFY(fontDatabase.removeApplicationFont(id)); }
AnimKeyframeRuler::AnimKeyframeRuler(int min, int max, QWidget *parent) : QWidget(parent) , frameLength(max - min) , m_position(0) , m_scale(0) , m_movingKeyframe(false) , m_movingKeyframePos(-1) , m_movingKeyframeType(mlt_keyframe_linear) , m_hoverKeyframe(-1) , m_selectedKeyframe(-1) , m_seekPosition(SEEK_INACTIVE) , m_attachedToEnd(-2) { setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); setMouseTracking(true); QPalette p = palette(); m_size = QFontInfo(font()).pixelSize() * 1.8; m_lineHeight = m_size / 2; setMinimumHeight(m_size); setMaximumHeight(m_size); KColorScheme scheme(p.currentColorGroup(), KColorScheme::Window, KSharedConfig::openConfig(KdenliveSettings::colortheme())); m_selected = palette().highlight().color(); m_keyframe = scheme.foreground(KColorScheme::LinkText).color(); }
int main(int argc, char *argv[]) { KLocalizedString::setApplicationDomain("blinken"); QApplication app(argc, argv); KAboutData about("blinken", i18n("Blinken"), "0.4", i18n("A memory enhancement game"), KAboutLicense::GPL, i18n("© 2005-2007 Albert Astals Cid\n© 2005-2007 Danny Allen")); about.addAuthor(i18n("Albert Astals Cid"), i18n("Coding"), "*****@*****.**"); about.addAuthor(i18n("Danny Allen"), i18n("Design, Graphics and Sounds"), "*****@*****.**"); about.addCredit(i18n("Steve Jordi"), i18n("GPL'ed his 'Steve' font so that we could use it"), "*****@*****.**"); KAboutData::setApplicationData(about); KCrash::initialize(); Kdelibs4ConfigMigrator migrate(QStringLiteral("blinken")); migrate.setConfigFiles(QStringList() << QStringLiteral("blinkenrc")); migrate.migrate(); QCommandLineParser parser; about.setupCommandLine(&parser); parser.process(app); about.processCommandLine(&parser); app.setWindowIcon(QIcon::fromTheme(QLatin1String("blinken"))); QFont f("Steve", 12, QFont::Normal, true); // Works with Steve may need some tweaking to work with other fonts if (!QFontInfo(f).exactMatch()) { QFontDatabase::addApplicationFont(QStandardPaths::locate(QStandardPaths::DataLocation, "fonts/steve.ttf")); } KDBusService service; new blinken(); return app.exec(); }
// Updates the dialog box using values in global Config() void OptionsDialog::updateDialogFromConfig() { std::shared_ptr<Configuration> config = Persistent<Configuration>( "settings" ); // Main font QFontInfo fontInfo = QFontInfo( config->mainFont() ); int familyIndex = fontFamilyBox->findText( fontInfo.family() ); if ( familyIndex != -1 ) fontFamilyBox->setCurrentIndex( familyIndex ); int sizeIndex = fontSizeBox->findText( QString::number(fontInfo.pointSize()) ); if ( sizeIndex != -1 ) fontSizeBox->setCurrentIndex( sizeIndex ); // Regexp types mainSearchBox->setCurrentIndex( getRegexpIndex( config->mainRegexpType() ) ); quickFindSearchBox->setCurrentIndex( getRegexpIndex( config->quickfindRegexpType() ) ); incrementalCheckBox->setChecked( config->isQuickfindIncremental() ); }
void ContextHelp::setContextHelp( QString name, QString help ) { //BEGIN modify help string as appropriate help = help.stripWhiteSpace(); parseInfo( help ); RichTextEditor::makeUseStandardFont( & help ); addLinkTypeAppearances( & help ); //END modify help string as appropriate // HACK Adjust top spacing according to whether the item description uses <p>. // This is because the help editor uses paragraphs, but old item help stored // in the items just uses <br> QFont f; int fontPixelSize = QFontInfo( f ).pixelSize(); if ( help.contains( "<p>" ) ) m_pBrowserView->setMarginHeight( 3-fontPixelSize ); else m_pBrowserView->setMarginHeight( 3 ); m_pNameLabel->setText( name ); m_pBrowser->begin( itemLibrary()->itemDescriptionsDirectory() ); m_pBrowser->write( help ); m_pBrowser->end(); }
void ChatView::appendMessage(QString message, RoomMessageTypeFlags messageType, QString sender, UserLevelFlags userLevel, QString UserPrivLevel, bool playerBold) { bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum(); bool sameSender = (sender == lastSender) && !lastSender.isEmpty(); QTextCursor cursor = prepareBlock(sameSender); lastSender = sender; // timestamp if (showTimestamps && (!sameSender || sender.toLower() == "servatrice") && !sender.isEmpty()) { QTextCharFormat timeFormat; timeFormat.setForeground(QColor(SERVER_MESSAGE_COLOR)); if (sender.isEmpty()) timeFormat.setFontWeight(QFont::Bold); cursor.setCharFormat(timeFormat); cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm:ss] ")); } // nickname if (sender.toLower() != "servatrice") { QTextCharFormat senderFormat; if (tabSupervisor && tabSupervisor->getUserInfo() && (sender == QString::fromStdString(tabSupervisor->getUserInfo()->name()))) { senderFormat.setForeground(QBrush(getCustomMentionColor())); senderFormat.setFontWeight(QFont::Bold); } else { senderFormat.setForeground(QBrush(OTHER_USER_COLOR)); if (playerBold) senderFormat.setFontWeight(QFont::Bold); } senderFormat.setAnchor(true); senderFormat.setAnchorHref("user://" + QString::number(userLevel) + "_" + sender); if (sameSender) { cursor.insertText(" "); } else { if (!sender.isEmpty() && tabSupervisor->getUserListsTab()) { const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize(); QMap<QString, UserListTWI *> buddyList = tabSupervisor->getUserListsTab()->getBuddyList()->getUsers(); cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, buddyList.contains(sender), UserPrivLevel).toImage()); cursor.insertText(" "); } cursor.setCharFormat(senderFormat); if (!sender.isEmpty()) sender.append(": "); cursor.insertText(sender); } } // use different color for server messages defaultFormat = QTextCharFormat(); if (sender.isEmpty()) { switch (messageType) { case Event_RoomSay::Welcome: defaultFormat.setForeground(Qt::darkGreen); defaultFormat.setFontWeight(QFont::Bold); break; case Event_RoomSay::ChatHistory: defaultFormat.setForeground(Qt::gray); defaultFormat.setFontWeight(QFont::Light); defaultFormat.setFontItalic(true); break; default: defaultFormat.setForeground(Qt::darkGreen); defaultFormat.setFontWeight(QFont::Bold); } } else if (sender.toLower() == "servatrice") { defaultFormat.setForeground(Qt::darkGreen); defaultFormat.setFontWeight(QFont::Bold); } cursor.setCharFormat(defaultFormat); bool mentionEnabled = settingsCache->getChatMention(); highlightedWords = settingsCache->getHighlightWords().split(' ', QString::SkipEmptyParts); // parse the message while (message.size()) { QChar c = message.at(0); switch(c.toLatin1()) { case '[': checkTag(cursor, message); break; case '@': if(mentionEnabled) { checkMention(cursor, message, sender, userLevel); } else { cursor.insertText(c, defaultFormat); message = message.mid(1); } break; case ' ': cursor.insertText(c, defaultFormat); message = message.mid(1); break; default: if(c.isLetterOrNumber()) { checkWord(cursor, message); } else { cursor.insertText(c, defaultFormat); message = message.mid(1); } break; } } if (atBottom) verticalScrollBar()->setValue(verticalScrollBar()->maximum()); }
KeyframeEdit::KeyframeEdit(const QDomElement &e, int minFrame, int maxFrame, const Timecode &tc, int activeKeyframe, QWidget* parent) : QWidget(parent), m_min(minFrame), m_max(maxFrame), m_timecode(tc), m_keyframesTag(false) { setupUi(this); if (m_max == -1) { // special case: keyframe for tracks, do not allow keyframes widgetTable->setHidden(true); } setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); keyframe_list->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont)); buttonSeek->setChecked(KdenliveSettings::keyframeseek()); connect(buttonSeek, SIGNAL(toggled(bool)), this, SLOT(slotSetSeeking(bool))); buttonKeyframes->setIcon(KoIconUtils::themedIcon(QStringLiteral("chronometer"))); button_add->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add"))); button_add->setToolTip(i18n("Add keyframe")); button_delete->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-remove"))); button_delete->setToolTip(i18n("Delete keyframe")); buttonResetKeyframe->setIcon(KoIconUtils::themedIcon(QStringLiteral("edit-undo"))); buttonSeek->setIcon(KoIconUtils::themedIcon(QStringLiteral("edit-link"))); connect(keyframe_list, &QTableWidget::cellActivated, this, &KeyframeEdit::rowClicked); connect(keyframe_list, SIGNAL(cellChanged(int,int)), this, SLOT(slotGenerateParams(int,int))); m_position = new PositionEdit(i18n("Position"), 0, 0, 1, tc, widgetTable); ((QGridLayout*)widgetTable->layout())->addWidget(m_position, 3, 0, 1, -1); m_slidersLayout = new QGridLayout(param_sliders); //m_slidersLayout->setSpacing(0); m_slidersLayout->setContentsMargins(0, 0, 0, 0); m_slidersLayout->setVerticalSpacing(2); keyframe_list->setSelectionBehavior(QAbstractItemView::SelectRows); keyframe_list->setSelectionMode(QAbstractItemView::SingleSelection); addParameter(e, activeKeyframe); keyframe_list->resizeRowsToContents(); //keyframe_list->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents); connect(button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe())); connect(button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe())); connect(buttonKeyframes, SIGNAL(clicked()), this, SLOT(slotKeyframeMode())); connect(buttonResetKeyframe, SIGNAL(clicked()), this, SLOT(slotResetKeyframe())); connect(m_position, SIGNAL(parameterChanged(int)), this, SLOT(slotAdjustKeyframePos(int))); //connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem*,int))); if (!keyframe_list->currentItem()) { keyframe_list->setCurrentCell(0, 0); keyframe_list->selectRow(0); } // ensure the keyframe list shows at least 3 lines keyframe_list->setMinimumHeight(QFontInfo(keyframe_list->font()).pixelSize() * 9); // Do not show keyframe table if only one keyframe exists at the beginning if (keyframe_list->rowCount() < 2 && getPos(0) == m_min && m_max != -1) widgetTable->setHidden(true); else buttonKeyframes->setHidden(true); }
void ChatView::appendMessage(QString message, QString sender, UserLevelFlags userLevel, bool playerBold) { bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum(); bool sameSender = (sender == lastSender) && !lastSender.isEmpty(); QTextCursor cursor = prepareBlock(sameSender); lastSender = sender; if (showTimestamps && !sameSender) { QTextCharFormat timeFormat; timeFormat.setForeground(Qt::black); cursor.setCharFormat(timeFormat); cursor.insertText(QDateTime::currentDateTime().toString("[hh:mm] ")); } QTextCharFormat senderFormat; if (tabSupervisor && tabSupervisor->getUserInfo() && (sender == QString::fromStdString(tabSupervisor->getUserInfo()->name()))) { senderFormat.setFontWeight(QFont::Bold); senderFormat.setForeground(Qt::red); } else { senderFormat.setForeground(Qt::blue); if (playerBold) senderFormat.setFontWeight(QFont::Bold); } senderFormat.setAnchor(true); senderFormat.setAnchorHref("user://" + QString::number(userLevel) + "_" + sender); if (!sameSender) { if (!sender.isEmpty()) { const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize(); cursor.insertImage(UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel).toImage(), QString::number(pixelSize) + "_" + QString::number((int) userLevel)); cursor.insertText(" "); } cursor.setCharFormat(senderFormat); if (!sender.isEmpty()) sender.append(": "); cursor.insertText(sender); } else cursor.insertText(" "); QTextCharFormat messageFormat; if (sender.isEmpty()) messageFormat.setForeground(Qt::darkGreen); cursor.setCharFormat(messageFormat); int from = 0, index = 0; while ((index = message.indexOf('[', from)) != -1) { cursor.insertText(message.left(index)); message = message.mid(index); if (message.isEmpty()) break; if (message.startsWith("[card]")) { message = message.mid(6); int closeTagIndex = message.indexOf("[/card]"); QString cardName = message.left(closeTagIndex); if (closeTagIndex == -1) message.clear(); else message = message.mid(closeTagIndex + 7); QTextCharFormat tempFormat = messageFormat; tempFormat.setForeground(Qt::blue); tempFormat.setAnchor(true); tempFormat.setAnchorHref("card://" + cardName); cursor.setCharFormat(tempFormat); cursor.insertText(cardName); cursor.setCharFormat(messageFormat); } else if (message.startsWith("[url]")) { message = message.mid(5); int closeTagIndex = message.indexOf("[/url]"); QString url = message.left(closeTagIndex); if (closeTagIndex == -1) message.clear(); else message = message.mid(closeTagIndex + 6); if (!url.contains("://")) url.prepend("http://"); QTextCharFormat tempFormat = messageFormat; tempFormat.setForeground(Qt::blue); tempFormat.setAnchor(true); tempFormat.setAnchorHref(url); cursor.setCharFormat(tempFormat); cursor.insertText(url); cursor.setCharFormat(messageFormat); } else from = 1; } if (!message.isEmpty()) cursor.insertText(message); if (atBottom) verticalScrollBar()->setValue(verticalScrollBar()->maximum()); }
MovableTitle( QWidget * parent ) : QWidget( parent ) { QVBoxLayout * mainlay = new QVBoxLayout( this ); mainlay->setMargin( 0 ); mainlay->setSpacing( 0 ); // close button row QHBoxLayout * buttonlay = new QHBoxLayout(); mainlay->addLayout( buttonlay ); titleLabel = new QLabel( this ); QFont f = titleLabel->font(); f.setBold( true ); titleLabel->setFont( f ); titleLabel->setCursor( Qt::SizeAllCursor ); buttonlay->addWidget( titleLabel ); dateLabel = new QLabel( this ); dateLabel->setAlignment( Qt::AlignTop | Qt::AlignRight ); f = dateLabel->font(); f.setPointSize( QFontInfo( f ).pointSize() - 2 ); dateLabel->setFont( f ); dateLabel->setCursor( Qt::SizeAllCursor ); buttonlay->addWidget( dateLabel ); CloseButton * close = new CloseButton( this ); connect( close, SIGNAL(clicked()), parent, SLOT(close()) ); buttonlay->addWidget( close ); // option button row QHBoxLayout * optionlay = new QHBoxLayout(); mainlay->addLayout( optionlay ); authorLabel = new QLabel( this ); authorLabel->setCursor( Qt::SizeAllCursor ); authorLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); optionlay->addWidget( authorLabel ); optionButton = new QToolButton( this ); QString opttext = i18n( "Options" ); optionButton->setText( opttext ); optionButton->setAutoRaise( true ); QSize s = QFontMetrics( optionButton->font() ).boundingRect( opttext ).size() + QSize( 8, 8 ); optionButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); optionButton->setFixedSize( s ); optionlay->addWidget( optionButton ); // ### disabled for now optionButton->hide(); latexButton = new QToolButton( this ); QHBoxLayout * latexlay = new QHBoxLayout(); QString latextext = i18n ( "This annotation may contain LaTeX code.\nClick here to render." ); latexButton->setText( latextext ); latexButton->setAutoRaise( true ); s = QFontMetrics( latexButton->font() ).boundingRect(0, 0, this->width(), this->height(), 0, latextext ).size() + QSize( 8, 8 ); latexButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ); latexButton->setFixedSize( s ); latexButton->setCheckable( true ); latexButton->setVisible( false ); latexlay->addSpacing( 1 ); latexlay->addWidget( latexButton ); latexlay->addSpacing( 1 ); mainlay->addLayout( latexlay ); connect(latexButton, SIGNAL(clicked(bool)), parent, SLOT(renderLatex(bool))); connect(parent, SIGNAL(containsLatex(bool)), latexButton, SLOT(setVisible(bool))); titleLabel->installEventFilter( this ); dateLabel->installEventFilter( this ); authorLabel->installEventFilter( this ); }
bool QgsFontUtils::fontMatchOnSystem( const QFont& f ) { QFontInfo fi = QFontInfo( f ); return fi.exactMatch(); }
/** Render the document */ void reportView::render(){ QFont generalFont = KGlobalSettings::generalFont(); QString fntFamily = generalFont.family(); int fntSize = generalFont.pointSize(); if (fntSize == -1) fntSize = QFontInfo(generalFont).pointSize(); QString textColor = KGlobalSettings::textColor().name(); QString baseColor = KGlobalSettings::baseColor().name(); QColorGroup cg = palette().active(); QString bgColor = cg.background().name(); QString hlColor = cg.highlight().name(); QString hlTextColor = cg.highlightedText().name(); QString locationName = m_weatherService->stationName(m_locationCode); QString countryName = m_weatherService->stationCountry(m_locationCode); QString temp = m_weatherService->temperature(m_locationCode); QString dewPoint = m_weatherService->dewPoint( m_locationCode); QString relHumidity = m_weatherService->relativeHumidity(m_locationCode ); QString heatIndex = m_weatherService->heatIndex(m_locationCode ); QString windChill = m_weatherService->windChill(m_locationCode ); QString pressure = m_weatherService->pressure(m_locationCode ); QString wind = m_weatherService->wind(m_locationCode ); QString sunRiseTime = m_weatherService->sunRiseTime(m_locationCode ); QString sunSetTime = m_weatherService->sunSetTime(m_locationCode ); QString date = m_weatherService->date(m_locationCode ); QString icon = m_weatherService->iconFileName(m_locationCode ); QStringList cover = m_weatherService->cover(m_locationCode ); QStringList weather = m_weatherService->weather(m_locationCode ); setCaption(i18n("Weather Report - %1").arg( locationName ) ); QString weatherText = "<ul>\n"; if ( m_weatherService->stationNeedsMaintenance( m_locationCode ) ) { weatherText += "<li>" + i18n( "Station reports that it needs maintenance" ) + " \n"; } for (QStringList::const_iterator it = cover.begin(); it != cover.end(); ++it) weatherText += "<li>" + *it + "\n"; for (QStringList::const_iterator it = weather.begin(); it != weather.end(); ++it) weatherText += "<li>" + *it + "\n"; weatherText += "</ul>\n"; QString contents = "<html><head><style type=\"text/css\">" + QString("body { font-family: \"%1\"; font-size: %2pt; color: %3; background-color: %4; }\n") .arg(fntFamily).arg(fntSize).arg(textColor).arg(baseColor) + QString("div.headerTitle { background-color: %1; color: %2; padding: 4px; font-size: 120%; border: solid %3 1px; }\n") .arg(hlColor).arg(hlTextColor).arg(textColor) + QString("div.headerMsg { background-color: %1; color: %2; border-bottom: solid %3 1px; " "border-left: solid %4 1px; border-right: solid %5 1px; margin-bottom: 1em; padding: 2px; }\n") .arg(bgColor).arg(textColor).arg(textColor).arg(textColor).arg(textColor) + QString("</style><title></title></head><body dir=\"%1\">").arg( QApplication::reverseLayout()?"rtl":"ltr") + "<div class=\"headerTitle\"><b>" + i18n( "Weather Report - %1 - %2" ).arg( locationName ).arg( countryName ) + "</b></div>\n"; if ( ! date.isEmpty() ) contents += "<div class=\"headerMsg\"><b>" + i18n( "Latest data from %1" ).arg(date) + "</b></div>\n"; contents += QString( "<table><tr><td width=\"60\" style=\"text-align: center; border: dotted %1 1px;\">" "<img width=\"64\" height=\"64\" src=\"%2\" /></td>" "<td style=\"vertical-align: top\">%3</td></tr>") .arg(bgColor).arg(KURL(icon).url()).arg(weatherText) + "</table><table>" + QString("<tr><th style=\"text-align: right\">" + i18n( "Temperature:" ) + "</th><td>%1</td>" "<td width=\"50\"> </td>" "<th style=\"text-align: right\">" + i18n( "Dew Point:" ) + "</th><td>%2</td></tr>" "<tr><th style=\"text-align: right\">" + i18n( "Air Pressure:" ) + "</th><td>%3</td>" "<td width=\"50\"> </td>" "<th style=\"text-align: right\">" + i18n( "Rel. Humidity:" ) + "</th><td>%4</td></tr>" "<tr><th style=\"text-align: right\">" + i18n( "Wind Speed:" ) + "</th><td>%5</td>") .arg(temp).arg(dewPoint).arg(pressure).arg(relHumidity) .arg(wind) + "<td width=\"50\"> </td>"; if (!heatIndex.isEmpty()) contents += QString("<th style=\"text-align: right\">" + i18n( "Heat Index:" ) + "</th><td>%1</td>").arg(heatIndex); else if (!windChill.isEmpty()) contents += QString("<th style=\"text-align: right\">" + i18n( "Wind Chill:" ) + "</th><td>%1</td>").arg(windChill); else contents += "<td> </td><td> </td>"; contents += "</tr>"; contents += QString("<tr><th style=\"text-align: right\">" + i18n( "Sunrise:" ) + "</th><td>%1</td>" + "<td width=\"50\"> </td><th style=\"text-align: right\">" + i18n( "Sunset:" ) + "</th><td>%2</td>") .arg(sunRiseTime).arg(sunSetTime); contents += "</tr></table></body></html>"; m_reportView->begin(); m_reportView->write( contents ); m_reportView->end(); QScrollView *view = m_reportView->view(); kdDebug() << "Size " << view->size().height() << "," << view->size().width() << endl; kdDebug() << "Size " << view->visibleHeight() << "," << view->visibleWidth() << endl; m_reportView->view()->resize(view->size().width(), view->size().height()); }
/** * @brief Constructor of UserInterfaceForm. * @param myParent Setting widget which will contain this form as tab. * * Restores all controls from the settings. */ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) : GenericForm(QPixmap(":/img/settings/general.png")) { parent = myParent; bodyUI = new Ui::UserInterfaceSettings; bodyUI->setupUi(this); // block all child signals during initialization const RecursiveSignalBlocker signalBlocker(this); Settings& s = Settings::getInstance(); const QFont chatBaseFont = s.getChatMessageFont(); bodyUI->txtChatFontSize->setValue(QFontInfo(chatBaseFont).pixelSize()); bodyUI->txtChatFont->setCurrentFont(chatBaseFont); int index = static_cast<int>(s.getStylePreference()); bodyUI->textStyleComboBox->setCurrentIndex(index); bool showWindow = s.getShowWindow(); bodyUI->showWindow->setChecked(showWindow); bodyUI->showInFront->setChecked(s.getShowInFront()); bodyUI->showInFront->setEnabled(showWindow); bodyUI->groupAlwaysNotify->setChecked(s.getGroupAlwaysNotify()); bodyUI->cbGroupchatPosition->setChecked(s.getGroupchatPosition()); bodyUI->cbCompactLayout->setChecked(s.getCompactLayout()); bodyUI->cbSeparateWindow->setChecked(s.getSeparateWindow()); bodyUI->cbDontGroupWindows->setChecked(s.getDontGroupWindows()); bodyUI->cbDontGroupWindows->setEnabled(s.getSeparateWindow()); bodyUI->useEmoticons->setChecked(s.getUseEmoticons()); for (auto entry : SmileyPack::listSmileyPacks()) bodyUI->smileyPackBrowser->addItem(entry.first, entry.second); smileLabels = {bodyUI->smile1, bodyUI->smile2, bodyUI->smile3, bodyUI->smile4, bodyUI->smile5}; int currentPack = bodyUI->smileyPackBrowser->findData(s.getSmileyPack()); bodyUI->smileyPackBrowser->setCurrentIndex(currentPack); reloadSmileys(); bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked()); bodyUI->styleBrowser->addItem(tr("None")); bodyUI->styleBrowser->addItems(QStyleFactory::keys()); QString style; if (QStyleFactory::keys().contains(s.getStyle())) style = s.getStyle(); else style = tr("None"); bodyUI->styleBrowser->setCurrentText(style); for (QString color : Style::getThemeColorNames()) bodyUI->themeColorCBox->addItem(color); bodyUI->themeColorCBox->setCurrentIndex(s.getThemeColor()); bodyUI->emoticonSize->setValue(s.getEmojiFontPointSize()); QLocale ql; QStringList timeFormats; timeFormats << ql.timeFormat(QLocale::ShortFormat) << ql.timeFormat(QLocale::LongFormat) << "hh:mm AP" << "hh:mm:ss AP" << "hh:mm:ss"; timeFormats.removeDuplicates(); bodyUI->timestamp->addItems(timeFormats); QRegularExpression re(QString("^[^\\n]{0,%0}$").arg(MAX_FORMAT_LENGTH)); QRegularExpressionValidator* validator = new QRegularExpressionValidator(re, this); QString timeFormat = s.getTimestampFormat(); if (!re.match(timeFormat).hasMatch()) timeFormat = timeFormats[0]; bodyUI->timestamp->setCurrentText(timeFormat); bodyUI->timestamp->setValidator(validator); on_timestamp_editTextChanged(timeFormat); QStringList dateFormats; dateFormats << QStringLiteral("yyyy-MM-dd") // ISO 8601 // format strings from system locale << ql.dateFormat(QLocale::LongFormat) << ql.dateFormat(QLocale::ShortFormat) << ql.dateFormat(QLocale::NarrowFormat) << "dd-MM-yyyy" << "d-MM-yyyy" << "dddd dd-MM-yyyy" << "dddd d-MM"; dateFormats.removeDuplicates(); bodyUI->dateFormats->addItems(dateFormats); QString dateFormat = s.getDateFormat(); if (!re.match(dateFormat).hasMatch()) dateFormat = dateFormats[0]; bodyUI->dateFormats->setCurrentText(dateFormat); bodyUI->dateFormats->setValidator(validator); on_dateFormats_editTextChanged(dateFormat); eventsInit(); Translator::registerHandler(std::bind(&UserInterfaceForm::retranslateUi, this), this); }
void MythSqueezeDisplay::resetDimensions(void) { /* Display is divided into a small top line (line0) and a large bottom line (line1) If Line0 = A, Line1 = 3A, with the gap at the top of Line0 and the bottom of Line1 being 0.25A and the gap between Line0 and Line1 being .5A. A = total height of the display rectangle divided by 5. The display rectangle is always a ratio of 1X10, which corresponds to the original SqueezeBox 3 display of 32X320. */ // first establish display parameters for entire display area // Leave a blank area all around int drawwidth = displayLabel.width()-2*WPADDING; int drawheight = displayLabel.height()-2*HPADDING; // we want a ratio of at least a 1 X 10 for the display if(drawwidth/drawheight >= 10) { // too wide int newWidth = drawheight*10; m_displayRect = QRect(WPADDING+((drawwidth-newWidth)/2),HPADDING,newWidth,drawheight); } else { int newHeight = drawwidth/10; m_displayRect = QRect(WPADDING,HPADDING+((drawheight-newHeight)/2),drawwidth,newHeight); } DEBUGF("Display Rect: " << m_displayRect); DEBUGF("Label Rect: " << displayLabel); fullDisplayClipping = QRegion(m_displayRect); // let's make sure we're not too small, and if we are, artificially enlarge the size if(m_displayRect.height() < 32) { // probably too small to use, so for a size of 320x32 DEBUGF(QString("original display rectangle is too small, with height of %1, main rect is %2 high").arg(m_displayRect.height()).arg(displayLabel.height())); m_displayRect.setHeight(32); m_displayRect.setWidth(320); } // establish size of each display line int line0height = m_displayRect.height()/4; line0Bounds = QRect(m_displayRect.x(),m_displayRect.y()+line0height/4, m_displayRect.width()-WPADDING,line0height); line0Clipping = QRegion(line0Bounds.x(), m_displayRect.y(), line0Bounds.width(), m_displayRect.height()/3 ); line1Bounds = QRect(m_displayRect.x(),m_displayRect.y()+((line0height*7)/4),m_displayRect.width()-WPADDING,line0height*2); line1Clipping = QRegion(line1Bounds.x(), line0Clipping.boundingRect().bottom(),line1Bounds.width(), (2*m_displayRect.height())/3); center0Bounds = QRect(m_displayRect.x(),m_displayRect.y()+m_displayRect.height()/9, m_displayRect.width()-WPADDING, m_displayRect.height()/3); center1Bounds = QRect(m_displayRect.x(),center0Bounds.bottom()+m_displayRect.height()/9, m_displayRect.width()-WPADDING, m_displayRect.height()/3); // establish font small.setFamily( "Helvetica" ); medium.setFamily( "Helvetica" ); large.setFamily( "Helvetica" ); small.setPixelSize(4); medium.setPixelSize(4); large.setPixelSize(4); for( int i = 5; QFontInfo(small).pixelSize() < line0Bounds.height(); i++) small.setPixelSize(i); for(int i=5; QFontInfo(medium).pixelSize() < displayLabel.height()/3; i++) medium.setPixelSize(i); for(int i = 5; QFontInfo(large).pixelSize() < line1Bounds.height(); i++) large.setPixelSize(i); // establish information for scrolling if(line1fm) delete line1fm; line1fm = new QFontMetrics(large); Line1FontWidth = line1fm->width('W'); scrollStep = (Line1FontWidth < 40 ? 1 : Line1FontWidth / 40); if(line1fm->descent() > line1Clipping.boundingRect().bottom() - line1Bounds.bottom()) { // make sure the descent isn't outside of the clipping area line1Bounds.moveTop(line1Bounds.top()-(line1fm->descent()-(line1Clipping.boundingRect().bottom() - line1Bounds.bottom()))); } vertTransTimer->setFrameRange( 0, line1Bounds.height() ); horzTransTimer->setFrameRange( 0, m_displayRect.width() ); bumpTransTimer->setFrameRange( 0, Line1FontWidth ); // establish volume and time progress bars volFillRect = volRect = QRect( m_displayRect.x(), displayLabel.height()/2 - line0Bounds.height()/2, m_displayRect.width()-(2*WPADDING),line0Bounds.height()); progFillRect = progRect = QRect(0,line0Bounds.top()+ line0Bounds.height()/4,line0Bounds.width(),line0Bounds.height()/2); // note, "left" and "width" are irrelevant here, only "top" and "height" will remain constant radius = volRect.height()/4; // establish display image if(displayImage) { delete displayImage; } displayImage = new QImage(displayLabel.width(),displayLabel.height(),QImage::Format_ARGB32 ); displayImage->fill((uint)m_displayBackgroundColor.rgb()); DEBUGF("Display Image Dimensions" << displayImage->rect()); }
/** * @brief Constructor of UserInterfaceForm. * @param myParent Setting widget which will contain this form as tab. * * Restores all controls from the settings. */ UserInterfaceForm::UserInterfaceForm(SettingsWidget* myParent) : GenericForm(QPixmap(":/img/settings/general.png")) { parent = myParent; bodyUI = new Ui::UserInterfaceSettings; bodyUI->setupUi(this); // block all child signals during initialization const RecursiveSignalBlocker signalBlocker(this); Settings &s = Settings::getInstance(); const QFont chatBaseFont = s.getChatMessageFont(); bodyUI->txtChatFontSize->setValue(QFontInfo(chatBaseFont).pixelSize()); bodyUI->txtChatFont->setCurrentFont(chatBaseFont); int index = static_cast<int>(s.getStylePreference()); bodyUI->textStyleComboBox->setCurrentIndex(index); bool showWindow = s.getShowWindow(); bodyUI->showWindow->setChecked(showWindow); bodyUI->showInFront->setChecked(s.getShowInFront()); bodyUI->showInFront->setEnabled(showWindow); bodyUI->groupAlwaysNotify->setChecked(s.getGroupAlwaysNotify()); bodyUI->cbGroupchatPosition->setChecked(s.getGroupchatPosition()); bodyUI->cbCompactLayout->setChecked(s.getCompactLayout()); bodyUI->cbSeparateWindow->setChecked(s.getSeparateWindow()); bodyUI->cbDontGroupWindows->setChecked(s.getDontGroupWindows()); bodyUI->cbDontGroupWindows->setEnabled(s.getSeparateWindow()); bodyUI->useEmoticons->setChecked(s.getUseEmoticons()); for (auto entry : SmileyPack::listSmileyPacks()) bodyUI->smileyPackBrowser->addItem(entry.first, entry.second); smileLabels = {bodyUI->smile1, bodyUI->smile2, bodyUI->smile3, bodyUI->smile4, bodyUI->smile5}; int currentPack = bodyUI->smileyPackBrowser->findData(s.getSmileyPack()); bodyUI->smileyPackBrowser->setCurrentIndex(currentPack); reloadSmileys(); bodyUI->smileyPackBrowser->setEnabled(bodyUI->useEmoticons->isChecked()); bodyUI->styleBrowser->addItem(tr("None")); bodyUI->styleBrowser->addItems(QStyleFactory::keys()); QString style; if (QStyleFactory::keys().contains(s.getStyle())) style = s.getStyle(); else style = tr("None"); bodyUI->styleBrowser->setCurrentText(style); for (QString color : Style::getThemeColorNames()) bodyUI->themeColorCBox->addItem(color); bodyUI->themeColorCBox->setCurrentIndex(s.getThemeColor()); bodyUI->emoticonSize->setValue(s.getEmojiFontPointSize()); QStringList timestamps; for (QString timestamp : timeFormats) timestamps << QString("%1 - %2").arg(timestamp, QTime::currentTime().toString(timestamp)); bodyUI->timestamp->addItems(timestamps); QLocale ql; QStringList datestamps; dateFormats.append(ql.dateFormat()); dateFormats.append(ql.dateFormat(QLocale::LongFormat)); dateFormats.removeDuplicates(); timeFormats.append(ql.timeFormat()); timeFormats.append(ql.timeFormat(QLocale::LongFormat)); timeFormats.removeDuplicates(); for (QString datestamp : dateFormats) datestamps << QString("%1 - %2").arg(datestamp, QDate::currentDate().toString(datestamp)); bodyUI->dateFormats->addItems(datestamps); bodyUI->timestamp->setCurrentText(QString("%1 - %2").arg(s.getTimestampFormat(), QTime::currentTime().toString(s.getTimestampFormat()))); bodyUI->dateFormats->setCurrentText(QString("%1 - %2").arg(s.getDateFormat(), QDate::currentDate().toString(s.getDateFormat()))); eventsInit(); Translator::registerHandler(std::bind(&UserInterfaceForm::retranslateUi, this), this); }
void AppearanceConfigWidget::saveConfiguration(void) { try { map<QString, QString> attribs; vector<AppearanceConfigItem>::iterator itr, itr_end; AppearanceConfigItem item; QString attrib_id; QFont font; itr=conf_items.begin(); itr_end=conf_items.end(); while(itr!=itr_end) { item=(*itr); itr++; //If the item is a object color config if(item.obj_conf) { //Creates an attribute that stores the fill color attrib_id=item.conf_id + QString("-color"); if(item.colors[0]==item.colors[1]) attribs[attrib_id]=item.colors[0].name(); else attribs[attrib_id]=item.colors[0].name() + QString(",") + item.colors[1].name(); //Creates an attribute that stores the border color attrib_id=item.conf_id + QString("-bcolor"); attribs[attrib_id]=item.colors[2].name(); } //If the item is a font config else if(item.conf_id!=ParsersAttributes::GLOBAL && !item.obj_conf) { font=item.font_fmt.font(); //Creates an attribute to store the font color attrib_id=item.conf_id + QString("-fcolor"); attribs[attrib_id]=item.font_fmt.foreground().color().name(); attrib_id=item.conf_id + QString("-") + ParsersAttributes::ITALIC; attribs[attrib_id]=(font.italic() ? ParsersAttributes::_TRUE_ : ParsersAttributes::_FALSE_); attrib_id=item.conf_id + QString("-") + ParsersAttributes::BOLD; attribs[attrib_id]=(font.bold() ? ParsersAttributes::_TRUE_ : ParsersAttributes::_FALSE_); attrib_id=item.conf_id + QString("-") + ParsersAttributes::UNDERLINE; attribs[attrib_id]=(font.underline() ? ParsersAttributes::_TRUE_ : ParsersAttributes::_FALSE_); } //Special case: treating the global font element else { attribs["font-name"]=QFontInfo(item.font_fmt.font()).family(); attribs["font-size"]=QString("%1").arg(item.font_fmt.font().pointSizeF()); } } config_params[GlobalAttributes::OBJECTS_STYLE_CONF]=attribs; BaseConfigWidget::saveConfiguration(GlobalAttributes::OBJECTS_STYLE_CONF); } catch(Exception &e) { throw Exception(e.getErrorMessage(),e.getErrorType(),__PRETTY_FUNCTION__,__FILE__,__LINE__, &e); } }