Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, May 2008
List View qt 3.3 question


Message 1 in thread

Hi Folks,

 

I am creating a dialog that displays among other things a list view,
where a user can create a new item and enter its text but cannot
rename/modify an existing item. 

 

How can I get the key press event of the rename box, i.e. for example if
the user clicks the < new item > button and I create a new entry which
has a default value and do a start rename on that item, how I can get
the keys which the user types into that line edit? I am asking this to
bound check the length of the string the user can enter and also do
other validation stuff.

 

I see that the keyPressEvent of the listView does not handle these
events. Is there any other way for me to statically set my preference
using ListViewItem class??

 

Thanks,

Subramanian


Message 2 in thread

There are special event handlers on views in 3.3 that start with contents... So you want contentsMousePressEvent(..).  These methods are all inherited from QScrollView

--Justin
Sent from my BlackBerry® wireless device

-----Original Message-----
From: "Subramanian Ganapathy" <sganapat@xxxxxxxxx>

Date: Thu, 15 May 2008 16:03:07 
To:<qt-interest@xxxxxxxxxxxxx>
Subject: List View qt 3.3 question


Hi Folks, 
  
I am creating a dialog that displays among other things a list view, where a user can create a new item and enter its text but cannot rename/modify an existing item. 
  
How can I get the key press event of the rename box, i.e. for example if the user clicks the < new item > button and I create a new entry which has a default value and do a start rename on that item, how I can get the keys which the user types into that line edit? I am asking this to bound check the length of the string the user can enter and also do other validation stuff. 
  
I see that the keyPressEvent of the listView does not handle these events. Is there any other way for me to statically set my preference using ListViewItem class?? 
  
Thanks, 
Subramanian N‹§²æìr¸›zǧu©šŠ[hªØ§µêÞ²Úު笶Úè–[^r(›­†éì¹»®&ÞŠ{azË›?ç-¢»ayºȸ¬µªÜ†+Þjwb?ú+™«b¢xm¶Ÿÿ–+-²Úè–[^r(›ú­Š{^­ë-

Message 3 in thread

Hi Justin,

Thanks, for ur reply. But don't I need contentsKeyPressEvent?? Because while renaming a ListViewItem , the user would be typing in right?

I figured a worst hack which am not sure will work, QListView::startRename installs QListView object as an eventFilter to the line edit, I am thinking of reimplementing eventFilter and filtering out the dubious key presses by returning true and also key presses that exceed my proposed length.

I figure that contentsDoubleClick is meant to be the right event cos double click set up rename , but I implement a simple view where a user on pressing new item creates a default entry new item, with startRename on that and I do not allow renames of existing items.

What do you think about this? 

With Best Regards,
Subramanian

-----Original Message-----
From: Justin Noel [mailto:justin@xxxxxxx] 
Sent: Thursday, May 15, 2008 6:03 PM
To: Subramanian Ganapathy; qt-interest@xxxxxxxxxxxxx
Subject: Re: List View qt 3.3 question

There are special event handlers on views in 3.3 that start with contents... So you want contentsMousePressEvent(..).  These methods are all inherited from QScrollView

--Justin
Sent from my BlackBerry® wireless device

-----Original Message-----
From: "Subramanian Ganapathy" <sganapat@xxxxxxxxx>

Date: Thu, 15 May 2008 16:03:07 
To:<qt-interest@xxxxxxxxxxxxx>
Subject: List View qt 3.3 question


Hi Folks, 
  
I am creating a dialog that displays among other things a list view, where a user can create a new item and enter its text but cannot rename/modify an existing item. 
  
How can I get the key press event of the rename box, i.e. for example if the user clicks the < new item > button and I create a new entry which has a default value and do a start rename on that item, how I can get the keys which the user types into that line edit? I am asking this to bound check the length of the string the user can enter and also do other validation stuff. 
  
I see that the keyPressEvent of the listView does not handle these events. Is there any other way for me to statically set my preference using ListViewItem class?? 
  
Thanks, 
Subramanian 

--
 [ signature omitted ] 

Message 4 in thread

Hi Justin,

Just checked the hack worked :)

-----Original Message-----
From: Subramanian Ganapathy [mailto:sganapat@xxxxxxxxx] 
Sent: Thursday, May 15, 2008 6:17 PM
To: justin@xxxxxxx; qt-interest@xxxxxxxxxxxxx
Subject: RE: List View qt 3.3 question

Hi Justin,

Thanks, for ur reply. But don't I need contentsKeyPressEvent?? Because while renaming a ListViewItem , the user would be typing in right?

I figured a worst hack which am not sure will work, QListView::startRename installs QListView object as an eventFilter to the line edit, I am thinking of reimplementing eventFilter and filtering out the dubious key presses by returning true and also key presses that exceed my proposed length.

I figure that contentsDoubleClick is meant to be the right event cos double click set up rename , but I implement a simple view where a user on pressing new item creates a default entry new item, with startRename on that and I do not allow renames of existing items.

What do you think about this? 

With Best Regards,
Subramanian

-----Original Message-----
From: Justin Noel [mailto:justin@xxxxxxx] 
Sent: Thursday, May 15, 2008 6:03 PM
To: Subramanian Ganapathy; qt-interest@xxxxxxxxxxxxx
Subject: Re: List View qt 3.3 question

There are special event handlers on views in 3.3 that start with contents... So you want contentsMousePressEvent(..).  These methods are all inherited from QScrollView

--Justin
Sent from my BlackBerry® wireless device

-----Original Message-----
From: "Subramanian Ganapathy" <sganapat@xxxxxxxxx>

Date: Thu, 15 May 2008 16:03:07 
To:<qt-interest@xxxxxxxxxxxxx>
Subject: List View qt 3.3 question


Hi Folks, 
  
I am creating a dialog that displays among other things a list view, where a user can create a new item and enter its text but cannot rename/modify an existing item. 
  
How can I get the key press event of the rename box, i.e. for example if the user clicks the < new item > button and I create a new entry which has a default value and do a start rename on that item, how I can get the keys which the user types into that line edit? I am asking this to bound check the length of the string the user can enter and also do other validation stuff. 
  
I see that the keyPressEvent of the listView does not handle these events. Is there any other way for me to statically set my preference using ListViewItem class?? 
  
Thanks, 
Subramanian 

--
 [ signature omitted ]