Thanks SGaist for replay.
I took the example itself from Qt : examples\activeqt\menus\main.cpp, menus.cpp
I updated menus.cpp and added following code:
QMenus::QMenus(QWidget *parent)
: QMainWindow(parent, 0)
{
QAction *action;
QMenu *file = new QMenu(this);
file->setTearOffEnabled(true); //<= MY CHANGE
action = new QAction(QPixmap((const char**)fileopen), "&Open", this);
action->setShortcut(tr("CTRL+O"));
connect(action, SIGNAL(triggered()), this, SLOT(fileOpen()));
file->addAction(action);
action = new QAction(QPixmap((const char**)filesave),"&Save", this);
action->setShortcut(tr("CTRL+S"));
connect(action, SIGNAL(triggered()), this, SLOT(fileSave()));
file->addAction(action);
//<= MY CHANGE
file->addSeparator(); //<= MY CHANGE
QWidgetAction* waction1 = new QWidgetAction(this); //<= MY CHANGE
QLabel* label = new QLabel("My Data"); //<= MY CHANGE
label->setAlignment(Qt::AlignHCenter); //<= MY CHANGE
waction1->setDefaultWidget(label); //<= MY CHANGE
file->addAction(waction1); //<= MY CHANGE
//<= MY CHANGE
QWidgetAction* waction2 = new QWidgetAction(this); //<= MY CHANGE
QCheckBox* chk = new QCheckBox("Personal Data"); //<= MY CHANGE
waction2->setDefaultWidget(chk); //<= MY CHANGE
file->addAction(waction2); //<= MY CHANGE
So, after tearoff, Label and checkbox are missing/hidden. Further I found following defect which looks to be not addressed yet.
https://bugreports.qt.io/browse/QTBUG-1017
I tried 4.8.6 and 5.5. Is there any way out for this?