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

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Sun Jan 11 23:27:38 CET 2009


Hi S, 
 
I think you need to create the actions before the toolbars. 
 
Tony Rietwyk. 
 
 

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of S. Aguinaga
Sent: Monday, 12 January 2009 06:09
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]




__________ NOD32 3757 (20090111) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


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


More information about the Qt-interest-old mailing list