[SOLVED] Determining coordinates for Custom Completer
-
Hi,
I´m trying to develop my own completer using QListView.
In order get it positioned near my combobox I tryed to get it´s coordinates through geometry() function.
This combobox is inside a QGridLayout.
The function geometry is retrieving "0" as the position of the combobox, which isn´t true.
Does anyone know how to get this information?
Thanks.
-
can you give us a sample screenshot of your gui?
AFAIK, geometry returns QRect containing x,y,height,width. which is i think always correct (unless you show us an image)
There are other convenient functions that you can use:
pos();
x();
y();
height();
width();The output of these functions can verify the output of your geometry().
-
Hi,
Problem solved...
It seems that if you call these functions before show() these values aren´t defined yet.
I just moved this code out from the constructor and it works!
Thanks!
-
You should retrieve the combobox position every time the completer shall pop up and update the list view's coordinates accordingly. Taking and setting the position once in the combobox or mainwindow show() isn't enough. The combobox might change its position (think of rearranging, resizing,...)