本文整理汇总了C++中Phrase::source方法的典型用法代码示例。如果您正苦于以下问题:C++ Phrase::source方法的具体用法?C++ Phrase::source怎么用?C++ Phrase::source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phrase
的用法示例。
在下文中一共展示了Phrase::source方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: data
QVariant PhraseModel::data(const QModelIndex &index, int role) const
{
int row = index.row();
int column = index.column();
if (row >= plist.count() || !index.isValid())
return QVariant();
Phrase *phrase = plist.at(row);
if (role == Qt::DisplayRole || (role == Qt::ToolTipRole && column != 2)) {
switch (column) {
case 0: // source phrase
return phrase->source().simplified();
case 1: // translation
return phrase->target().simplified();
case 2: // definition
return phrase->definition();
}
}
else if (role == Qt::EditRole && column != 2) {
switch (column) {
case 0: // source phrase
return phrase->source();
case 1: // translation
return phrase->target();
}
}
return QVariant();
}
示例2: setPhrase
void PhraseLVI::setPhrase( const Phrase& phrase )
{
setText( SourceTextShown, phrase.source().simplifyWhiteSpace() );
setText( TargetTextShown, phrase.target().simplifyWhiteSpace() );
setText( DefinitionText, phrase.definition() );
setText( SourceTextOriginal, phrase.source() );
setText( TargetTextOriginal, phrase.target() );
}
示例3: enableDisable
void PhraseBookBox::enableDisable()
{
QModelIndex index = currentPhraseIndex();
sourceLed->blockSignals(true);
targetLed->blockSignals(true);
definitionLed->blockSignals(true);
bool indexValid = index.isValid();
if (indexValid) {
Phrase *p = phrMdl->phrase(index);
sourceLed->setText(p->source().simplified());
targetLed->setText(p->target().simplified());
definitionLed->setText(p->definition());
}
else {
sourceLed->setText(QString());
targetLed->setText(QString());
definitionLed->setText(QString());
}
sourceLed->setEnabled(indexValid);
targetLed->setEnabled(indexValid);
definitionLed->setEnabled(indexValid);
removeBut->setEnabled(indexValid);
sourceLed->blockSignals(false);
targetLed->blockSignals(false);
definitionLed->blockSignals(false);
QWidget *f = QApplication::focusWidget();
if (f != sourceLed && f != targetLed && f != definitionLed) {
QLineEdit *led = (sourceLed->text() == NewPhrase ? sourceLed : targetLed);
led->setFocus();
led->selectAll();
} else {
static_cast<QLineEdit*>(f)->selectAll();
}
}
示例4:
bool operator==( const Phrase& p, const Phrase& q )
{
return p.source() == q.source() && p.target() == q.target() &&
p.definition() == q.definition();
}