bool DictWidget::lookup(const QString &word) { if (word.isEmpty()) { return false; } resetSimilarWordsOffset(); // Clean the word. word_ = word.trimmed(); // Title QString result; bool ret = dict_.translate(word_, result); formatResult(result); // Result doc_.setHtml(result); // Always stop timer as the screen can be updated later. launchTimer(false); updateVisibleWidgets(); onDetailsClicked(true); return ret; }
bool DictFrame::lookup(const QString &word) { if (word.isEmpty()) { return false; } resetSimilarWordsOffset(); // Clean the word. word_ = word.trimmed(); // Title QString result; bool ret = dict_mgr_.translate(word_, result); formatResult(result); // Result doc_.setHtml(result); updateVisibleWidgets(); onDetailsClicked(true); return ret; }
void VideosWindow::onContextMenuRequested(const QPoint &pos) { if (ui->objectList->currentIndex().data(UserRoleHeader).toBool()) return; QMenu *contextMenu = new KbMenu(this); contextMenu->setAttribute(Qt::WA_DeleteOnClose); contextMenu->addAction(tr("Delete"), this, SLOT(onDeleteClicked())); contextMenu->addAction(tr("Share"), this, SLOT(onShareClicked())); contextMenu->addAction(tr("Details"), this, SLOT(onDetailsClicked())); contextMenu->exec(this->mapToGlobal(pos)); }
bool DictWidget::lookup(const QString &word) { if (word.isEmpty() || word_ == word.trimmed()) { return false; } resetSimilarWordsOffset(); // Clean the word. word_ = word.trimmed(); //remove quotes (“ ” " ) If it in the words if(word_.contains(QChar(0x201C)) || word_.contains(QChar(0x201D)) || word_.contains(QChar(0x0022))) { word_.remove(QChar(0x201C)); word_.remove(QChar(0x201D)); word_.remove(QChar(0x0022)); } // Title QString result; QString fuzzy_word(""); bool ret = dict_.fuzzyTranslate(word_, result, fuzzy_word); fuzzy_word_ = fuzzy_word; formatResult(result, fuzzy_word); // Result doc_.setHtml(result); // Always stop timer as the screen can be updated later. launchTimer(false); update_parent_ = false; updateVisibleWidgets(); onDetailsClicked(true); return ret; }