Pass 0 as the parent argument to the constructor. It's usually the last argument and it defaults to 0, so you might just skip it.
Your code needs major changes, by the way... I see at least two incorrect approaches there.
Pass 0 as the parent argument to the constructor. It's usually the last argument and it defaults to 0, so you might just skip it.
Your code needs major changes, by the way... I see at least two incorrect approaches there.
I had also tried to pass zero in two different ways as below:
MyWidget ( int r, Qimage image QWidget *parent =0);
MyWidget( QWidget * parent=0, Qt::WindowFlags f=0 );
Further i tried alot to activate using Activate Window but failed to do so..
thanx for taking interest..
will you please tell me @ simple way to just activate that window as t\o have mouse events?
You don't need any special treatment to receive mouse events. A window is active when you click on it or call QApplication::setActiveWindow(). How come you know you don't receive events for the widget?
by printing mouse event position( which are not getting printed) as well as isActive Window boolian function ( which returns false)
Ok, let's start from the beginning - what is the final effect you are trying to obtain? Try to be as precise in explaining as you can, this will allow us to solve the problem faster. I see you are doing something with some image and you want to do rubberbanding but it's not clear for me how this blends together...
By the way - "not getting printed" doesn't yet mean "not getting executed"...
thanx. To begin with the objective is something like this:
i have prepared one GUI by Qt Designer, Clicking on one menu named "work1" of its menu bar, should open one another window, which contains scanned image of of a picture,say of 20 persons . On which i have drawn certain editable boxes around these individual person using QRubberband. I should be able to edit those rubberband boxes of that window.
Let me clarify more that without using GUI , i m able to show and edit those rubberbanded boxes using mouse.My program runs absolutely good without GUI linking.
But after linking it to GUI , some where some thing goes wrong, every thing works fine except that " this window falls behind the GUI window. So it is clear that there seems to be problem in linking, or calling or constructors or priority may be any thing like that.
Now i hope I have made to understand my objective and problem....!
So i tried to activate and bring front that window but I failed in that case only...
Regarding yr query of mouse events:
I have used following code to see if mouse events occur.
Perhaps today i have disturbed u alot.....! Thnx for guidance..Qt Code:
{ origin = event->pos(); cout<<"x event "<< event->x()<<"y event "<< event->y()<<endl;}To copy to clipboard, switch view to plain text mode
Last edited by jpn; 30th April 2008 at 07:31. Reason: missing [code] tags
Ok, seems simple enough...
Or overall code design and understanding of QtSo it is clear that there seems to be problem in linking, or calling or constructors or priority may be any thing like that.
Let's clearly state what we have. Do you actually have two windows? With separate title bars, etc.? Can you move them around on your screen?So i tried to activate and bring front that window but I failed in that case only...
This would be more convincing:Regarding yr query of mouse events:
I have used following code to see if mouse events occur.
void MyWidget::mousePressEvent(QMouseEvent *event)
{
origin = event->pos();
cout<<"x event "<< event->x()<<"y event "<< event->y()<<endl;}
Qt Code:
QMessageBox::information(this, "Click!", QString("Click occured at %1x%2").arg(event->pos().x()).arg(event->pos().y())); }To copy to clipboard, switch view to plain text mode
oh Thnx indeed ...
I have been able to cop up with the problem using QDialog and setModal
Again thank you very much
Ranjit
Bookmarks