Qt-interest Archive, March 2007
Problem with QCompleter
Message 1 in thread
Hi list,
i have a problem using QCompleter in my subclass of QTextEdit. In the
following code cout prints what is expected, but i don't see any popup
appear.
if (completionPrefix != _completer->completionPrefix()) {
_completer->setCompletionPrefix(completionPrefix);
_completer->popup()->setCurrentIndex(_completer->completionModel()->index(0,
0));
cout << "KeyPressEvent: " <<
_completer->completionModel()->index(0,
0).data().toString().toStdString() << endl;
}
QRect cr = cursorRect();
cr.setWidth(_completer->popup()->sizeHintForColumn(0)
+
_completer->popup()->verticalScrollBar()->sizeHint().width());
QCompleter::completionMode is set to popup of course.
Is there something i am missing?
Thanks!
Christian Rengstl M.A.
Klinik und Poliklinik fÃr Innere Medizin II
Kardiologie - Forschung
UniversitÃtsklinikum Regensburg
B3 1.388
Franz-Josef-Strauss-Allee 11
93053 Regensburg
Tel.: +49-941-944-7230
--
[ signature omitted ]
Message 2 in thread
Christian Rengstl wrote:
> Hi list,
>
> i have a problem using QCompleter in my subclass of QTextEdit. In the
> following code cout prints what is expected, but i don't see any popup
> appear.
>
> if (completionPrefix != _completer->completionPrefix()) {
> _completer->setCompletionPrefix(completionPrefix);
> _completer->popup()->setCurrentIndex(_completer->completionModel()->index(0,
> 0));
> cout << "KeyPressEvent: " <<
> _completer->completionModel()->index(0,
> 0).data().toString().toStdString() << endl;
> }
> QRect cr = cursorRect();
> cr.setWidth(_completer->popup()->sizeHintForColumn(0)
> +
> _completer->popup()->verticalScrollBar()->sizeHint().width());
>
> QCompleter::completionMode is set to popup of course.
> Is there something i am missing?
Yes, you doesn't popup...
Have a look at: http://doc.trolltech.com/4.2/tools-customcompleter.html
> Christian Rengstl M.A.
> Klinik und Poliklinik fÃr Innere Medizin II
> Kardiologie - Forschung
> UniversitÃtsklinikum Regensburg
> B3 1.388
> Franz-Josef-Strauss-Allee 11
> 93053 Regensburg
> Tel.: +49-941-944-7230
Gibts das auch in kurz?
Stefan
--
[ signature omitted ]