bool MdiChild::loadFile(const QString &fileName) { QSettings* preferences = new QSettings(QSettings::IniFormat, QSettings::UserScope, "DGSOFTWARE", "Notatio Antiqua"); preferences->beginGroup("Font"); if (preferences->value("standardFont") != "") setFontFamily(preferences->value("standardFont").toString()); preferences->endGroup(); QFile file(fileName); if (!file.open(QFile::ReadOnly | QFile::Text)) { QMessageBox::warning(this, tr("Notatio Antiqua"), tr("Can't read file: %1:\n%2.") .arg(fileName) .arg(file.errorString())); return false; } preferences->beginGroup("File"); preferences->setValue("lastOpen",fileName); preferences->endGroup(); QTextStream in(&file); in.setCodec("UTF-8"); QApplication::setOverrideCursor(Qt::WaitCursor); setPlainText(in.readAll()); QApplication::restoreOverrideCursor(); setCurrentFile(fileName); highlighter = new Highlighter(document()); connect(document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified())); return true; }
LuaEditor::LuaEditor(QWidget* pa) : QTextEdit(pa), parent(pa) { highlighter = new Highlighter(document()); QStringList names = QFontDatabase().families(); QStringList prefs; prefs << "DejaVu Sans Mono" << "Bitstream Vera Sans Mono" << "Terminus" << "Fixed"; foreach (QString p, prefs) if (names.contains(p, Qt::CaseInsensitive)) { logInfo(QString("LuaEditor::LuaEditor : found font %1").arg(p)); setFontFamily(p); break; } QAction* a = new QAction(tr("Open a file"), this); a->setShortcut(tr("Ctrl+1")); a->setShortcutContext(Qt::WidgetShortcut); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(load())); a = new QAction(tr("Save file"), this); a->setShortcut(tr("Ctrl+2")); a->setShortcutContext(Qt::WidgetShortcut); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(save())); a = new QAction(tr("Save to file"), this); a->setShortcut(tr("Ctrl+3")); a->setShortcutContext(Qt::WidgetShortcut); addAction(a); connect(a, SIGNAL(triggered()), this, SLOT(saveAs())); }
void MailTab::SetFontFamily (QWebSettings::FontFamily family, const QFont& font) { const auto settings = Ui_.MailView_->settings (); if (font == QFont {}) settings->resetFontFamily (family); else settings->setFontFamily (family, font.family ()); }
MdiChild::MdiChild() { setAttribute(Qt::WA_DeleteOnClose); isUntitled = true; setAcceptRichText(false); setFontFamily("Monospace"); setWordWrapMode(QTextOption::NoWrap); }
QString Configuration::getFontFamily() { QVariant var = settings->value(FONT_FAMILY); if (var.isValid() && var.canConvert(QVariant::String)) { return var.toString(); } else { QString r(DEFAULT_FONT_FAMILY); setFontFamily(r); return r; } }
Console::Console(QWidget *par) : QTextEdit(par) { qRegisterMetaType<QTextCursor>("QTextCursor"); qRegisterMetaType<QTextCharFormat>("QTextCharFormat"); setReadOnly(true); setFontFamily("monospace"); //setStyleSheet("QTextEdit { background-color: 'black'; }"); setStyleSheet("QTextEdit { font-family: Courier; font-size: 12pt; background-color: 'lightGray'; }"); setTextColor(QColor("white")); connect(event_manager::get_instance(),SIGNAL(script_message(QString,QString)),this,SLOT(write(QString,QString))); }
void MdiChild::newFile() { static int sequenceNumber = 1; QSettings* preferences = new QSettings(QSettings::IniFormat, QSettings::UserScope, "DGSOFTWARE", "Notatio Antiqua"); preferences->beginGroup("Font"); if (preferences->value("standardFont") != "") setFontFamily(preferences->value("standardFont").toString()); preferences->endGroup(); isUntitled = true; curFile = tr("Document%1.gabc").arg(sequenceNumber++); setWindowTitle(curFile + "[*]"); highlighter = new Highlighter(document()); connect(document(), SIGNAL(contentsChanged()), this, SLOT(documentWasModified())); highlighter = new Highlighter(document()); }
MetricFontDialog::MetricFontDialog(QWidget* parent, Qt::WFlags fl) : QDialog(parent, fl), Ui::metricFontDialog() { setupUi(this); sampleGraphicsView->setScene( new QGraphicsScene()); m_writingSystem=QFontDatabase::Any; m_writingSystems.push_back(tr("Any")); foreach(QFontDatabase::WritingSystem ws, m_fontDatabase.writingSystems()) m_writingSystems.push_back(QFontDatabase::writingSystemName(ws)); m_writingSystemsModel.setStringList(m_writingSystems); writingSystemsComboBox->setModel(&m_writingSystemsModel); connect(writingSystemsComboBox, SIGNAL(currentIndexChanged(int)),SLOT(writingSystemChanged(int))); writingSystemComboBox->setModel(&m_writingSystemModel); connect(writingSystemComboBox, SIGNAL(currentIndexChanged(int)),SLOT(fontWritingSystemChanged(int))); m_styleSelectionModel = new QItemSelectionModel(&m_fontStyleModel,this); styleListView->setModel(&m_fontStyleModel); styleListView->setSelectionModel(m_styleSelectionModel); connect(m_styleSelectionModel, SIGNAL(currentChanged( const QModelIndex&, const QModelIndex& )), SLOT(styleChanged(const QModelIndex&, const QModelIndex& ))); m_fontFamiliesModel.setStringList(m_fontDatabase.families(m_writingSystem)); setFontFamily(m_fontDatabase.families(m_writingSystem)[0]); m_familiesSelectionModel= new QItemSelectionModel(&m_fontFamiliesModel,this); familiesListView->setModel(&m_fontFamiliesModel); familiesListView->setSelectionModel(m_familiesSelectionModel); connect(m_familiesSelectionModel, SIGNAL(currentChanged( const QModelIndex&, const QModelIndex& )), SLOT(familyChanged(const QModelIndex&, const QModelIndex& ))); m_familiesSelectionModel->setCurrentIndex(m_fontFamiliesModel.index(0,0), QItemSelectionModel::SelectCurrent); m_sizeList<<"2.5"<<"3.0"<<"3.5"<<"4.0"<<"4.5"<<"5.0"<<"6.0"<<"7.0"<<"8.0"<<"9.0"<<"10.0"; m_fontSizeModel.setStringList(m_sizeList); m_sizeSelectionModel = new QItemSelectionModel(&m_fontSizeModel,this); connect(m_sizeSelectionModel, SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)), SLOT(sizeChanged(const QModelIndex&, const QModelIndex& ))); connect(sizeDoubleSpinBox, SIGNAL(valueChanged(double)),SLOT(sizeChanged(double))); sizeListView->setModel(&m_fontSizeModel); sizeListView->setSelectionModel(m_sizeSelectionModel); m_sizeSelectionModel->setCurrentIndex(m_fontSizeModel.index(3,0), QItemSelectionModel::SelectCurrent); connect(strikeoutCheckBox, SIGNAL(toggled(bool)),SLOT(strikeoutChanged(bool))); connect(underlineCheckBox, SIGNAL(toggled(bool)),SLOT(underlineChanged(bool))); }
DisplayWidget::DisplayWidget(QWidget *parent) : QTextEdit(parent) { setReadOnly(true); setTabChangesFocus(true); setOverwriteMode(true); setAlignment(Qt::AlignCenter); resetLine(); append(tr("Welcome to the Free Group Calculator!\n")); setAlignment(Qt::AlignLeft); setFontFamily("Monaco"); setFontPointSize(12.0); append(tr("[%1 %2]:>").arg(Input).arg(lineNumber)); moveCursor(QTextCursor::End); }
void QWebPreferencesPrivate::initializeDefaultFontSettings() { setFontSize(MinimumFontSize, 0); setFontSize(DefaultFontSize, 16); setFontSize(DefaultFixedFontSize, 13); QFont defaultFont; defaultFont.setStyleHint(QFont::Serif); setFontFamily(StandardFont, defaultFont.defaultFamily()); setFontFamily(SerifFont, defaultFont.defaultFamily()); defaultFont.setStyleHint(QFont::Fantasy); setFontFamily(FantasyFont, defaultFont.defaultFamily()); defaultFont.setStyleHint(QFont::Cursive); setFontFamily(CursiveFont, defaultFont.defaultFamily()); defaultFont.setStyleHint(QFont::SansSerif); setFontFamily(SansSerifFont, defaultFont.defaultFamily()); defaultFont.setStyleHint(QFont::Monospace); setFontFamily(FixedFont, defaultFont.defaultFamily()); }
KNoteEdit::KNoteEdit( KActionCollection *actions, QWidget *parent ) : KTextEdit( parent ), m_note( 0 ) { setAcceptDrops( true ); setWordWrapMode( QTextOption::WordWrap ); setLineWrapMode( WidgetWidth ); if ( acceptRichText() ) { setAutoFormatting( AutoAll ); } else { setAutoFormatting( AutoNone ); } setCheckSpellingEnabled( true ); // create the actions modifying the text format m_textBold = new KToggleAction( KIcon( "format-text-bold" ), i18n( "Bold" ), this ); actions->addAction( "format_bold", m_textBold ); m_textBold->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_B ) ); m_textItalic = new KToggleAction( KIcon( "format-text-italic" ), i18n( "Italic" ), this ); actions->addAction( "format_italic", m_textItalic ); m_textItalic->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_I ) ); m_textUnderline = new KToggleAction( KIcon( "format-text-underline" ), i18n( "Underline" ), this ); actions->addAction( "format_underline", m_textUnderline ); m_textUnderline->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_U ) ); m_textStrikeOut = new KToggleAction( KIcon( "format-text-strikethrough" ), i18n( "Strike Out" ), this ); actions->addAction( "format_strikeout", m_textStrikeOut ); m_textStrikeOut->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_S ) ); connect( m_textBold, SIGNAL(toggled(bool)), SLOT(textBold(bool)) ); connect( m_textItalic, SIGNAL(toggled(bool)), SLOT(setFontItalic(bool)) ); connect( m_textUnderline, SIGNAL(toggled(bool)), SLOT(setFontUnderline(bool)) ); connect( m_textStrikeOut, SIGNAL(toggled(bool)), SLOT(textStrikeOut(bool)) ); m_textAlignLeft = new KToggleAction( KIcon( "format-justify-left" ), i18n( "Align Left" ), this ); actions->addAction( "format_alignleft", m_textAlignLeft ); connect( m_textAlignLeft, SIGNAL(triggered(bool)), SLOT(textAlignLeft()) ); m_textAlignLeft->setShortcut( QKeySequence( Qt::ALT + Qt::Key_L ) ); m_textAlignLeft->setChecked( true ); // just a dummy, will be updated later m_textAlignCenter = new KToggleAction( KIcon( "format-justify-center" ), i18n( "Align Center" ), this ); actions->addAction( "format_aligncenter", m_textAlignCenter ); connect( m_textAlignCenter, SIGNAL(triggered(bool)), SLOT(textAlignCenter()) ); m_textAlignCenter->setShortcut( QKeySequence( Qt::ALT + Qt::Key_C ) ); m_textAlignRight = new KToggleAction( KIcon( "format-justify-right" ), i18n( "Align Right" ), this ); actions->addAction( "format_alignright", m_textAlignRight ); connect( m_textAlignRight, SIGNAL(triggered(bool)), SLOT(textAlignRight()) ); m_textAlignRight->setShortcut( QKeySequence( Qt::ALT + Qt::Key_R ) ); m_textAlignBlock = new KToggleAction( KIcon( "format-justify-fill" ), i18n( "Align Block" ), this ); actions->addAction( "format_alignblock", m_textAlignBlock ); connect( m_textAlignBlock, SIGNAL(triggered(bool)), SLOT(textAlignBlock()) ); m_textAlignBlock->setShortcut( QKeySequence( Qt::ALT + Qt::Key_B ) ); QActionGroup *group = new QActionGroup( this ); group->addAction( m_textAlignLeft ); group->addAction( m_textAlignCenter ); group->addAction( m_textAlignRight ); group->addAction( m_textAlignBlock ); m_textList = new KToggleAction( KIcon( "format-list-ordered" ), i18n( "List" ), this ); actions->addAction( "format_list", m_textList ); connect( m_textList, SIGNAL(triggered(bool)), SLOT(textList()) ); m_textSuper = new KToggleAction( KIcon( "format-text-superscript" ), i18n( "Superscript" ), this ); actions->addAction( "format_super", m_textSuper ); connect( m_textSuper, SIGNAL(triggered(bool)), SLOT(textSuperScript()) ); m_textSub = new KToggleAction( KIcon( "format-text-subscript" ), i18n( "Subscript" ), this ); actions->addAction( "format_sub", m_textSub ); connect( m_textSub, SIGNAL(triggered(bool)), SLOT(textSubScript()) ); m_textIncreaseIndent = new KAction( KIcon( "format-indent-more" ), i18n( "Increase Indent" ), this ); actions->addAction( "format_increaseindent", m_textIncreaseIndent ); m_textIncreaseIndent->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_I ) ); connect( m_textIncreaseIndent, SIGNAL(triggered(bool)), SLOT(textIncreaseIndent()) ); m_textDecreaseIndent = new KAction( KIcon( "format-indent-less" ), i18n( "Decrease Indent" ), this ); actions->addAction( "format_decreaseindent", m_textDecreaseIndent ); m_textDecreaseIndent->setShortcut( QKeySequence( Qt::CTRL + Qt::ALT + Qt::Key_D ) ); connect( m_textDecreaseIndent, SIGNAL(triggered(bool)), SLOT( textDecreaseIndent() ) ); group = new QActionGroup( this ); group->addAction( m_textIncreaseIndent ); group->addAction( m_textDecreaseIndent ); QPixmap pix( ICON_SIZE, ICON_SIZE ); pix.fill( Qt::black ); // just a dummy, gets updated before widget is shown m_textColor = new KAction( i18n( "Text Color..." ), this ); actions->addAction( "format_color", m_textColor ); m_textColor->setIcon( pix ); connect( m_textColor, SIGNAL(triggered(bool)), SLOT(slotTextColor()) ); KAction *act = new KAction(KIcon( "format-fill-color" ), i18n( "Text Background Color..." ), this ); actions->addAction( "text_background_color", act ); connect( act, SIGNAL(triggered(bool)), SLOT(slotTextBackgroundColor()) ); m_textFont = new KFontAction( i18n( "Text Font" ), this ); actions->addAction( "format_font", m_textFont ); connect( m_textFont, SIGNAL(triggered(QString)), this, SLOT(setFontFamily(QString)) ); m_textSize = new KFontSizeAction( i18n( "Text Size" ), this ); actions->addAction( "format_size", m_textSize ); connect( m_textSize, SIGNAL(fontSizeChanged(int)), this, SLOT(setTextFontSize(int)) ); // QTextEdit connections connect( this, SIGNAL(currentCharFormatChanged(QTextCharFormat)), SLOT(slotCurrentCharFormatChanged(QTextCharFormat)) ); connect( this, SIGNAL(cursorPositionChanged()), SLOT(slotCursorPositionChanged()) ); slotCurrentCharFormatChanged( currentCharFormat() ); slotCursorPositionChanged(); }
void MetricFontDialog::familyChanged(const QModelIndex & current, const QModelIndex & /*previous*/ ) { setFontFamily(m_fontDatabase.families(m_writingSystem)[current.row()]); }
void InternalSettings::setPictographFontFamily(const String& family, const String& script, ExceptionCode& ec) { InternalSettingsGuardForSettings(); setFontFamily(settings(), family, script, &Settings::setPictographFontFamily); }
bool TextItem::fromXml(QDomElement & pe) { setBeingLoaded(true); // restore content properties QString text = pe.firstChildElement("text").text(); setText(text); // load default font QDomElement domElement; domElement = pe.firstChildElement("default-font"); if (domElement.isElement()) { setFontFamily(domElement.attribute("font-family")); //setFontSize(domElement.attribute("font-size").toDouble()); // QFont font; // font.setFamily(domElement.attribute("font-family")); // font.setPointSize(domElement.attribute("font-size").toInt()); // m_text->setDefaultFont(font); } // load shape domElement = pe.firstChildElement("shape"); if (domElement.isElement()) { bool shapeEnabled = domElement.attribute("enabled").toInt(); setShapeEnabled(shapeEnabled); domElement = domElement.firstChildElement("control-points"); if (shapeEnabled && domElement.isElement()) { QList<QPointF> points; QStringList strPoint; strPoint = domElement.attribute("one").split(" "); setShapePoint1(QPointF(strPoint.at(0).toFloat(), strPoint.at(1).toFloat())); strPoint = domElement.attribute("two").split(" "); setShapePoint2(QPointF(strPoint.at(0).toFloat(), strPoint.at(1).toFloat())); strPoint = domElement.attribute("three").split(" "); setShapePoint3(QPointF(strPoint.at(0).toFloat(), strPoint.at(1).toFloat())); strPoint = domElement.attribute("four").split(" "); setShapePoint4(QPointF(strPoint.at(0).toFloat(), strPoint.at(1).toFloat())); } } domElement = pe.firstChildElement("text-align"); if (domElement.isElement()) { Qt::Alignment x = (Qt::Alignment)domElement.attribute("x").toInt(); Qt::Alignment y = (Qt::Alignment)domElement.attribute("y").toInt(); setXTextAlign(x); setXTextAlign(y); } setBeingLoaded(false); AbstractVisualItem::fromXml(pe); return true; }
void CHTMLWriteDisplay::slotFontFamilyChoosen(const QFont& font) { setFontFamily(font.family()); }
void QxPreferences::restore(QSettings* settings, int selection) { blockSignals(true); settings->beginGroup("preferences"); Ref<ViewMetrics, Owner> editorDefaults = Edit::defaultMetrics(); Ref<ViewMetrics, Owner> terminalDefaults = QxVideoTerminal::defaultMetrics(); if ((selection & Editor) != 0) { settings->beginGroup("editor"); setFontFamily(editor_->font_, settings->value("font"), editorDefaults->font_); editor_->fontSize_->setValue(settings->value("fontSize", editorDefaults->font_.pixelSize()).toInt()); editor_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", editorDefaults->fontAntialiasing_).toBool()); editor_->subpixelAntialiasing_->setChecked(!settings->value("speedOverQuality", !editorDefaults->subpixelAntialiasing_).toBool()); editor_->lineSpacing_->setValue(settings->value("lineSpacing", editorDefaults->lineSpacing_).toInt()); editor_->showLineNumbers_->setChecked(settings->value("showLineNumbers", editorDefaults->showLineNumbers_).toBool()); editor_->showWhitespace_->setChecked(settings->value("showWhitespace", editorDefaults->showWhitespace_).toBool()); editor_->autoIndent_->setChecked(settings->value("autoIndent", true).toBool()); { bool on = settings->value("tabIndentMode", true).toBool(); if (on) editor_->tabIndentMode_->setChecked(true); else editor_->spaceIndentMode_->setChecked(true); } editor_->tabWidth_->setValue(settings->value("tabWidth", editorDefaults->tabWidth_).toInt()); editor_->indentWidth_->setValue(settings->value("indentWidth", editorDefaults->tabWidth_).toInt()); settings->endGroup(); } if ((selection & Terminal) != 0) { settings->beginGroup("terminal"); setFontFamily(terminal_->font_, settings->value("font"), terminalDefaults->font_); terminal_->fontSize_->setValue(settings->value("fontSize", terminalDefaults->font_.pixelSize()).toInt()); terminal_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", terminalDefaults->fontAntialiasing_).toBool()); terminal_->subpixelAntialiasing_->setChecked(!settings->value("speedOverQuality", !terminalDefaults->subpixelAntialiasing_).toBool()); terminal_->lineSpacing_->setValue(settings->value("lineSpacing", terminalDefaults->lineSpacing_).toInt()); terminal_->endlessLogging_->setChecked(settings->value("endlessLogging", true).toBool()); terminal_->numberOfLines_->setValue(settings->value("numberOfLines", terminal_->numberOfLines_->maximum()).toInt()); { Ref<Palette> palette = paletteManager_->paletteByName(settings->value("palette", "Default").toString()); for (int i = 0, n = paletteIndices_.length(); i < n; ++i) if (paletteManager_->paletteByIndex(paletteIndices_.at(i)) == palette) terminal_->palette_->setCurrentIndex(i); } { QString title = settings->value("title", "$FG").toString(); int titleIndex = terminal_->title_->findText(title); if (titleIndex != -1) terminal_->title_->setCurrentIndex(titleIndex); else terminal_->title_->setEditText(title); } settings->endGroup(); } if ((selection & Printing) != 0) { settings->beginGroup("printing"); setFontFamily(printing_->font_, settings->value("font"), editorDefaults->font_); printing_->fontSize_->setValue(settings->value("fontSize", 10).toInt()); printing_->fontAntialiasing_->setChecked(settings->value("fontAntialiasing", editorDefaults->fontAntialiasing_).toBool()); printing_->lineSpacing_->setValue(settings->value("lineSpacing", 1).toInt()); printing_->showLineNumbers_->setChecked(settings->value("showLineNumbers", editorDefaults->showLineNumbers_).toBool()); printing_->showWhitespace_->setChecked(settings->value("showWhitespace", false).toBool()); printing_->pageHeader_->setChecked(settings->value("printingPageHeader", true).toBool()); printing_->pageBorder_->setChecked(settings->value("printingPageBorder", true).toBool()); settings->endGroup(); } if ((selection & Theme) != 0) { settings->beginGroup("theme"); if (settings->contains("activeTheme")) themesView_->setCurrentIndex(themesView_->model()->index(themeManager_->themeIndex(settings->value("activeTheme").toString()), 0)); else themesView_->setCurrentIndex(themesView_->model()->index(themeManager_->defaultThemeIndex(), 0)); settings->endGroup(); } if ((selection & Commands) != 0) { settings->beginGroup("commands"); { QVariantList list = settings->value("commands", QVariantList()).toList(); commandsList_->clear(); for (int i = 0; i < list.size(); ++i) { QxCommand* cmd = new QxCommand(parent()); connect(cmd, SIGNAL(triggered(QxCommand*)), this, SIGNAL(commandTriggered(QxCommand*))); QAction* action = new QAction(parent()); // parentWidget()->addAction(action); cmd->assignAction(action); QVariantList al = list.at(i).toList(); cmd->restore(list.at(i).toList()); cmd->updateAction(); commandsList_->append(cmd); } // commands_->view_->resizeColumnToContents(0); } settings->endGroup(); }