Re: [Interest] [QtGui] Clip cursor position
Hello Nye, Maybe you can use the QWidget::grabMouse() function for that. This in combination with an overlay widget (visible but fully transparent) over your application. Regards, Jan On 22-12-2015 10:44, Nye wrote: Hello, Is it possible to clip the mouse cursor to a specific area of the screen? I've tried to limit the cursor movement by installing an event filter on the application object and moving it back when its position got outside of my target rectangle, but the results proved to be unsatisfactory, as there is considerable "flicker". I then dig deeper and tried installing a window system event handler on QWindowSystemInterfacePrivate by subclassing the QWindowSystemEventHandler class available, reimplementing the sendEvent() function, and plugging that in the appropriate place, but (as expected) the behavior was only marginally better. I'm considering changing the QPlatformWindow and trying to do it directly from there (actually from QXcbWindow) but decided to ask first if there is actually a better way. Any input is highly appreciated. Kind regards. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] [QtGui] Clip cursor position
Hello Konstantin, I figured it would be possible to add an event filter to the overlay window to: a. restrict the mouse to the desired area b. dispatch other mouse event to widgets below. Won't be easy, but it seems not impossible. Regards, Jan On 22-12-2015 12:22, Nye wrote: Hello Jan, Thanks for the suggestion, but I'm not really convinced that this'd help, since installing an event filter on the application object is effectively doing the same thing as grabbing the mouse (at least while the mouse is over an application window). Additionally the "grabMouse" runs into the trouble that I'd have to manually dispatch the messages to their corresponding widgets and it doesn't really prevent the mouse from leaving an area (or widget/window), it just ensures that the particular widget will get all mouse events (whether or not they occur in its client area). In windows the API seems to allow the behavior I'm after (https://msdn.microsoft.com/en-us/library/windows/desktop/ms648383(v=vs.85).aspx <https://msdn.microsoft.com/en-us/library/windows/desktop/ms648383%28v=vs.85%29.aspx>) but I'm not sure if this is even possible for X11. Kind regards, Konstantin. On Tue, Dec 22, 2015 at 12:52 PM, Jan Dasselaar <j...@altus-escon.com <mailto:j...@altus-escon.com>> wrote: Hello Nye, Maybe you can use the QWidget::grabMouse() function for that. This in combination with an overlay widget (visible but fully transparent) over your application. Regards, Jan On 22-12-2015 10:44, Nye wrote: Hello, Is it possible to clip the mouse cursor to a specific area of the screen? I've tried to limit the cursor movement by installing an event filter on the application object and moving it back when its position got outside of my target rectangle, but the results proved to be unsatisfactory, as there is considerable "flicker". I then dig deeper and tried installing a window system event handler on QWindowSystemInterfacePrivate by subclassing the QWindowSystemEventHandler class available, reimplementing the sendEvent() function, and plugging that in the appropriate place, but (as expected) the behavior was only marginally better. I'm considering changing the QPlatformWindow and trying to do it directly from there (actually from QXcbWindow) but decided to ask first if there is actually a better way. Any input is highly appreciated. Kind regards. ___ Interest mailing list Interest@qt-project.org <mailto:Interest@qt-project.org> http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org <mailto:Interest@qt-project.org> http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog Qt5
On 16-12-2015 15:02, Duane wrote: On 16/12/2015 8:53 AM, Thiago Macieira wrote: On Wednesday 16 December 2015 08:10:44 Duane wrote: I'm subclassing a QFileDialog. I need to get a pointer to the filename box. I was doing this with findChild() with Qt4 but with Qt5 this returns null. Any suggestions? XY problem. Why do you need to get the pointer to the line edit? What are you trying to do? Not sure what you mean by XY problem. We're trying to do something like a "save as" where depending on the setup the user can enter a filename with the directory path. We block the context menu that allows creating new files etc. You can also use the setOptions(QFileDialog::ReadOnly) flag. When set the Rename, Delete and New Folder items in the context menu will be disabled. Jan Is there a way to get the user's entry when the file doesn't exist and the user clicks the ok button? ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] QFileDialog Qt5
On 16-12-2015 16:16, Duane wrote: On 16/12/2015 9:24 AM, André Somers wrote: Op 16/12/2015 om 15:02 schreef Duane: On 16/12/2015 8:53 AM, Thiago Macieira wrote: On Wednesday 16 December 2015 08:10:44 Duane wrote: I'm subclassing a QFileDialog. I need to get a pointer to the filename box. I was doing this with findChild() with Qt4 but with Qt5 this returns null. Any suggestions? XY problem. Why do you need to get the pointer to the line edit? What are you trying to do? Not sure what you mean by XY problem. http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem André :-) So my question should have been how can I get the filename that the user enters in the filedialog. ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest You can use the selectedFiles() function icm with filemode AnyFile. The full path including the entered file name will be returned. Jan ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
Re: [Interest] geometry() for a widget that hasn't been shown
Hello John, Maybe the QWidget::adjustSize() function is what you are looking for. I think after calling adjustSize() the geometry() function should give a up to date result. Hth, Jan On 21-9-2015 19:33, John Weeks wrote: > If this is a repeat, my apologies. I can't tell if I saw this arrive on the > list! > > > > In general a QWidget that hasn't been made visible yet gives bogus results > for QWidget::geometry(). Qt only guarantees that a call to setGeometry() will > result in a Resize event when the window is made visible. But we often need > to ask a window or child widget how big it is before it is made visible in > order to do various kinds of calculations. These calculations are sometimes > used for things that preclude waiting for the window to become visible. > > Is there a way to force the Resize events (and all the layout calculation > machinery that goes with it) before it is visible? Using Qt 5.5, I see that > if you call QWidget::grab(), it will call a static function > sendResizeEvents() that does exactly what I want: > > QPixmap QWidget::grab(const QRect ) > { > Q_D(QWidget); > if (testAttribute(Qt::WA_PendingResizeEvent) || > !testAttribute(Qt::WA_WState_Created)) > sendResizeEvents(this); > > Is there some other way to get this to happen? I suppose I could just call > grab() and throw away the QPixmap, but that seems like an awful kludge... > > -John Weeks > > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > ___ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest > ___ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest