[Qt-interest] program crashes when right mouse button clicked on the gui
hakiim the dream
hakiim35 at hotmail.com
Thu Jun 3 10:39:42 CEST 2010
thank you. I noticed that it was because of an unhandled contextMenuEvent.And thanks for the extra debugging tips.
> Date: Wed, 2 Jun 2010 09:02:24 +0100
> Subject: Re: [Qt-interest] program crashes when right mouse button clicked on the gui
> From: msclrhd at googlemail.com
> To: hakiim35 at hotmail.com
> CC: qt-interest at trolltech.com
>
> 2010/6/2 hakiim the dream <hakiim35 at hotmail.com>:
> > Hi, I am developing a desktop application which is an image
> > processing/editing app similar to the GIMP or PaintDotNet.
> > The problem is, whenever I click the right mouse button on the gui, the
> > program enters into the "qscopedpointer.h" and
> > throws an exception on the "inline T *data() const" function.
> > I can't even debug the problem since it crashes whereever you right-click on
> > the gui.
>
> You can debug the program. What compiler/development platform are you using?
>
> If you are using gcc, you can use gdb to help debug the application
> (or possibly some other debuggers as well). I am not familiar enough
> with gdb to help you out. Google may help here.
>
> If you are using Visual Studio, simply:
> 1/ be sure to turn on trapping for all exceptions in the Debug >
> Exceptions menu (including the check box for break on throw);
> 2/ run the application from Visual Studio in debug mode;
> 3/ press the right mouse button on the application (or whatever
> will trigger the crash)
>
> You will now be able to analyse the crash.
> a/ If you look at the call stack (one of the Debug > Window items),
> you can navigate back through the call chain to see where the error is
> occurring;
> b/ If you hover over a variable in the source window, you can see
> the value of that variable.
>
> > The gui contains distinct widgets such as QGraphicsView, QListWidget,
> > QPushButton, etc.
> > Should I implement a right-click handler for each of the widgets? It doesn't
> > make sense to me..
> > What would you suggest?
>
> It seems to me like you have a context menu that is invalid -- context
> menus get invoked on right-click by Qt.
>
> Do you have a contextMenuEvent handler? If so, does it look something like this:
>
> class MyEditor : public QTextEdit
> {
> public:
>
> MyEditor()
> {
> m_menu = new QMenu(this);
> }
>
> void contextMenuEvent(QContextMenuEvent *event)
> {
> m_menu->exec(event->globalPos());
> }
>
> private:
>
> QMenu * m_menu;
> };
>
> - Reece
_________________________________________________________________
Windows Live Hotmail: Arkadaşlarınız Facebook'taki güncellemelerinizi doğrudan Hotmail®'den alır.
http://www.microsoft.com/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:tr-tr:SI_SB_4:092009
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100603/a2dcc73f/attachment.html
More information about the Qt-interest-old
mailing list