void EnrichmentDialog::initImagePage() { imagePage = new QWidget(); QGroupBox *gb = new QGroupBox(); QGridLayout *gl = new QGridLayout(gb); gl->addWidget(new QLabel( tr("File")), 0, 0); imagePathBox = new QLineEdit(); QCompleter *completer = new QCompleter(this); completer->setModel(new QDirModel(completer)); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); completer->setCompletionMode(QCompleter::InlineCompletion); imagePathBox->setCompleter(completer); gl->addWidget(imagePathBox, 0, 1); QPushButton *browseBtn = new QPushButton(); connect(browseBtn, SIGNAL(clicked()), this, SLOT(chooseImageFile())); browseBtn->setIcon(QIcon(":/folder_open.png")); gl->addWidget(browseBtn, 0, 2); boxSaveImagesInternally = new QCheckBox(tr("&Save internally")); connect(boxSaveImagesInternally, SIGNAL(toggled(bool)), this, SLOT(saveImagesInternally(bool))); gl->addWidget(boxSaveImagesInternally, 1, 1); gl->setColumnStretch(1, 1); gl->setRowStretch(2, 1); QVBoxLayout *layout = new QVBoxLayout(imagePage); layout->addWidget(gb); tabWidget->addTab(imagePage, tr( "&Image" ) ); }
QCompleter *createCompleter() { PythonCompleterListView *lstView = new PythonCompleterListView(); lstView->setItemDelegateForColumn(0, new PythonCompleterDelegate()); QCompleter *completer = new QCompleter(); completer->setPopup(lstView); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setCaseSensitivity(Qt::CaseSensitive); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); return completer; }
QCompleter *CompleterHelper::completer(const QString &tableName, const QString &columnName, QWidget *parent) { QCompleter *completer = new QCompleter(parent); QString queryText = QString("SELECT DISTINCT %1 FROM %2 ORDER BY %1").arg(columnName).arg(tableName); QSqlQueryModel *completerModel = new QSqlQueryModel(completer); completerModel->setQuery(queryText); completer->setModel(completerModel); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); return completer; }
void QtVoxOxCallBarFrame::fillCompletionList(){ //TODO: this completion list should change when we have SQLite working, so completion list keeps username and we can get their full name like [email protected] or other network QStringList tobeinserted = QStringList(); QString contactId; Config & config = ConfigManager::getInstance().getCurrentConfig(); std::string jabberVoxOxServer = "@" + config.getJabberVoxoxServer(); if(_cUserProfile) { UserProfile & userProfile = _cUserProfile->getUserProfile(); for ( Contacts::const_iterator it = userProfile.getContactList().getContacts().begin(); it != userProfile.getContactList().getContacts().end(); ++it) { contactId = QString::fromStdString(it->second.getContactId());//VOXOX CHANGE by Rolando - 2009.05.11 - gets the contact id if(!contactId.contains(FACEBOOK_SUFFIX)){//VOXOX CHANGE by Rolando - 2009.05.11 - because id of facebook contacts are "number@" // VOXOX CHANGE by ASV 05-12-2009: method "removeDuplicates()" is not part of Q4.4;I had to change it so that it works on the Mac (Qt4.4) if (!tobeinserted.contains(contactId)) { tobeinserted << contactId; } //end VOXOX CHANGE by ASV } QString temp = QString::fromStdString(it->second.getDisplayName()).toLower();//VOXOX CHANGE by Rolando - 2009.05.11 - gets the display name // VOXOX CHANGE by ASV 05-12-2009: method "removeDuplicates()" is not part of Q4.4;I had to change it so that it works on the Mac (Qt4.4) if (!tobeinserted.contains(temp)) { tobeinserted << temp; } //end VOXOX CHANGE by ASV //tobeinserted << QString::fromStdString(it->second.getVoxOxPhone());//TODO: VOXOX CHANGE by Rolando - 2009.05.08 get VoxOx phone number when SQLite be integrated } } // VOXOX CHANGE by ASV 05-12-2009: method "removeDuplicates()" is not part of Q4.4;I had to change it so that it works on the Mac (Qt4.4) //tobeinserted.removeDuplicates(); //end VOXOX CHANGE by ASV if (tobeinserted.size() > 0) { tobeinserted.sort(); QCompleter *completer = new QCompleter(tobeinserted, this); completer->setCompletionMode ( QCompleter::PopupCompletion ); completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); _voxOxToolTipLineEdit->setCompleter(completer); } }
void Omnibar::showCommands() { this->setFocus(); this->setText(": "); QCompleter *completer = this->completer(); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setFilterMode(Qt::MatchStartsWith); completer->setMaxVisibleItems(20); completer->setCompletionPrefix(": "); completer->complete(); }
void Omnibar::setupCompleter() { // Set gotoEntry completer for jump history QStringList flagsList = this->getFlags(); QCompleter *completer = new QCompleter(flagsList, this); completer->setMaxVisibleItems(20); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setFilterMode(Qt::MatchContains); QStringListModel *completerModel = (QStringListModel*)(completer->model()); completerModel->setStringList(completerModel->stringList() << this->commands); this->setCompleter(completer); }
void ProjectReader::readScripts(QString &path, QString &name, bool open) { Q_ASSERT(xml.isStartElement() && xml.name() == QLatin1String("Script")); QString n; Highlighter *h; QCompleter *c; CodeEditor *editor = new CodeEditor(name, 0, h); if (open) { editor = 0; mMw->addCodeEditor(path + "/" + name); } else { editor->setUndoRedoEnabled(true); editor->setTabStopWidth(29); #ifdef Q_WS_MAC int size = 12; QFont font("Monaco", size); #endif #ifdef Q_OS_WIN int size = 10; QFont font("Consolas", size); #endif #ifdef Q_OS_LINUX int size = 10; QFont font("Inconsolata-g", size); #endif editor->setFont(font); h = new Highlighter(editor->document()); c = new QCompleter(); c->setModel(mDocumentManager->modelFromFile(":/wordlist.txt")); c->setModelSorting(QCompleter::CaseInsensitivelySortedModel); c->setCaseSensitivity(Qt::CaseInsensitive); c->setWrapAround(false); c->popup()->setStyleSheet("color: #848484; background-color: #2E2E2E; selection-background-color: #424242;"); editor->setCompleter(c); n = path + "/" + name; //qDebug() << "look a script" << n; editor->openFile(path + "/" + name); mMw->addCodeEditor(editor, open); } xml.skipCurrentElement(); }
ScriptEdit::ScriptEdit(ScriptingEnv *env, QWidget *parent, const char *name) : QTextEdit(parent, name), scripted(env), d_error(false), d_completer(0), d_highlighter(0), d_file_name(QString::null), d_search_string(QString::null), d_output_widget(NULL) { myScript = scriptEnv->newScript("", this, name); connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SLOT(insertErrorMsg(const QString&))); connect(myScript, SIGNAL(print(const QString&)), this, SLOT(scriptPrint(const QString&))); connect(myScript, SIGNAL(error(const QString&, const QString&, int)), this, SIGNAL(error(const QString&, const QString&, int))); setLineWrapMode(NoWrap); setUndoRedoEnabled(true); setTextFormat(Qt::PlainText); setAcceptRichText (false); setFocusPolicy(Qt::StrongFocus); rehighlight(); d_fmt_default.setBackground(palette().brush(QPalette::Base)); //Init completer based on parser built-in functions QStringList functions = MyParser::functionNamesList(); functions.sort(); QCompleter *completer = new QCompleter(this); completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); completer->setCompletionMode(QCompleter::PopupCompletion); completer->setModel(new QStringListModel(functions, completer)); setCompleter(completer); printCursor = textCursor(); scriptsDirPath = qApp->applicationDirPath(); actionExecute = new QAction(tr("E&xecute"), this); actionExecute->setShortcut( tr("Ctrl+J") ); connect(actionExecute, SIGNAL(activated()), this, SLOT(execute())); actionExecuteAll = new QAction(QIcon(":/play.png"), tr("Execute &All"), this); actionExecuteAll->setShortcut( tr("Ctrl+Shift+J") ); connect(actionExecuteAll, SIGNAL(activated()), this, SLOT(executeAll())); actionEval = new QAction(tr("&Evaluate Expression"), this); actionEval->setShortcut( tr("Ctrl+Return") ); connect(actionEval, SIGNAL(activated()), this, SLOT(evaluate())); actionPrint = new QAction(QIcon(":/fileprint.png"), tr("&Print"), this); connect(actionPrint, SIGNAL(activated()), this, SLOT(print())); actionImport = new QAction(QIcon(":/fileopen.png"), tr("&Import..."), this); actionImport->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_O)); connect(actionImport, SIGNAL(activated()), this, SLOT(importASCII())); actionSave = new QAction(QIcon(":/filesave.png"), tr("&Save"), this); actionSave->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_S)); connect(actionSave, SIGNAL(activated()), this, SLOT(save())); actionExport = new QAction(QIcon(":/filesaveas.png"), tr("Sa&ve as..."), this); connect(actionExport, SIGNAL(activated()), this, SLOT(exportASCII())); actionFind = new QAction(QIcon(":/find.png"), tr("&Find..."), this); actionFind->setShortcut(QKeySequence(Qt::CTRL+Qt::ALT+Qt::Key_F)); connect(actionFind, SIGNAL(activated()), this, SLOT(showFindDialog())); actionReplace = new QAction(QIcon(":/replace.png"), tr("&Replace..."), this); actionReplace->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_R)); connect(actionReplace, SIGNAL(activated()), this, SLOT(replace())); actionFindNext = new QAction(QIcon(":/find_next.png"), tr("&Find next"), this); actionFindNext->setShortcut(QKeySequence(Qt::Key_F3)); connect(actionFindNext, SIGNAL(activated()), this, SLOT(findNext())); actionFindPrevious = new QAction(QIcon(":/find_previous.png"), tr("&Find previous"), this); actionFindPrevious->setShortcut(QKeySequence(Qt::Key_F4)); connect(actionFindPrevious, SIGNAL(activated()), this, SLOT(findPrevious())); functionsMenu = new QMenu(this); Q_CHECK_PTR(functionsMenu); connect(functionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(insertFunction(QAction *))); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(matchParentheses())); }