void MetricFontDialog::writingSystemChanged( int row ) { if (!row) setWritingSystem(QFontDatabase::Any); else setWritingSystem(m_fontDatabase.writingSystems()[row-1]); }
int QFontComboBox::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QComboBox::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 4) qt_static_metacall(this, _c, _id, _a); _id -= 4; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QFontDatabase::WritingSystem*>(_v) = writingSystem(); break; case 1: *reinterpret_cast<int*>(_v) = QFlag(fontFilters()); break; case 2: *reinterpret_cast< QFont*>(_v) = currentFont(); break; } _id -= 3; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setWritingSystem(*reinterpret_cast< QFontDatabase::WritingSystem*>(_v)); break; case 1: setFontFilters(QFlag(*reinterpret_cast<int*>(_v))); break; case 2: setCurrentFont(*reinterpret_cast< QFont*>(_v)); break; } _id -= 3; } else if (_c == QMetaObject::ResetProperty) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 3; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 3; } #endif // QT_NO_PROPERTIES return _id; }
/*! Constructs a font combobox with the given \a parent. */ QFontComboBox::QFontComboBox(QWidget *parent) : QComboBox(*new QFontComboBoxPrivate, parent) { Q_D(QFontComboBox); d->currentFont = font(); setEditable(true); QStringListModel *m = new QStringListModel(this); setModel(m); setItemDelegate(new QFontFamilyDelegate(this)); QListView *lview = qobject_cast<QListView*>(view()); if (lview) lview->setUniformItemSizes(true); setWritingSystem(QFontDatabase::Any); connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(_q_currentChanged(QString))); connect(qApp, SIGNAL(fontDatabaseChanged()), this, SLOT(_q_updateModel())); }
QT_BEGIN_NAMESPACE FontPanel::FontPanel(QWidget *parentWidget) : QGroupBox(parentWidget), m_previewLineEdit(new QLineEdit), m_writingSystemComboBox(new QComboBox), m_familyComboBox(new QFontComboBox), m_styleComboBox(new QComboBox), m_pointSizeComboBox(new QComboBox), m_previewFontUpdateTimer(0) { setTitle(tr("Font")); QFormLayout *formLayout = new QFormLayout(this); // writing systems m_writingSystemComboBox->setEditable(false); QList<QFontDatabase::WritingSystem> writingSystems = m_fontDatabase.writingSystems(); writingSystems.push_front(QFontDatabase::Any); foreach (QFontDatabase::WritingSystem ws, writingSystems) m_writingSystemComboBox->addItem(QFontDatabase::writingSystemName(ws), QVariant(ws)); connect(m_writingSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotWritingSystemChanged(int))); formLayout->addRow(tr("&Writing system"), m_writingSystemComboBox); connect(m_familyComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(slotFamilyChanged(QFont))); formLayout->addRow(tr("&Family"), m_familyComboBox); m_styleComboBox->setEditable(false); connect(m_styleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotStyleChanged(int))); formLayout->addRow(tr("&Style"), m_styleComboBox); m_pointSizeComboBox->setEditable(false); connect(m_pointSizeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPointSizeChanged(int))); formLayout->addRow(tr("&Point size"), m_pointSizeComboBox); m_previewLineEdit->setReadOnly(true); formLayout->addRow(m_previewLineEdit); setWritingSystem(QFontDatabase::Any); }
void FontPanel::setSelectedFont(const QFont &f) { m_familyComboBox->setCurrentFont(f); if (m_familyComboBox->currentIndex() < 0) { // family not in writing system - find the corresponding one? QList<QFontDatabase::WritingSystem> familyWritingSystems = m_fontDatabase.writingSystems(f.family()); if (familyWritingSystems.empty()) return; setWritingSystem(familyWritingSystems.front()); m_familyComboBox->setCurrentFont(f); } updateFamily(family()); const int pointSizeIndex = closestPointSizeIndex(f.pointSize()); m_pointSizeComboBox->setCurrentIndex( pointSizeIndex); const QString styleString = m_fontDatabase.styleString(f); const int styleIndex = m_styleComboBox->findText(styleString); m_styleComboBox->setCurrentIndex(styleIndex); slotUpdatePreviewFont(); }
BaselineSearchReplaceDialog::BaselineSearchReplaceDialog(const DatabaseAdapter *dbAdapter, const WritingSystem & defaultWs, QWidget *parent) : QDialog(parent), ui(new Ui::BaselineSearchReplaceDialog) { ui->setupUi(this); mDbAdapter = dbAdapter; connect( ui->writingSystemCombo, SIGNAL(writingSystemSelected(WritingSystem)), ui->searchEdit, SLOT(setWritingSystem(WritingSystem)) ); connect( ui->writingSystemCombo, SIGNAL(writingSystemSelected(WritingSystem)), ui->replaceEdit, SLOT(setWritingSystem(WritingSystem)) ); connect( ui->replaceEdit, SIGNAL(textChanged(QString)), this, SLOT(offerReplaceFeedback()) ); connect( ui->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(offerSearchFeedback()) ); ui->writingSystemCombo->setWritingSystems( mDbAdapter->writingSystems() ); ui->writingSystemCombo->setCurrentWritingSystem( defaultWs ); }
LingTextEdit::LingTextEdit(const TextBit &bit, QWidget *parent) : QTextEdit(parent) { setWritingSystem( bit.writingSystem() ); setText( bit.text() ); }
void LingTextEdit::setTextBit(const TextBit &bit) { setWritingSystem( bit.writingSystem() ); setText( bit.text() ); }