PDA

View Full Version : QToolBox and QMouseEvent



mickey
31st January 2006, 12:12
Hi,
I looking for a way to call myToolBox->show but I like toolBox appear out of windows application (beside on right side of my window app. So

___ _______
w| my
i | toolbox
d|
g|
e|
t |
----------------
Is it possible? (qt .3.2)
And is there a function that return true when mouse is on a side of window application?
Thanks

KjellKod
31st January 2006, 12:25
I understand your questions like this, pleas correct me if I'm wrong.

1) You have an application (Windows programme) and you want another window with a toolbox to be shown. This window should not be attached to the main window but should be shown on the right side?

2) You would like to get notified when the mouse cursor is not over your main programme or the toolbox window? Or do you want to get notified when the mouse cursor is over your main window, but on the edge of the window?

mickey
31st January 2006, 13:23
HI,

I want to know when mouse is on right border of window of my application (bit I see that when I on this appear resize cursor of mouse!!!). So I'd like this before appear resize cursor (a bit before)

I'd like toolBox attached my windows application: see file

KjellKod
31st January 2006, 18:55
OK, let's take the mouseevent first.

Sorry for asking more, but what are you trying to achieve? I just want to know what the goal of


I want to know when mouse is on right border of window of my application (bit I see that when I on this appear resize cursor of mouse!!!). So I'd like this before appear resize cursor (a bit before)

-- to be able to help you better. Do you want to do a specific action instead of re-size? Or are you trying to block re-size (just guessing)

mickey
31st January 2006, 21:25
I'm thinking this: when mouse is over right border of window application, appear a toolBox
in the way of my picture. With toolbox->hide and toolbox->show, toolbox appear but "inside" window. I'd like it outside......there is no reason for this. But Is it possible?
Thanks

KjellKod
1st February 2006, 12:35
I'm no Qt wizard (yet :) )
But as I see it you can do it in two ways.
1) Add a widget of some kind (a frame?) on your MainWindow. Make sure that the widget is positioned on the right border of the application and that it is hidden i.e. you can call MickeysWidget->hide() so that it is never shown.
-- Let that widget listen to MouseMovement and when you get some then you make
ToolBoxWindow->show()
-- When you get MouseMovement on other parts of the MainWindow then you can call ToolBoxWindow->hide()
-------------- problem w/ this method. I don't know if the MickeyWidget will listen all the times to MouseMovement events unless it is activated, but I think you can make it so.

2) Constantly check where your cursor is (MainWindow coordinates) . If it's in a specific part of your MainWindow then make toolbox->show()
// Not exactly sure how to do this.

To make the toolbox appear outside your application is no problem at all. Just have the Toolbox in another window.
I.e. your main.cc creates MainWindow and toolBoxWindow, and make logic for having the MainWindow to receive events which then has logic for hiding/showing the toolBoxWindow.

KjellKod
1st February 2006, 12:57
Mickey,
I see that you're using Qt3: Is this a help?
http://doc.trolltech.com/3.0/popup-example.html