Note that there are some explanatory texts on larger screens.

plurals
  1. POQt example notepad program not displaying any controls
    primarykey
    data
    text
    <p>I am following the Qt example listed in the QtSDK titled: "Getting Started Programming with Qt". My problem is that the program doesn't display any of the objects.</p> <p>My main.cpp looks like so: </p> <pre><code>#include &lt;QtGui&gt; #include &lt;notepad.h&gt; int main(int argv, char **args) { QApplication app(argv, args); QVBoxLayout layout; Notepad notepad(); QWidget window; window.setLayout(&amp;layout); window.show(); return app.exec(); } </code></pre> <p>The 'notepad.h' file: </p> <pre><code>#ifndef NOTEPAD_H #define NOTEPAD_H #include &lt;QtGui&gt; class Notepad : public QMainWindow { Q_OBJECT public: Notepad(); private slots: void open(); void save(); void quit(); private: QTextEdit *text_edit; QAction *open_action; QAction *save_action; QAction *exit_action; QMenu *file_menu; }; #endif // NOTEPAD_H </code></pre> <p>The 'notepad.cpp' file:</p> <pre><code>#include "notepad.h" Notepad::Notepad() { open_action = new QAction(tr("&amp;Open"), this); save_action = new QAction(tr("&amp;Save"), this); exit_action = new QAction(tr("&amp;Exit"), this); connect(open_action, SIGNAL(triggered()), this, SLOT(open())); connect(save_action, SIGNAL(triggered()), this, SLOT(save())); connect(exit_action, SIGNAL(triggered()), qApp, SLOT(quit())); file_menu = menuBar()-&gt;addMenu(tr("&amp;File")); file_menu-&gt;addAction(open_action); file_menu-&gt;addAction(save_action); file_menu-&gt;addSeparator(); file_menu-&gt;addAction(exit_action); text_edit = new QTextEdit; setCentralWidget(text_edit); setWindowTitle(tr("Notepad")); } void Notepad::open() { ... } void Notepad::save() { ... } void Notepad::quit() { } </code></pre> <p>Any help in resolving the matter would be much appreciated.</p> <p><strong>Edit</strong></p> <p>My original question asked why I was I was getting a compile time error for not implementing the "quit" function incase you are wondering :).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload