QFileSystemModel is not working on Linux with QCompleter for ~username/....
-
I have used QFileSystemModel for QCompleter. On windows it works fine but on linux when I type ~gyeole/ it does not popup for auto completion. But if I type "/" then it pops up. Any suggestion to access directory with ~gyeole/....
-
Hi,
Can you share the code you are using for initialising Completer and the rest so it can be tested ?
-
QFileSystemModel *fModel = new QFileSystemModel();
fModel->setRootPath("");
m_dirCompleter->setModel(fModel);
m_dirCompleter->setCompletionMode(QCompleter::PopupCompletion);
QObject::connect(m_dirCompleter, SIGNAL(activated(QString)),
this, SLOT(insertCompletion(QString)));//m_dirCompleter is QCompleter
//In QTextEdit in keyPressEvent captuaring edited text for poping up auto completion
//getCompleter () returns m_dirCompleter
getCompleter()->setCompletionPrefix(str1);
getCompleter()->popup()->setCurrentIndex(getCompleter()->completionModel()->index(0, 0));
cr = cursorRect();
cr.setWidth(getCompleter()->popup()->sizeHintForColumn(0)
+ getCompleter()->popup()->verticalScrollBar()->sizeHint().width());
getCompleter()->complete(cr);
popupVisible = true;void CxConsoleQt::insertCompletion(const QString& string)
{
std::string str = qPrintable(string);
int extra = string.length() - getCompleter()->completionPrefix().length();
m_inputCursor.insertText(string.right(extra));
this->setTextCursor(m_inputCursor);
m_editableLength += extra;
} -
@Gitesh-Yeole
Can you please use code tags as it makes it more readable? -
Note that the tilde handling in bash has nothing do to with path handling within a library, some will do the expansion for you under the hood but that's not something you should rely on for auto completion like that.