Results 1 to 16 of 16

Thread: qwtPlot->replot() results in segmentation fault

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwtPlot->replot() results in segmentation fault

    Here is the class generated by the designer, which instantiats qwtPlot:
    Qt Code:
    1. QT_BEGIN_NAMESPACE
    2.  
    3. class Ui_MainWindow
    4. {
    5. public:
    6. QWidget *centralwidget;
    7. QwtPlot *qwtPlot; // here
    8. QMenuBar *menubar;
    9. QStatusBar *statusbar;
    10.  
    11. void setupUi(QMainWindow *MainWindow)
    12. {
    13. if (MainWindow->objectName().isEmpty())
    14. MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
    15. MainWindow->resize(800, 600);
    16. centralwidget = new QWidget(MainWindow);
    17. centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
    18. qwtPlot = new QwtPlot(centralwidget); // here
    19. qwtPlot->setObjectName(QString::fromUtf8("qwtPlot"));
    20. qwtPlot->setGeometry(QRect(40, 30, 721, 501));
    21. MainWindow->setCentralWidget(centralwidget);
    22. menubar = new QMenuBar(MainWindow);
    23. menubar->setObjectName(QString::fromUtf8("menubar"));
    24. menubar->setGeometry(QRect(0, 0, 800, 24));
    25. MainWindow->setMenuBar(menubar);
    26. statusbar = new QStatusBar(MainWindow);
    27. statusbar->setObjectName(QString::fromUtf8("statusbar"));
    28. MainWindow->setStatusBar(statusbar);
    29.  
    30. retranslateUi(MainWindow);
    31.  
    32. QMetaObject::connectSlotsByName(MainWindow);
    33. } // setupUi
    34.  
    35. void retranslateUi(QMainWindow *MainWindow)
    36. {
    37. MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
    38. Q_UNUSED(MainWindow);
    39. } // retranslateUi
    40.  
    41. };
    42.  
    43. namespace Ui {
    44. class MainWindow: public Ui_MainWindow {};
    45. } // namespace Ui
    46.  
    47. QT_END_NAMESPACE
    To copy to clipboard, switch view to plain text mode 

    And this is the header of the M_MainWindow class I posted yesterday:
    Qt Code:
    1. class M_MainWindow : public QMainWindow,
    2. private Ui::MainWindow
    3. {
    4. Q_OBJECT
    5.  
    6. public:
    7. M_MainWindow ( QWidget *parent = 0 );
    8.  
    9. ~M_MainWindow();
    10.  
    11. };
    To copy to clipboard, switch view to plain text mode 

    I think, the private Ui::MainWindow inheritance is the reason, why I don't need the ui.*...

    I am really sorry to get on your nervs every day. But it is a real pity to have such a show stopper as a newby to C++, Qt and qwt when everything else works fine.
    Last edited by kaizimir; 29th August 2009 at 09:34.

  2. #2
    Join Date
    Jul 2009
    Posts
    13
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwtPlot->replot() results in segmentation fault

    Hey,

    I found the problem and I must admitt, that it is not related to qwt.

    @jmsbc: You were right from the beginning, that it is a problem of instantiation and that the plot widget isn't accessible from where I wanted to use it.

    I am doing it now by handing over a pointer to the qwt widget to the class that uses the plot. I am not very happy with that solution and hope to find a way with inheritance.

    Thanks to all,

    kai

  3. #3
    Join Date
    Oct 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: qwtPlot->replot() results in segmentation fault

    I know I am a bit late to this thread, but you forgot to call setupUi(this) in the constructor of M_Plot.

  4. #4
    Join Date
    Nov 2008
    Posts
    22
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: qwtPlot->replot() results in segmentation fault

    this might be somewhat related, I found that replot() works well when I rescale my x-axis in Mac OS platform, but it does not respond/work when I use this in Linux? It's kind of strange. I wonder if this is related?

    I just posted the details in a separate thread.

Similar Threads

  1. Replies: 21
    Last Post: 28th September 2010, 10:59
  2. Replies: 2
    Last Post: 16th June 2010, 23:58
  3. segmentation fault for no apparent reason
    By rishiraj in forum Newbie
    Replies: 1
    Last Post: 12th February 2009, 11:13
  4. Segmentation fault running any QT4 executables
    By jellis in forum Installation and Deployment
    Replies: 7
    Last Post: 19th May 2007, 16:35
  5. Icons missing => segmentation fault
    By antonio.r.tome in forum Qt Programming
    Replies: 4
    Last Post: 8th March 2006, 16:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.