You are not logged in.

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, January 9th 2012, 1:54pm

Creating completer like in browsers

Hello.
I need to create the completer like in browsers (most similar to Google Chrome completer). QCompleter is not suitable, because I need use the string of image (QPixmap?) (small icon) and 2 QString's, and I've not found any applying of QCompleter for that. I've tried to create my own widget, but it didn't work.
I don't demand for the whole solution, but any idea or any thought will help me.
Thank you.

Sorry, my English is not very good.

2

Tuesday, January 10th 2012, 12:23am

please explain more about 'string of image'
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

3

Tuesday, January 10th 2012, 7:42am

String of image and 2 qstrings: I mean a widget (a string) that consists of 1 image and 2 qstring's (in qhboxlayout)

4

Tuesday, January 10th 2012, 8:23am

string of image makes no sense. A widget cannot be a string, and a string cannot be a widget.

QString is not a widget and cannot be placed on a widget (window).

It sounds like you have a widget that contains an image (QPixmap) , and two QLineEdits. A completer can only work on one widget (QPixmap and QLineEdit are also widgets). If you want to use data from two QLineEdits for a completer, then you will need to add another QLineEdit. It doesn't make any sense to use an image for a completer.

I think some pictures might help, because what you are saying doesn't really make sense.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

5

Tuesday, January 10th 2012, 9:15am

great sorry. maybe i've expressed my problem wrong. i have the qlineedit. it has to have the completer. i can use the qcompleter, but it don't get me all the needed functionality. i have to add one icon (qpixmap) at the left of the every suggested element in the qcompleter, and add one qlabel at the right of this element. those qpixmap and qlabel aren't known at compilation, they defined from the completer elements

6

Tuesday, January 10th 2012, 9:29am

It looks like you can do that, but you may need to make a 'model' (http://developer.qt.nokia.com/doc/qt-4.8…tlistmodel.html) so that you can attach the model to the completer

http://developer.qt.nokia.com/doc/qt-4.8…er.html#details
you would need to assign the icon/pixmap to the qt:: DecorationRole in the model.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

7

Saturday, January 14th 2012, 3:45pm

Great thanks, I made it.