void CCTableView::setData(CompletionCase* data,QString prefix) { _prefix=prefix; _data=data; origModel=0; updateSuggestions(); updateSuggestions(); }
void HunspellDialog::languageComboChanged(const QString &newLanguage) { m_returnToDefaultLang=true; QString wordLang=LanguageManager::instance()->getAbbrevFromLang(newLanguage, true, false); if (!m_hspellerMap->contains(wordLang) ) { //qDebug()<<"hspeller"<<wordLang<<"does not exist"; return; } //qDebug()<<wordLang<<newLanguage; if (m_wfList->count()==0) return; if (m_wfListIndex>=m_wfList->count()) m_wfListIndex=0; QString word=m_wfList->at(m_wfListIndex).w; if ((*m_hspellerMap)[wordLang]->spell(word)==0) { QStringList replacements = (*m_hspellerMap)[wordLang]->suggest(word); updateSuggestions(replacements); } else { (*m_wfList)[m_wfListIndex].changed=true; m_docChanged=true; goToNextWord(); } }
ACLineEdit::ACLineEdit(QWidget *parent) : QLineEdit(parent) { QStringList listA,listB; for(int i=0;i<1500;i++) { listA<<QString::number(i); listB<<QString::number(i+1500); } QStringList fullList; fullList<<listA<<listB; // completer->setModel(new ACModel); QStringList headers; headers<<"Scalers"<<"Vectors"; completer = new ACCompleter; completer->setModel(new QStringListModel(fullList)); completer->setPopup(tableView=new ACTableView(listA,listB)); // completer->setPopup(tableView); tableView->setColumnHeaders(QStringList("Scaler")); completer->setTModel(tableView->model()); setCompleter(completer); tableView->setCompleter(completer); connect(this,SIGNAL(textChanged(QString)),tableView,SLOT(updateSuggestions())); }
NewPlaylistWidget::NewPlaylistWidget( QWidget* parent ) : QWidget( parent ) , ui( new Ui::NewPlaylistWidget ) { ui->setupUi( this ); m_saveButton = new QPushButton( tr( "&Create Playlist" ) ); m_saveButton->setDefault( true ); m_saveButton->setEnabled( false ); ui->buttonBox->addButton( m_saveButton, QDialogButtonBox::AcceptRole ); connect( ui->titleEdit, SIGNAL( textChanged( QString ) ), SLOT( onTitleChanged( QString ) ) ); connect( ui->tagEdit, SIGNAL( textChanged( QString ) ), SLOT( onTagChanged() ) ); connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( savePlaylist() ) ); connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( cancel() ) ); m_suggestionsModel = new PlaylistModel( ui->suggestionsView ); ui->suggestionsView->setPlaylistModel( m_suggestionsModel ); ui->suggestionsView->overlay()->setEnabled( false ); connect( &m_filterTimer, SIGNAL( timeout() ), SLOT( updateSuggestions() ) ); ui->titleEdit->setFocus(); }
// CategoricalCompleter CategoricalCompleter::CategoricalCompleter(QLineEdit *lineEdit, QList<CompletionCase> *data) : QCompleter(join((*data)[0])), _tableView(new CCTableView(&(*data)[0])), _data(*data), _currentSubset(&(*data)[0]) { setPopup(_tableView); lineEdit->setCompleter(this); _tableView->setCompleter(this); _tableView->updateSuggestions(); setCompletionMode(PopupCompletion); connect(lineEdit,SIGNAL(textChanged(QString)),_tableView,SLOT(updateSuggestions())); connect(lineEdit,SIGNAL(textChanged(QString)),this,SLOT(updateCurrentSuggestions())); connect(lineEdit,SIGNAL(cursorPositionChanged(int,int)),this,SLOT(updateCurrentSuggestions())); }
void Window::searchByChanged() { if( ui->comboBox->currentText() == tr("Dari") ) { ui->searchEdit->setAlignment(Qt::AlignRight|Qt::AlignVCenter); } else { ui->searchEdit->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); } updateSuggestions(); }
Window::Window(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); if(!QSqlDatabase::isDriverAvailable("QSQLITE")) { QMessageBox::critical (nullptr,"Fatal error", "The driver for the database is not available. It is unlikely that you will solve this on your own. Rather you had better contact the developer."); return; } QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); QDir appFolder( QCoreApplication::applicationDirPath() ); QString dbPath = appFolder.absoluteFilePath("dedic2.db"); if( !appFolder.exists("dedic2.db") ) { QMessageBox::critical (this,tr("Error Message"),tr("The database file does not exist. I was looking for: %1").arg(dbPath) ); return; } db.setConnectOptions("QSQLITE_ENABLE_REGEXP"); db.setDatabaseName( dbPath ); if(!db.open()) { QMessageBox::critical (this, tr("Error Message"), tr("There was a problem in opening the database. The database said: %1. It is unlikely that you will solve this on your own. Rather you had better contact the developer.").arg(db.lastError().databaseText()) ); return; } db.exec("PRAGMA case_sensitive_like=ON;"); mQueryModel = new QSqlQueryModel; connect(ui->comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(searchByChanged())); connect(ui->listView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(updateDefinition(const QModelIndex &))); connect(ui->searchEdit, SIGNAL(textEdited(const QString &)), this, SLOT(updateSuggestions())); connect(ui->versionButton, SIGNAL(clicked(bool)), this, SLOT(versionInformation())); connect(ui->searchMethodCombo, SIGNAL(currentTextChanged(QString)), this, SLOT(updateSuggestions()) ); ui->searchEdit->setFocus(); }
void HunspellDialog::goToNextWord(int i) { if (m_returnToDefaultLang) { bool b=languagesComboBox->blockSignals(true); languagesComboBox->setCurrentIndex(m_primaryLangIndex); languagesComboBox->blockSignals(b); } if (i>=0) m_wfListIndex=i; else { do { ++m_wfListIndex; } while (m_wfListIndex<m_wfList->count() && (m_wfList->at(m_wfListIndex).changed || m_wfList->at(m_wfListIndex).ignore)); //qDebug()<<"selected word index"<<m_wfListIndex; } if (m_wfListIndex>=m_wfList->count()) { statusLabel->setText(tr("Spelling check complete")); suggestionsListWidget->clear(); sentenceTextEdit->clear(); changePushButton->setEnabled(false); changeAllPushButton->setEnabled(false); ignoreOncePushButton->setEnabled(false); ignoreAllPushButton->setEnabled(false); return; } else statusLabel->setText(""); currWF=m_wfList->at(m_wfListIndex); setLanguageCombo(currWF.lang); updateSuggestions(currWF.replacements); int sentencePos=0; QString sentence(m_iText->sentence(currWF.start, sentencePos)); sentence.insert(currWF.end-sentencePos+currWF.changeOffset,"</b></font>"); sentence.insert(currWF.start-sentencePos+currWF.changeOffset,"<font color=red><b>"); sentenceTextEdit->setText(sentence); }
/** * This method should do a reset configuration to current state -- * i.e. reread configuration data from the plugin's storage. */ void CppHelperPluginConfigPage::reset() { kDebug(DEBUG_AREA) << "** CONFIG-PAGE **: Reseting configuration"; // Put dirs to the list m_system_list->pathsList->addItems(m_plugin->config().systemDirs()); m_session_list->pathsList->addItems(m_plugin->config().sessionDirs()); m_clang_config->pchHeader->setUrl(m_plugin->config().precompiledHeaderFile()); m_clang_config->commandLineParams->setPlainText(m_plugin->config().clangParams()); m_pss_config->includeMarkersSwitch->setChecked(m_plugin->config().useLtGt()); m_pss_config->useCurrentDirSwitch->setChecked(m_plugin->config().useCwd()); m_pss_config->ignoreExtensions->setText( m_plugin->config().ignoreExtensions().join(", ") ); m_pss_config->openFirstHeader->setChecked(m_plugin->config().shouldOpenFirstInclude()); m_pss_config->useWildcardSearch->setChecked(m_plugin->config().useWildcardSearch()); m_completion_settings->highlightResults->setChecked(m_plugin->config().highlightCompletions()); m_completion_settings->sanitizeResults->setChecked(m_plugin->config().sanitizeCompletions()); m_completion_settings->appendOnImport->setChecked(m_plugin->config().appendOnImport()); m_completion_settings->autoCompletions->setChecked(m_plugin->config().autoCompletions()); m_completion_settings->includeMacros->setChecked(m_plugin->config().includeMacros()); m_completion_settings->usePrefixColumn->setChecked(m_plugin->config().usePrefixColumn()); pullSanitizeRules(); // Setup dirs watcher auto flags = m_plugin->config().monitorTargets(); m_pss_config->nothing->setChecked(flags == PluginConfiguration::MonitorTargets::nothing); m_pss_config->session->setChecked(flags == PluginConfiguration::MonitorTargets::sessionDirs); m_pss_config->system->setChecked(flags == PluginConfiguration::MonitorTargets::systemDirs); m_pss_config->all->setChecked(flags == PluginConfiguration::MonitorTargets::both); pchHeaderChanged(m_plugin->config().precompiledHeaderFile()); updateSuggestions(); updateSets(); }