PDA

View Full Version : How to replicate the Yosemite OSX search format for settings using QtableWidget



xtiwix
6th January 2016, 15:38
Hello All,

I would Like to implement something similar to the image below, But I have no idea how to create the effect of the spotlight on the particular item once the search function finds the right name.

11621


Here is what I have done so far:

I created a 6x8 QTableWidget, and inside this table widget I inserted arbitrary values (for convenience I entered the values from 1 to 49 in order). Then I stored those values in a QMap. The QMap was created such that my key will be the arbitrary values since thats what the user will eventually input in order to find it. For the values of the QMap I stored the location of the value (row,column).

Thus, the QMap<int,QPair<int,int>> search_parameter

Now, again what I would like to do is to put a QLineEdit, so that when the user inputs some arbitrary value (in this case any number from 1 to 49). In the table it reflects an effect as shown in the picture above. Or something similar.

Sorry for the poor explanation if you guys have any question don't be afraid to ask. Thanks in advance

anda_skoa
6th January 2016, 16:29
Hmm.

And idea would be to put another widget on to of the table widget and only show it when searching.
When it is shown, it fills its area with a semi transparent color and draws filled circles with fully transparent color at the "highlight" areas.

Cheers,
_

xtiwix
6th January 2016, 18:16
Hmm.

And idea would be to put another widget on to of the table widget and only show it when searching.
When it is shown, it fills its area with a semi transparent color and draws filled circles with fully transparent color at the "highlight" areas.

Cheers,
_

I grasp the idea conceptually, can you provide me with a quick simple example of how to do it. Because the moment I try to do that I loose focus on the QtableWidget. Since I want to highlight it, and yet still be able to use the others widget inside the cell.

Thanks!

anda_skoa
6th January 2016, 18:40
You probably have to play with the focus policy of the cover widget, e.g. set it to NoFocus.

Cheers,
_