Marat Gareev
Marat Gareev

Reputation: 427

QWidget over another widget

I have graphs (QCustomPlot) that are arranged vertically with a separator (QSplitter).

How can I get the window as in the picture when I click on the right button? I know how to handle the right button signal, but I can not understand how to display the window I need.

enter image description here

Upvotes: 0

Views: 479

Answers (1)

Michael
Michael

Reputation: 5335

Add a QMenu as a member of your widget. In .h:

#include <QMenu>
#include <QAction>
.....
QMenu menu;

In constructor:

QAction* action=new QAction("save",this);
connect(action,SIGNAL(triggered()),this,SLOT(save()));
menu.addAction(action);
QAction* action2=new QAction("clear",this);
connect(action2,SIGNAL(triggered()),this,SLOT(clear()));
menu.addAction(action2);
setContextMenu(&menu);

Upvotes: 1

Related Questions