Workspace 6.21.5
Removing file menu options from a Simple Workspace Application

Introduction

In this tutorial we will learn how to remove menu options from the file menu. We focus on the "Inspect Workflow" option. "Inspect Workflow" and "Execution Profiling" provide exellent support to help debug the workflow during development. However, you may not want to include these menu options in your final product.

Prerequisites

To understand this tutorial, you should have completed:

Contents


Sample files used in this tutorial


Removing the "Inspect Workflow" menu option

Run the application you created in Creating a standalone application. Click on the File menu. You should see an option "Inspect Workflow":

Inspect Workflow in the File menu

The Creating a standalone application code generation wizard would have inserted the above option in the UI file and generated the corrsponding code. We will need to find and remove this option in the UI file and also remove (or comment out) the corresponding code.

Searching for "action_Inspect_Workflow" in the code

If on a Windows machine, you can launch Visual Studio from the Workspace Editor:

Launching Visual Studio

In Visual Studio, go to Edit -> Find and Replace -> Find in Files:

Find in Files

Search for: action_Inspect_Workflow. Look in your simple application folder, search for all types of files (*.*) and click on"Find All":

Find: action_Inspect_Workflow

The results should resemble:

Results for Find All: action_Inspect_Workflow

You can see that the Creating a standalone application code generation wizard has inserted changes into the UI, CPP and header files. We will need to manually remove this.

Removing the menu option in the UI

  • Launch the Workspace Editor
  • From the Workspace Editor, launch Qt Designer by clicking on Development -> Qt Designer:
Launch Qt Designer
  • Open the application's UI file: mainwindow.ui in this example:
Open UI file
  • In the mainwindow.ui file, click on the File menu. Then right-click on "Inspect Workflow". Select and click on "Remove action 'action_Inspect_Workflow'"
Remove action
  • You will be left with an extra separator. Remove this by right-clicking on the separator and then select and click "Remove separator".
Remove separator
  • Save the changes and quit Qt Designer.

Removing the code related to the menu option in the CPP file

In the CPP file - mainwindow.cpp, find and delete:

WS_VERIFY_RUNTIME(ui_->action_Inspect_Workflow);
#define WS_VERIFY_RUNTIME(cond)
Definition: errorchecks.h:227

and

void MainWindow::on_action_Inspect_Workflow_triggered()
{
auto editor = new CSIRO::Presentation::WorkspaceEditorWidget(*opRunner_->getWorkspace(), this);
editor->show();
}
Definition: workspaceeditordialog.h:50

Save your changes.

Removing the code related to the menu option in the header file

In the header file - mainwindow.h, find and delete:

void on_action_Inspect_Workflow_triggered();

Save your changes.

Rebuild the application

Build/Rebuild your application to see the changes:

Rebuild application

Run the application again. Click on the File menu and you should see that the "Inspect Workflow" option has disappeared.

Inspect Workflow removed

Follow the same steps to remove the "Execution Profiling" option. You will need to search for "action_Execution_Profiling" in this case.


Summary of important points

This tutorial has introduced you to removing menu options if you decide to deliver your application without debugging options built in.