PDA

View Full Version : Cursor is not showing



joseph
18th December 2006, 15:34
Hai guys,

My problem is related with the focuz of cursor ( or say default focuz ).

What happens that , I have a MainWindow in my application containing the following....

1. One Qcanvas ( in center )
2 . One or Dock windows containing tool_box ( in sides )
3 one Tabed widget in bottom

----- Just like VC++ / KDevelp Editors.

4. No : of menues also....



Cenario :

My MainWindow having any of dialogs opened , say foucus is now in one of the QLineEditBox ( cursor is now blinking in a QLineEditBox ) in that dialog.

Now i will minimize MainWindow ( using window_key + D ) keeping the focus like that.
But after restoring( maximizing ) the MainWindow , i willnot see the blinking_cursor( which was shown , just before ) in QLineEdit .:crying:

If i am pressing the Tab_Button the foucuz is jumping to the next tab_order widget in the Dialog.

:


Can you identify what will be the reason for this hiden focuz .
Please help me if u can...:(

Thanks in advance.

wysota
18th December 2006, 18:33
Can you provide a minimal compilable example reproducing the problem?

joseph
20th December 2006, 08:44
version : Qt 3.3.4
Platform : windows Xp professional
Created : In Designer
Compiled : In DOS prompt

Here is the minimal compilable example attached here. ( developed using designer , complied in dos promot using qmake & nmake )
In this example you can see the following

1. MainWindow having a Menus ( file ,edit , help ...etc ).
NB: set the QMainWindow ->setFoucusPolicy( QWidget::NoFocus )

2. In File_menu you can see one item ( JustTestingDlg )
3. If you click on JustTestingDlg, you will see a QDialog with some widgets. ( linedit, buttons..etc )

First senario( Working ) :
1. Run the application
2. Then MainWindow comes
3. Then click on JustTestingDlg( Menu_Item in MainWindow )
4. Now you will see a QDialog with 2 lineEditbox, 3 pushbuttons....etc
5. place the cursor in first QLineEditBox ( say Name ).
6. Minimise the application using window_key + D. now the applicaiotn will be minimized, you can see only your desktop.
7. Now Restore/maximise the applicaiton, check where is the cursor now......??????
8. Now the cursor is in the same position( in Name lineEditBox ) where we left the cursor before minimize the applicaiton.

ie; this cenario is working properly as we set the propery of focuspolicy = NoFocus.

Second senario( Problem ) :
1. change the QMainwindow's property setFoucusPolicy( QWidget::StrongFocus ).
2. Now run the same applicaiton.
3 Take the QDialog by clicking in JustTestingDlg ( Menu Item).
4. place the cursor in first QLineEditBox ( say Name ).
5. Minimise the applicaiton using the window_key + D. now the applicaiotn will be minimized, you can see only your desktop.
6. Now Restore/maximise the applicaiton, check where is the cursor now......??????
7. Now the cursor is not showing any where in QLineEditBox ( Name ). But if you pressing the tab_button, then the focus will be jump to the widget which is next to QLineEditBox( Name ).

Note that if i am changing this setFouspolicy( QWidget::NoFocus ) in my real application ( what i have mentioned in previous thread ), then also it's not grabing the focus back to the QDialogs after restoring/maximising.
please tell me why this fous is working differently just because of this focuspolicy.
Please help me...!!!!

Thanks in advance

wysota
20th December 2006, 11:07
Under Linux it works correctly - the line edit still has focus after restoring the window. Maybe someone can verify your problem under Windows.

joseph
20th December 2006, 11:22
Did you try both case


1. setFocusPolicy( NoFocus )
2. setFocusPolicy( StrongFocus )

In both cases is it working properly....??

wysota
20th December 2006, 11:25
Yes, the behaviour was the same in both cases.

joseph
20th December 2006, 11:32
But i have tried this property in windows



setFocusPolicy( NoFocus ) // Now works properly ie; it grabs the focus after restoring
setFocusPolicy( StrongFocus ) // Not grabing the focus to Dialog , after restoring.


Is there any solution....???

please help me:confused:

wysota
20th December 2006, 12:03
Do you need that StrongFocus? Have you tried using a focus proxy?

sunil.thaha
20th December 2006, 13:15
Since you have a commercial version, You should ask the trolls

joseph
20th December 2006, 13:24
Is there anybody who can test my sample code in windows and give me reply...??:o

jacek
20th December 2006, 15:43
Please, use [code] tags instead of [html].