Search Results

Search found 2 results on 1 pages for 'dumbquestion'.

Page 1/1 | 1 

  • Qt send signal to main application window

    - by dumbquestion
    I need a QDialog to send a signal to redraw the main window. But connect needs an object to connect to. So I must create each dialog with new and explicitly put a connect() every time. What I really need is a way of just sending MainWindow::Redraw() from inside any function and having a single connect() inside Mainwindow to receive them. But you can't make a signal static and dialogs obviously don't inherit from MainWindow.

    Read the article

  • Inheritance - initialization problem

    - by dumbquestion
    I have a c++ class derived from a base class in a framework. The derived class doesn't have any data members because I need it to be freely convertible into a base class and back - the framework is responsible for loading and saving the objects and I can't change it. My derived class just has functions for accessing the data. But there are a couple of places where I need to store some temporary local variables to speed up access to data in the base class. mydata* MyClass::getData() { if ( !m_mydata ) { // set to NULL in the constructor m_mydata = some_long_and complex_operation_to_get_the_data_in_the_base() } return m_mydata; } The problem is if I just access the object by casting the base class pointer returned from the framework to MyClass* the ctor for MyClass is never called and m_mydata is junk. Is there a way of only initializing the m_mydata pointer once?

    Read the article

1