[Qt-interest] rarely seen? >>QWidget::insertAction: Attempt toinsert null action

Scott Aron Bloom Scott.Bloom at sabgroup.com
Sun Jan 11 21:06:34 CET 2009


Why not try using a debugger, put a breakpoint on the qDebug call inside
QWidget::insertAction, and see whats going wrong...

 

Scott

 

________________________________

From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of S. Aguinaga
Sent: Sunday, January 11, 2009 11:09 AM
To: Qt-interest at trolltech.com
Subject: [Qt-interest] rarely seen? >>QWidget::insertAction: Attempt
toinsert null action

 

I'm trying to add either a Menu or a Tool Bar and I keep getting the
error or segmentation fault (SF):
"QWidget::insertAction: Attempt to insert null action"
Now, sometimes I can  get an empty toolbar ( no icons ) and sometimes I
can get the Menu, but randomly crashes and returns SF.  I think I'm
overlooking something simple, but only one of you might be able to point
this out:

in my mainwindow class I have the following, but I'm trying to keep
things as simple as possible, following the examples in the book and in
the many posted/published tutorials: Please help!
[code]
ToneAudWindow::ToneAudWindow()
{
    createDockingPanels();
    createToolBars();
    createActions();
//  createMenus();

#if QT_VERSION >= 0x040000
    setContextMenuPolicy(Qt::NoContextMenu);
#endif
} // ends ToneAudWindow

void ToneAudWindow::createToolBars()
{
    fileToolBar = addToolBar(tr("&File"));
    fileToolBar->addAction(newToolAction);
    //fileToolBar->addAction(saveToolAction); //    want to make toolbar
butt
    // to simply I only call for 1 toolbar item
}
void ToneAudWindow::createActions()
{
    newToolAction = new QAction(tr("new &Test..."), this);
    newToolAction->setShortcut(tr("Ctrl+T"));
    newToolAction->setStatusTip(tr("Select New Test ... tbd"));
    newToolAction->setIcon(QIcon("copy.png"));
    connect(newToolAction, SIGNAL(triggered()), this, SLOT(about()));
    
    aboutAction = new QAction(tr("&About"), this);
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}

void ToneAudWindow::about()
{
     QMessageBox::about(this, tr("About HARP Tests"),
             tr("<p>The <b>HARP Test</b> To be filled in with good info
"
                "blah blah blah.</p>"));
}
[/code]

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090111/04c2b235/attachment.html 


More information about the Qt-interest-old mailing list