Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Development: Runtime Error with QAction in OMEdit

Development: Runtime Error with QAction in OMEdit

Hi!

I want to implement a new feature, that will show/hide annotations in text mode.
For this I wanted to add a toggle button next to mpConnectModeAction.

So I added in MainWindow.h line 241:

Code:

  QAction *mpAnnotationVisibleAction;

and in MainWindow.cpp line 1819:

Code:

  mpAnnotationVisibleAction = new QAction(QIcon(":/Resources/icons/connect-mode.png"), tr("Show/hide annotations"), mpShapesActionGroup);

  connect(mpAnnotationVisibleAction, SIGNAL(triggered()), SLOT(toggleShapesButton()));

(For this first test the icon is the same one).

and in MainWindow.cpp line 2098:

Code:

  mpShapesToolBar->addAction(mpAnnotationVisibleAction);

OMEdit compiles fine in my Eclipse environment, but I receive an runtime error at startup (splash screen)!

In a second step, I also implemented the function

Code:

QAction* MainWindow::getAnnotationVisibleAction()

{
  return mpAnnotationVisibleAction;
}

...with the same result (runtime error at OMEdit startup)

I really have no idea, what is going on there!
Do you have an idea? - Thank you very much!

And Merry Christmas!!!

Best Regards
Jan

Re: Development: Runtime Error with QAction in OMEdit

The crash is because of MainWindow.cpp line 1441,

Code:

GraphicsView *pGraphicsView = mpModelWidgetContainer->getCurrentModelWidget()->getDiagramGraphicsView();

OMEdit preserves the user customizations & you have connect mode enabled so when OMEdit starts it triggers the toggleShapesButton SLOT.
Since there is no ModelWidget available so,

Code:

mpModelWidgetContainer->getCurrentModelWidget();

returns 0. You should check it before asking for the DiagramGraphicsView instance.

BTW, why do you want to make show/hide annotations part of toggle Shapes? It should be an option in the Options Dialog not in the toolbar.

Adeel.

Re: Development: Runtime Error with QAction in OMEdit

Hi Adeel,

thank you for your quick response. Cause this thing really bugs me...

Sadly your suggested fix isn't working.
I tried it with:

Code:

  if (mpModelWidgetContainer->getCurrentModelWidget()==0)

    return; // OMEdit is starting up

an even commented out the whole "cancel connection if another tool is chosen"-block.
...with no success at all.

I mean if I would know at which code line OMEdit crashes exactly, I could debug it by myself.
But I just run the OMEdit.exe and receive a Windows message, that the programm isn't working any longer.

Is there a possibility to setup the Eclipse debugger for OMEdit?
Right now, the green "Run As..." button and the debug button is not working.

The intension was to have this "show/hide annotations" feature very quickly available.
In the shaps toolbar it might be the wrong place, but I would prefere to place it in a toolbar in general.

Best Regards
Jan

Re: Development: Runtime Error with QAction in OMEdit

You can configure it in Eclipse but you need to install CDT with mingw tool chain. MDT doesn't provide such features.

Why don't you use Qt Creator for debugging?

Do a make clean and use GDB to find out the exact location of the bug.

Adeel.

There are 0 guests and 0 other users also viewing this topic
You are here: