Difference between revisions of "Developer Meetings/20120710"

From Slicer Wiki
Jump to: navigation, search
m (Created page with 'Attendees: == To discuss == == Conclusion ==')
 
Line 2: Line 2:
  
 
== To discuss ==
 
== To discuss ==
 +
* Issue [http://www.na-mic.org/Bug/view.php?id=1772 1772]: adding key modifier to qSliceControllerWidget
 +
** the existing linking behavior is very disrupting for some usage workflows
 +
** git branch: https://github.com/fedorov/Slicer/tree/link-modifier
 +
** related issue reported by Jim:
  
 +
<pre>
 +
---------- Forwarded message ----------
 +
From: Julien Finet <julien.finet@kitware.com>
 +
Date: Sun, Jan 29, 2012 at 10:30 PM
 +
Subject: Re: qLineEdit in a ctkPopupWidget
 +
To: Jim Miller <millerjv@gmail.com>
 +
Cc: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
 +
 +
 +
Hi Jim,
 +
It seems that it's not possible. I spent some try to debug and my observations are:
 +
- to get focus on click, QLineEdit must be in a window that is active. For some reasons, ctkPopupWidget is not a window but it belongs to the window of the base widget. I changed the code to make it an active window, but a 2nd problem appears.
 +
- once the ctkPopupWidget is an activeWindow, QLineEdit still doesn't receive key events, only the base widget receives them. I've no idea why, but it might be because ctkPopupWidget is considered as a Qt::ToolTip type and not a regular type. :-/
 +
 +
The only work around I found is to make the QLineEdit into a popup inside the popup.
 +
  ctkPopupWidget popupWidget(baseWidget);
 +
  ...
 +
  layout->addWidget(&button);
 +
  popup.setLayout(layout);
 +
 +
  QMenu* menu = new QMenu;
 +
  QWidgetAction* lineEditAction = new QWidgetAction(menu);
 +
  lineEditAction->setDefaultWidget(new QLineEdit);
 +
  menu->addAction(lineEditAction);
 +
  button.setMenu(menu);
 +
 +
But then I face some always-on-top issues. I'm not sure there is an easy fix :-/ I wonder, maybe ctkPopupWidget should be a Qt::Popup (or Qt::Tool) instead of a Qt::ToolTip...
 +
 +
Julien.
 +
 +
On Sun, Jan 29, 2012 at 5:03 PM, Jim Miller <millerjv@gmail.com> wrote:
 +
Julien, JC,
 +
 +
I am trying to use a qLineEdit widget inside a ctkPopupWidget.  I can set the text for the QLineEdit fine.  I can pull up the context menu and paste text into the QLineEdit fine. But I cannot type any text. It is like the LineEdit never gets the focus.  I click in the entry area but not cursor appears.  It looks like the widget is enabled.
 +
 +
Is there something special in the ctkPopupWidget that would prevent widgets like the LineEdit widget?
 +
 +
Looking at the code, there appears to be code managing "something" on mouse over.
 +
 +
Jim
 +
</pre>
 
== Conclusion ==
 
== Conclusion ==

Revision as of 20:31, 3 July 2012

Home < Developer Meetings < 20120710

Attendees:

To discuss

---------- Forwarded message ----------
From: Julien Finet <julien.finet@kitware.com>
Date: Sun, Jan 29, 2012 at 10:30 PM
Subject: Re: qLineEdit in a ctkPopupWidget
To: Jim Miller <millerjv@gmail.com>
Cc: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>


Hi Jim,
It seems that it's not possible. I spent some try to debug and my observations are:
 - to get focus on click, QLineEdit must be in a window that is active. For some reasons, ctkPopupWidget is not a window but it belongs to the window of the base widget. I changed the code to make it an active window, but a 2nd problem appears. 
 - once the ctkPopupWidget is an activeWindow, QLineEdit still doesn't receive key events, only the base widget receives them. I've no idea why, but it might be because ctkPopupWidget is considered as a Qt::ToolTip type and not a regular type. :-/
 
The only work around I found is to make the QLineEdit into a popup inside the popup.
  ctkPopupWidget popupWidget(baseWidget);
  ...
  layout->addWidget(&button);
  popup.setLayout(layout);

  QMenu* menu = new QMenu;
  QWidgetAction* lineEditAction = new QWidgetAction(menu);
  lineEditAction->setDefaultWidget(new QLineEdit);
  menu->addAction(lineEditAction);
  button.setMenu(menu);

But then I face some always-on-top issues. I'm not sure there is an easy fix :-/ I wonder, maybe ctkPopupWidget should be a Qt::Popup (or Qt::Tool) instead of a Qt::ToolTip...

Julien.

On Sun, Jan 29, 2012 at 5:03 PM, Jim Miller <millerjv@gmail.com> wrote:
Julien, JC,

I am trying to use a qLineEdit widget inside a ctkPopupWidget.  I can set the text for the QLineEdit fine.  I can pull up the context menu and paste text into the QLineEdit fine. But I cannot type any text. It is like the LineEdit never gets the focus.  I click in the entry area but not cursor appears.  It looks like the widget is enabled.

Is there something special in the ctkPopupWidget that would prevent widgets like the LineEdit widget?

Looking at the code, there appears to be code managing "something" on mouse over.

Jim

Conclusion