Esempio n. 1
0
    void CodeLineEdit::insertVariable(const QString &variable)
    {
        //If a validator is set this means that the insertion will fail
        //In this case, reset the content and set the code mode
        if(validator())
        {
            if(!text().isEmpty() && QMessageBox::question(this, tr("Insert variable/resource"), tr("Inserting a variable or a resource will replace the current parameter value.\nAre you sure?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes)
                return;

            setCode(true);
            setText(QString());
        }

        //Temporarily remove the completer so that we don't get a popup
        QCompleter *currentCompleter = completer();
        if(currentCompleter)
        {
            currentCompleter->setParent(0);
            setCompleter(0);
        }

        if(isCode())
            insert(variable);
        else
            insert("$" + variable);

        if(currentCompleter)
        {
            currentCompleter->setParent(this);
            setCompleter(currentCompleter);
        }
    }
Esempio n. 2
0
AddressWidget::AddressWidget(Window *window, QWidget *parent) : QLineEdit(parent),
	m_window(NULL),
	m_completer(new QCompleter(AddressCompletionModel::getInstance(), this)),
	m_bookmarkLabel(NULL),
	m_feedsLabel(NULL),
	m_loadPluginsLabel(NULL),
	m_urlIconLabel(NULL),
	m_simpleMode(false)
{
	m_completer->setCaseSensitivity(Qt::CaseInsensitive);
	m_completer->setCompletionMode(QCompleter::InlineCompletion);
	m_completer->setCompletionRole(Qt::DisplayRole);
	m_completer->setFilterMode(Qt::MatchStartsWith);

	setWindow(window);
	setCompleter(m_completer);
	setMinimumWidth(100);

	ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent);

	if (toolBar)
	{
		optionChanged(QLatin1String("AddressField/ShowBookmarkIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowBookmarkIcon")));
		optionChanged(QLatin1String("AddressField/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowUrlIcon")));
		setPlaceholderText(tr("Enter address or search…"));
		setMouseTracking(true);

		connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
		connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*)));
	}
	else
	{
Esempio n. 3
0
PlaceEdit::PlaceEdit(PlaceEdit *_parent, int _index, QString placeholderText, QWidget *qparent)
  : QLineEdit(qparent)
{
  qDebug() << "creating place edit";

  setMaxLength(40);

  setPlaceholderText(placeholderText);

  m_model = new PlaceModel(_index, this);
  m_completer = new QCompleter(m_model, this);
  m_completer->setCaseSensitivity(Qt::CaseInsensitive);

  // TODO put in mask
  // TODO prevent slashes

  m_completer->setModel(m_model);
  setCompleter(m_completer);

  setValidator(new LineValidator(this));

  if (_parent) {
    connect(_parent->model(), SIGNAL(valueChanged(QString)), m_model, SLOT(onParentTextChanged(QString)));
    connect(_parent->model(), SIGNAL(valueChanged(QString)), this, SLOT(onParentTextChanged(QString)));
  }
}
Esempio n. 4
0
//***********************************************************
//* Load the completer with the list of valid tag names
//***********************************************************
void TagEditorNewTag::loadCompleter() {
    if (completer != NULL) {
        delete completer;
    }
    QList<int> tagList;
    TagTable tagTable;
    QStringList tagNames;
    tagTable.getAll(tagList);
    for (qint32 i=0; i<tagList.size(); i++) {
        Tag t;
        QString guid;
        tagTable.getGuid(guid, tagList[i]);
        tagTable.get(t, guid);
        QString name = QString::fromStdString(t.name);
        qint32 tagAccount = tagTable.owningAccount(tagList[i]);
        if (!currentTags.contains(name) && tagAccount == account)
            tagNames << name;
    }
    qSort(tagNames.begin(), tagNames.end(), caseInsensitiveLessThan);
    completer = new QCompleter(tagNames, this);
    completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    //completer->setCompletionMode(QCompleter::InlineCompletion);
    setCompleter(completer);
}
void TComboBoxModelRecord::filtrar(int code)
{
    QChar c( code );
    if ( c.isLetterOrNumber() || c.isSymbol() || code == Qt::Key_Backspace )
    {
        QStringList lstMie;
        lstFiltrados.clear();

        if ( m )
            delete m;

        m=new QStringListModel;

        for ( int c=0;c<lst.size(); c++ )
        {
            QString item=lst.at( c );
            if ( item.left( escrito.size() ).compare( escrito, Qt::CaseInsensitive ) == 0 )
            {
                lstMie.append( item );
                lstFiltrados.append( c );
            }
        }
        m->setStringList( lstMie );

        QComboBox::setModel( m );
        QComboBox::setModelColumn(0);
        setCurrentIndex(-1);
        setCompleter(0);
        setEditText(escrito);
        showPopup();
    }
}
Esempio n. 6
0
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()));
}
Esempio n. 7
0
AddressWidget::AddressWidget(QWidget *parent) : QLineEdit(parent),
	m_window(NULL),
	m_completer(new QCompleter(AddressCompletionModel::getInstance(), this)),
	m_bookmarkLabel(NULL),
	m_urlIconLabel(NULL),
	m_lookupIdentifier(0),
	m_lookupTimer(0)
{
	m_completer->setCaseSensitivity(Qt::CaseInsensitive);
	m_completer->setCompletionMode(QCompleter::InlineCompletion);
	m_completer->setCompletionRole(Qt::DisplayRole);
	m_completer->setFilterMode(Qt::MatchStartsWith);

	optionChanged(QLatin1String("AddressField/ShowBookmarkIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowBookmarkIcon")));
	optionChanged(QLatin1String("AddressField/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowUrlIcon")));
	setCompleter(m_completer);
	setMinimumWidth(100);
	setMouseTracking(true);
	installEventFilter(this);

	connect(this, SIGNAL(textChanged(QString)), this, SLOT(setCompletion(QString)));
	connect(this, SIGNAL(returnPressed()), this, SLOT(notifyRequestedLoadUrl()));
	connect(BookmarksManager::getInstance(), SIGNAL(modelModified()), this, SLOT(updateBookmark()));
	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
}
Esempio n. 8
0
AddTagsLineEdit::AddTagsLineEdit(QWidget* const parent)
    : QLineEdit(parent),
      d(new Private)
{
    setClearButtonEnabled(true);

    d->completer = new TagCompleter(this);
    d->completer->setMaxVisibleItems(15);

    setCompleter(d->completer);

    connect(this, SIGNAL(returnPressed()),
            this, SLOT(slotReturnPressed()));

    connect(this, SIGNAL(editingFinished()),
            this, SLOT(slotEditingFinished()));

    connect(this, SIGNAL(textChanged(QString)),
            this, SLOT(slotTextChanged(QString)));

    connect(this, SIGNAL(textEdited(QString)),
            d->completer, SLOT(slotTextEdited(QString)));

    connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::activated),
            [this](const TaggingAction& action){ completerActivated(action); });

    connect(d->completer, static_cast<void(TagCompleter::*)(const TaggingAction&)>(&TagCompleter::highlighted),
            [this](const TaggingAction& action){ completerHighlighted(action); });
}
Esempio n. 9
0
/*
    ToolbarSearch is a search widget that also contains a small history
    and uses open-search for searching.
 */
ToolbarSearch::ToolbarSearch(QWidget *parent)
    : SearchLineEdit(parent)
    , m_suggestionsEnabled(true)
    , m_autosaver(new AutoSaver(this))
    , m_maxSavedSearches(10)
    , m_model(new QStandardItemModel(this))
    , m_suggestionsItem(0)
    , m_recentSearchesItem(0)
    , m_suggestTimer(0)
    , m_completer(0)
{
    connect(openSearchManager(), SIGNAL(currentEngineChanged()),
            this, SLOT(currentEngineChanged()));

    m_completer = new QCompleter(m_model, this);
    m_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
    setCompleter(m_completer);

    searchButton()->setShowMenuTriangle(true);

    connect(searchButton(), SIGNAL(clicked()),
            this, SLOT(showEnginesMenu()));
    connect(this, SIGNAL(returnPressed()),
            this, SLOT(searchNow()));

    load();

    currentEngineChanged();
}
Esempio n. 10
0
	void CodeLineEdit::setCompletionModel(QAbstractItemModel *completionModel)
	{
		mCompletionModel = completionModel;
		
		if(mCode)
            setCompleter(new ScriptCompleter(mCompletionModel, this));
    }
Esempio n. 11
0
MgCommandLine::MgCommandLine(QWidget * parent)
:QLineEdit(parent),m_scriptEngine(0)
{
	setStyleSheet(" "
			"QLineEdit {"
			"border: 1px solid darkgray;"
			"border-radius: 2px;"
			"padding: 0 8px;"
			"background: rgb(45,45,45);"
			"color: rgb(210,210,210);"
			"selection-background-color: darkgray;"
			"}");

	m_completionModel = new  QStringListModel(this);
	m_completionModel->setStringList(QStringList());
	m_completer = new QCompleter(m_completionModel,this);
	m_completer->setCompletionMode(QCompleter::PopupCompletion);
	setCompleter(m_completer);
	disconnect(m_completer, 0, this, 0);
    connect(m_completer, SIGNAL(activated(QString)),this,SLOT(insertText(QString)));
	QPalette p = m_completer->popup()->palette();
	p.setColor(QPalette::Base,QColor(45,45,45));
	p.setColor(QPalette::Text,QColor(210,210,210));
	m_completer->popup()->setPalette(p);
	m_completer->popup()->setWindowOpacity(.8);
	connect(this,SIGNAL(textChanged(QString)),this,SLOT(updateCompletion()));
}
Esempio n. 12
0
/*!
 * Constructs a file chooser with a given \a parent.
 * 
 */
QwwFileChooser::QwwFileChooser(QWidget *parent) : QwwButtonLineEdit(*new QwwFileChooserPrivate(this), parent) {
    Q_D(QwwFileChooser);
#if QT_VERSION >= 0x040200 && !defined(QT_NO_COMPLETER)
    d->completer = new QCompleter(this);
    setCompleter(d->completer);
    QStyleOption opt;
    opt.initFrom(this);
    int mar = style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &opt, this);
    int siz = style()->pixelMetric(QStyle::PM_SmallIconSize, &opt, this);
#if QT_VERSION >=0x040500
    setTextMargins(siz+2, 0, 0, 0);
#else
    setStyleSheet(QString("QwwFileChooser {padding-left: %1px;}").arg(mar+siz+2));
#endif

//     connect(this, SIGNAL(textEdited(const QString&)), d->completer, SLOT(setCompletionPrefix(const QString&)));
#endif
    setModel(new QDirModel(this));
    setButtonPosition(RightOutside);
    connect(this, SIGNAL(buttonClicked()), this, SLOT(chooseFile()));
    setAutoRaise(true);
    setAcceptMode(QFileDialog::AcceptOpen);

    QShortcut *sc = new QShortcut(QKeySequence("Ctrl+Space"), this);
    connect(sc, SIGNAL(activated()), d->completer, SLOT(complete()));
    connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(_q_textChanged(const QString&)));
}
Esempio n. 13
0
//***********************************************************
//* Load the completer with the list of valid tag names
//***********************************************************
void TagEditorNewTag::loadCompleter() {
    QLOG_TRACE_IN() << typeid(*this).name();
    QList<int> tagList;
    TagTable tagTable(global.db);
    QStringList tagNames;
    tagTable.getAll(tagList);
    for (qint32 i=0; i<tagList.size(); i++) {
        Tag t;
        QString guid;
        tagTable.getGuid(guid, tagList[i]);
        tagTable.get(t, guid);
        QString name = t.name;
        qint32 tagAccount = tagTable.owningAccount(tagList[i]);
        if (!currentTags.contains(name) && tagAccount == account)
            tagNames << name;
    }
    qSort(tagNames.begin(), tagNames.end(), caseInsensitiveLessThan);
    completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    setCompleter(completer);

    QStringListModel *model;
    model = (QStringListModel*)(completer->model());
    if(model==NULL)
        model = new QStringListModel();

    model->setStringList(tagNames);
    completer->setModel(model);
    QLOG_TRACE_OUT() << typeid(*this).name();
}
Esempio n. 14
0
// line search
OCamlSourceSearch::OCamlSourceSearch( OCamlSource *editor ) : QLineEdit( editor )
{
    codeEditor = editor;
    searched_pattern = Options::get_opt_strlst( "SEARCHED_PATTERN" ) ;
    completer_p = new QCompleter( searched_pattern );
    setCompleter( completer_p );
    connect( this, SIGNAL( returnPressed() ), this, SLOT( addToLRU() ) );
}
Esempio n. 15
0
CCompleterLineEdit::CCompleterLineEdit(const QStringList& completions, QWidget *parent) :
	QLineEdit(parent)
{
	m_pCompleter = new QCompleter(completions, this);
	setCaseSensitivity(Qt::CaseInsensitive);
	setCompletionMode(QCompleter::UnfilteredPopupCompletion);
	setCompleter(m_pCompleter);
	m_bCompleteOnDoubleClick = true;
}
Esempio n. 16
0
void LineEdit::setHistoryEnabled(bool enabled)
{
    if (enabled == m_historyEnabled)
        return;
    m_historyEnabled = enabled;
    if (m_historyEnabled) {
        // queued so we learn and update the history list *after* the user selected an item from popup
        connect(this, SIGNAL(returnPressed()), this, SLOT(learnEntry()), Qt::QueuedConnection);
        QCompleter *completer = new QCompleter(QStringList(), this);
        completer->setCaseSensitivity(Qt::CaseInsensitive);
        completer->setCompletionMode(QCompleter::InlineCompletion);
        setCompleter(completer);
    } else {
        disconnect(this, SIGNAL(returnPressed()), this, SLOT(learnEntry()));
        delete completer();
        setCompleter(NULL);
    }
}
Esempio n. 17
0
MultiValuesLineEdit::MultiValuesLineEdit(QWidget *parent):
    QLineEdit(parent),
    mMultiState(MultiValuesEmpty),
    mCompleterModel(new QStringListModel(this))
{
    setCompleter(new QCompleter(this));
    completer()->setModel(mCompleterModel);
    completer()->setCaseSensitivity(Qt::CaseInsensitive);
    completer()->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
}
void TComboBoxModelRecord::setEditable ( bool editable )
{
    editable_=editable;
    QComboBox::setEditable(editable);
    setCompleter(0);
    setInsertPolicy( QComboBox::NoInsert );
    m=NULL;
    lstview = new QListView;
    lstview->installEventFilter( this );
    setView( lstview );
}
Esempio n. 19
0
QgsScaleComboBox::QgsScaleComboBox( QWidget* parent ) : QComboBox( parent ), mScale( 1.0 )
{
  updateScales();

  setEditable( true );
  setInsertPolicy( QComboBox::NoInsert );
  setCompleter( 0 );
  connect( this, SIGNAL( activated( const QString & ) ), this, SLOT( fixupScale() ) );
  connect( lineEdit(), SIGNAL( editingFinished() ), this, SLOT( fixupScale() ) );
  fixupScale();
}
Esempio n. 20
0
QgsScaleComboBox::QgsScaleComboBox( QWidget *parent )
  : QComboBox( parent )
{
  updateScales();

  setEditable( true );
  setInsertPolicy( QComboBox::NoInsert );
  setCompleter( nullptr );
  connect( this, static_cast<void ( QComboBox::* )( const QString & )>( &QComboBox::activated ), this, &QgsScaleComboBox::fixupScale );
  connect( lineEdit(), &QLineEdit::editingFinished, this, &QgsScaleComboBox::fixupScale );
  fixupScale();
}
Esempio n. 21
0
UrlNavigator::UrlNavigator(QAbstractItemModel *model, const QUrl &url,
                           QWidget *parent)
    : QLineEdit(parent)
    , m_model(model)
    , m_completer(new QCompleter(m_model, this))
    , m_historyIndex(0)
    , m_historyMax(30)
{
    setLocationUrl(url);
    setCompleter(m_completer);
    connect(this, SIGNAL(returnPressed()), this, SLOT(on_returnPressed()));
}
Esempio n. 22
0
RtfCssEditor::RtfCssEditor(QWidget *parent) : KTextEdit(parent), c(0),currentCompleter(DEFAULT),alternateCompleter(NULL) {
  QStringList wordList;
  QSqlQuery query22;
  query22.exec("SELECT TITLE FROM TCSS_TAG");
  
  while (query22.next())
    wordList <<  query22.value(0).toString();

  standardCompleter = new QCompleter(wordList, this);
  standardCompleter->setCaseSensitivity(Qt::CaseInsensitive);
  setCompleter(standardCompleter);
}
Esempio n. 23
0
Private::FileLineEdit::FileLineEdit(QWidget *parent)
    : QLineEdit {parent}
    , m_completerModel {new QFileSystemModel(this)}
    , m_completer {new QCompleter(this)}
    , m_browseAction {nullptr}
    , m_warningAction {nullptr}
{
    m_completerModel->setRootPath("");
    m_completerModel->setIconProvider(&m_iconProvider);
    m_completer->setModel(m_completerModel);
    m_completer->setCompletionMode(QCompleter::PopupCompletion);
    setCompleter(m_completer);
}
Esempio n. 24
0
KBicEdit::KBicEdit(QWidget* parent)
  : KLineEdit(parent)
{
  QCompleter* completer = new QCompleter(this);

  bicModel* model = new bicModel(this);
  completer->setModel(model);
  m_popupDelegate = new bicItemDelegate(this);
  completer->popup()->setItemDelegate(m_popupDelegate);

  setCompleter(completer);

  bicValidator *const validator = new bicValidator(this);
  setValidator(validator);
}
Esempio n. 25
0
WebSearchBar::WebSearchBar(BrowserWindow* window)
    : LineEdit(window)
    , m_window(window)
    , m_reloadingEngines(false)
{
    setObjectName("websearchbar");
    setDragEnabled(true);

    m_buttonSearch = new WebSearchBar_Button(this);

    m_boxSearchType = new ButtonWithMenu(this);
    m_boxSearchType->setObjectName("websearchbar-searchprovider-comobobox");
    // RTL Support
    // If we don't add 'm_boxSearchType' by following code, then we should use suitable padding-left value
    // but then, when typing RTL text the layout dynamically changed and within RTL layout direction
    // padding-left is equivalent to padding-right and vice versa, and because style sheet is
    // not changed dynamically this create padding problems.
    addWidget(m_boxSearchType, LineEdit::LeftSide);

    addWidget(m_buttonSearch, LineEdit::RightSide);

    connect(m_buttonSearch, SIGNAL(clicked(QPoint)), this, SLOT(search()));
    connect(m_buttonSearch, SIGNAL(middleClicked(QPoint)), this, SLOT(searchInNewTab()));
    connect(m_boxSearchType, SIGNAL(activeItemChanged(ButtonWithMenu::Item)), this, SLOT(searchChanged(ButtonWithMenu::Item)));

    setWidgetSpacing(0);

    m_searchManager = mApp->searchEnginesManager();
    connect(m_boxSearchType->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowMenu()));

    m_completer = new QCompleter(this);
    m_completer->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
    m_completerModel = new QStringListModel(this);
    m_completer->setModel(m_completerModel);
    m_completer->popup()->setMinimumHeight(90);
    setCompleter(m_completer);

    m_openSearchEngine = new OpenSearchEngine(this);
    m_openSearchEngine->setNetworkAccessManager(mApp->networkManager());
    connect(m_openSearchEngine, SIGNAL(suggestions(QStringList)), this, SLOT(addSuggestions(QStringList)));
    connect(this, SIGNAL(textEdited(QString)), m_openSearchEngine, SLOT(requestSuggestions(QString)));

    editAction(PasteAndGo)->setText(tr("Paste And &Search"));
    editAction(PasteAndGo)->setIcon(QIcon::fromTheme(QSL("edit-paste")));
    connect(editAction(PasteAndGo), SIGNAL(triggered()), this, SLOT(pasteAndGo()));

    QTimer::singleShot(0, this, SLOT(setupEngines()));
}
Esempio n. 26
0
QgsFieldValuesLineEdit::QgsFieldValuesLineEdit( QWidget *parent )
    : QgsFilterLineEdit( parent )
    , mLayer( nullptr )
    , mAttributeIndex( -1 )
    , mUpdateRequested( false )
    , mGatherer( nullptr )
{
  QCompleter* c = new QCompleter( this );
  c->setCaseSensitivity( Qt::CaseInsensitive );
  c->setFilterMode( Qt::MatchContains );
  setCompleter( c );
  connect( this, &QgsFieldValuesLineEdit::textEdited, this, &QgsFieldValuesLineEdit::requestCompleterUpdate );
  mShowPopupTimer.setSingleShot( true );
  mShowPopupTimer.setInterval( 100 );
  connect( &mShowPopupTimer, &QTimer::timeout, this, &QgsFieldValuesLineEdit::triggerCompleterUpdate );
}
Esempio n. 27
0
SearchComboBox::SearchComboBox(QWidget* parent) : QComboBox(parent) {
	setEditable(true);
	setCompleter(0);
	
	lineEdit()->setTextMargins(0, 0, StatusWidth, 0);
	statusL_ = new QLabel("", lineEdit());
	statusL_->setMaximumWidth(StatusWidth);
	statusL_->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
	
	QPalette plt = statusL_->palette();
	plt.setColor(QPalette::Text, plt.color(QPalette::Disabled, QPalette::Text));
	statusL_->setPalette(plt);
	
	QFont fnt = statusL_->font();
	fnt.setPointSize(fnt.pointSize() - 2);
	statusL_->setFont(fnt);
}
Esempio n. 28
0
void Minibuffer::set_completer(QCompleter *given_completer)
{
    custom_completer = given_completer;

    if (!custom_completer)
        return;

    custom_completer = given_completer;

    custom_completer->setCompletionMode(QCompleter::InlineCompletion);
    custom_completer->setCaseSensitivity(Qt::CaseInsensitive);
    custom_completer->setWrapAround(false);

    connect(this, SIGNAL(textChanged(QString)), this, SLOT(insert_completion(QString)));

    setCompleter(custom_completer);
}
Esempio n. 29
0
LineEdit::LineEdit( QWidget *parent) :
    QLineEdit(parent)
{
    completeFlag = true;

    completer = new QCompleter(QStringList(), this);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    completer->setWrapAround(false);
    connect(completer, SIGNAL(activated(QString)),
            this, SLOT(onCompleterActivated(QString)));

    connect(this, SIGNAL(textChanged(QString)),
            this, SLOT(onTextChanged()));

    setCompleter(completer);
    loadData();
}
Esempio n. 30
0
void HistoryLineEdit::setHistory(const QStringList& hist)
{
    myDebug() << hist;
    if(m_model != nullptr) {
        delete m_model;
        m_model = nullptr;
    }
    if(m_completer != nullptr) {
        delete m_completer;
        m_completer = nullptr;
    }
    m_model = new QStringListModel(hist);
    m_completer = new QCompleter(m_model, this);
    setCompleter(m_completer);
    //connect(m_completer, SIGNAL(activated(const QString&)), this, SLOT(insertCompletion(const QString&)));
    connect(this, SIGNAL(editingFinished()), this, SLOT(addToHistory()));
    
}