<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[Solved] Full MDI Example]]></title><description><![CDATA[<p dir="auto">It may seem silly, but I'm taking a beating for doing this.</p>
<p dir="auto">I need to open one within a QMdiSubWindow QMdiArea. The QMdiArea is part of a QMainWindow type window, this window I have some menus and submenus (QActions), when the user clicks on the QAction QMdiSubWindow should be opened within the QMdiArea.<br />
In QMdiSubWindow I will have some components like QLabel, QTextEdit, and a DataGrid QButton. I will also change the icon and title.</p>
<p dir="auto">As QMdiSubWindow have many components and modifications decided to create a class and inherit from QMdiSubWindow.</p>
<p dir="auto">If possible I would like friends to give an example with a QMainWindow that displays a menu containing a QMdiSubWindow. It would be nice if the example were created a class that inherits from QMdiSubWindow to be displayed within the QMdiArea.</p>
<p dir="auto">Sorry for asking so much but I have seen many examples on the internet but could not adapt.</p>
<p dir="auto">I looked at the example "Example MDI NOKIA":<a href="http://doc.qt.nokia.com/latest/mainwindows-mdi-mainwindow-cpp.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/latest/mainwindows-mdi-mainwindow-cpp.html</a> but in my case will not only have a widget like this example, will have several in my case as I mentioned above.</p>
<p dir="auto">Thanks guys!</p>
]]></description><link>https://forum.qt.io/topic/6990/solved-full-mdi-example</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 18:44:02 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/6990.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 24 Jun 2011 20:12:46 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 20:49:12 GMT]]></title><description><![CDATA[<p dir="auto">Ok, understood now, we won, was a big help</p>
]]></description><link>https://forum.qt.io/post/94346</link><guid isPermaLink="true">https://forum.qt.io/post/94346</guid><dc:creator><![CDATA[Exotic_Devel]]></dc:creator><pubDate>Sat, 25 Jun 2011 20:49:12 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 18:39:08 GMT]]></title><description><![CDATA[<p dir="auto">Usually it's enough to just do "right click -&gt; run qmake". If that doesn't work and I can't find the error I usually do a rebuilt (doesn't hurt once in while, especially, if you have generated files), too.</p>
]]></description><link>https://forum.qt.io/post/94342</link><guid isPermaLink="true">https://forum.qt.io/post/94342</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Sat, 25 Jun 2011 18:39:08 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 16:37:24 GMT]]></title><description><![CDATA[<p dir="auto">I'm not 100% sure, when creator runs qmake, it definitly does when you edit the .pro file. Sometimes (I'm not sure if always) changing the logic that is needed for makefiles (which are created by qmake) needs rebuild by hand.</p>
<p dir="auto">By hand means not to go to the command line, it means right click on the project --&gt; rebuild.</p>
]]></description><link>https://forum.qt.io/post/94337</link><guid isPermaLink="true">https://forum.qt.io/post/94337</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Sat, 25 Jun 2011 16:37:24 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 16:22:23 GMT]]></title><description><![CDATA[<p dir="auto">So what you say is that this is not the most appropriate way to resolve are problems? So what would it be? Run qmake manually?</p>
<p dir="auto">The way I solved (by changing the .pro) can bring me any side effects?</p>
<p dir="auto">What I axei strange is that after I edited the .pro in this project, other projects that also emit the error adding Q_OBJECT, now emit no more, without me having to edit .pro them.</p>
]]></description><link>https://forum.qt.io/post/94334</link><guid isPermaLink="true">https://forum.qt.io/post/94334</guid><dc:creator><![CDATA[Exotic_Devel]]></dc:creator><pubDate>Sat, 25 Jun 2011 16:22:23 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 15:54:03 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="matheusssilva_BR" date="1309015190"]So what would be the solution?<br />
[/quote]</p>
<p dir="auto">Run qmake when you add the Q_OBJECT macro.</p>
<p dir="auto">[quote author="matheusssilva_BR" date="1309015190"]<br />
I just edit the code to compile and send any extra procedure should be done by Qt Creator.<br />
What to do now?<br />
[/quote]</p>
<p dir="auto">Qt Creator automatically ran qmake for you when you edited the .pro file. I don't know if Creator can internally detect when the user adds a new Q_OBJECT macro to a file. I also think it would be good.</p>
<p dir="auto">In my previous post I explained to you that the backslash was not <em>the</em> solution.</p>
<hr />
<p dir="auto">I agree with you, unfortunately the Portuguese forums aren't popular. I recommended it for you because:</p>
<ul>
<li>you are a potential contributor to post things there;</li>
<li>"you mentioned the use of google translator":<a href="http://developer.qt.nokia.com/forums/viewthread/6978/" target="_blank" rel="noopener noreferrer nofollow ugc">http://developer.qt.nokia.com/forums/viewthread/6978/</a> to write your posts. So, that's why I thought you would feel more comfortable writing in Portuguese there. Of course you are free to keep posting in the international forums, it was just a <em>suggestion</em>.</li>
</ul>
<p dir="auto">Now it's better to stop this part of the discussion, as it is completely out of the scope of this thread.</p>
]]></description><link>https://forum.qt.io/post/94333</link><guid isPermaLink="true">https://forum.qt.io/post/94333</guid><dc:creator><![CDATA[anselmolsm]]></dc:creator><pubDate>Sat, 25 Jun 2011 15:54:03 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 15:19:50 GMT]]></title><description><![CDATA[<p dir="auto">So what would be the solution? I just edit the code to compile and send any extra procedure should be done by Qt Creator.</p>
<p dir="auto">What to do now?</p>
<hr />
<p dir="auto">As for the forum in Portuguese'll be honest with you, when I visited the forum in Portuguese completely lost the will to participate, there are hardly any topics and there are few who do not have the majority response.<br />
Truth be told Qt is widely used in Brazil and Portuguese-speaking countries.<br />
I believe that we can not wait a large participation of Brazilians there.</p>
<p dir="auto">Cursed be Cabral :-) |o|</p>
<p dir="auto">I do not use Qt as the enthusiast, student, etc.. Although it is now beginning to develop in Qt I use for professional development, then the help of the community is very important to me.</p>
]]></description><link>https://forum.qt.io/post/94329</link><guid isPermaLink="true">https://forum.qt.io/post/94329</guid><dc:creator><![CDATA[Exotic_Devel]]></dc:creator><pubDate>Sat, 25 Jun 2011 15:19:50 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 14:40:36 GMT]]></title><description><![CDATA[<p dir="auto">[quote author="Denis Kormalev" date="1308946704"]Please don't use non-English language in non-national part of DevNet.[/quote]</p>
<h2>matheusssilva_BR, I repeat, you can write in Portuguese in the "Portuguese forum":<a href="http://developer.qt.nokia.com/forums/viewforum/34" target="_blank" rel="noopener noreferrer nofollow ugc">http://developer.qt.nokia.com/forums/viewforum/34</a> .<br />
[pt_BR] Você pode escrever em Português no "fórum  em Português":<a href="http://developer.qt.nokia.com/forums/viewforum/34" target="_blank" rel="noopener noreferrer nofollow ugc">http://developer.qt.nokia.com/forums/viewforum/34</a> [/pt_BR]</h2>
<p dir="auto">[quote author="matheusssilva_BR" date="1309010152"]<br />
Do not know why just adding these two backslashes solved the error.[/quote]</p>
<p dir="auto">No, the backslashes did not solve your problem.</p>
<p dir="auto">So, what happened?<br />
When you edited the .pro file, you forced an automatic execution of <em>qmake</em> before the next execution of <em>make</em>.  (Actually, if your .pro file looks like what you posted above, with a backslash after the last file name, I expected an error...)</p>
<p dir="auto">Summing up: When  you use the Q_OBJECT macro, the class has to be processed by moc (the Qt meta object compiler); in general qmake does it for you. This <em>vtable</em> error occurs when you add the Q_OBJECT macro and try to build the project without running qmake. For more details, "take a look here":<a href="http://doc.qt.nokia.com/4.7/metaobjects.html#meta-object-system" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.qt.nokia.com/4.7/metaobjects.html#meta-object-system</a></p>
]]></description><link>https://forum.qt.io/post/94326</link><guid isPermaLink="true">https://forum.qt.io/post/94326</guid><dc:creator><![CDATA[anselmolsm]]></dc:creator><pubDate>Sat, 25 Jun 2011 14:40:36 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 13:55:52 GMT]]></title><description><![CDATA[<p dir="auto">Thanks friend, now running.<br />
After I added the Q_OBJECT started giving an error</p>
<p dir="auto">/ home / Matthew / Projects / Tests / WindowMain.cpp: -1: error: undefined reference to `vtable for WindowMain '</p>
<p dir="auto">To solve edited the project file:</p>
<p dir="auto">of</p>
<p dir="auto">@HEADERS += <br />
SubWindClientes.h <br />
WindowMain.h</p>
<p dir="auto">SOURCES += <br />
SubWindClientes.cpp <br />
WindowMain.cpp<br />
Main.cpp <br />
@</p>
<p dir="auto">to</p>
<p dir="auto">@HEADERS += <br />
SubWindClientes.h <br />
WindowMain.h \</p>
<p dir="auto">SOURCES += <br />
SubWindClientes.cpp <br />
WindowMain.cpp <br />
Main.cpp <br />
@</p>
<p dir="auto">Do not know why just adding these two backslashes solved the error.</p>
]]></description><link>https://forum.qt.io/post/94322</link><guid isPermaLink="true">https://forum.qt.io/post/94322</guid><dc:creator><![CDATA[Exotic_Devel]]></dc:creator><pubDate>Sat, 25 Jun 2011 13:55:52 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Sat, 25 Jun 2011 07:17:17 GMT]]></title><description><![CDATA[<p dir="auto">your MainWindow misses the Q_OBJECT macro</p>
<p dir="auto">@<br />
#ifndef WINDOWMAIN_H<br />
#define WINDOWMAIN_H</p>
<p dir="auto">#include &lt;QMainWindow&gt;<br />
#include &lt;QMdiArea&gt;</p>
<p dir="auto">class WindowMain : public QMainWindow<br />
{<br />
Q_OBJECT;<br />
public:<br />
WindowMain(QWidget *parent = 0);</p>
<pre><code>    ~WindowMain();
    // ...
</code></pre>
<p dir="auto">};</p>
<p dir="auto">#endif // WINDOWMAIN_H</p>
<p dir="auto">@</p>
]]></description><link>https://forum.qt.io/post/94284</link><guid isPermaLink="true">https://forum.qt.io/post/94284</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Sat, 25 Jun 2011 07:17:17 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Fri, 24 Jun 2011 22:18:11 GMT]]></title><description><![CDATA[<p dir="auto">When I run the application I get this output:</p>
<p dir="auto">Object:: connect: No such slot QMainWindow:: createMdiChild ()</p>
<p dir="auto">Below is the code:</p>
<p dir="auto">@#ifndef WINDOWMAIN_H<br />
#define WINDOWMAIN_H</p>
<p dir="auto">#include &lt;QMainWindow&gt;<br />
#include &lt;QMdiArea&gt;</p>
<p dir="auto">class WindowMain : public QMainWindow<br />
{</p>
<pre><code>public:
    WindowMain(QWidget *parent = 0);

    ~WindowMain();

private slots:
    void createMdiChild();

private:
    // Area MDI
    QMdiArea *mdiarea;

    // Menus
    QMenu *arquivos;

    // QActions de menus
    QAction *clientes;
</code></pre>
<p dir="auto">};</p>
<p dir="auto">#endif // WINDOWMAIN_H<br />
@</p>
<p dir="auto">@#include &lt;QApplication&gt;<br />
#include &lt;QTextCodec&gt;<br />
#include &lt;QDesktopWidget&gt;<br />
#include &lt;QRect&gt;<br />
#include &lt;QMenuBar&gt;<br />
#include &lt;QToolBar&gt;             // Cabeçalhos da API Qt que serão usadas na janela pincipal<br />
#include &lt;QStatusBar&gt;<br />
#include &lt;QList&gt;<br />
#include &lt;QLabel&gt;</p>
<p dir="auto">#include "WindowMain.h"         // Usa o arquivo de cabeçalho onde a classe foi definida<br />
#include "SubWindClientes.h"</p>
<p dir="auto">/* Define a classe WindowMain e já invoca o<br />
construtor da classe pai, passando o ponteiro<br />
"parent" como parâmetro.*/</p>
<p dir="auto">WindowMain::WindowMain(QWidget *parent):QMainWindow(parent)<br />
{<br />
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));         // Define os caracteres da<br />
// aplicação p/ UTF-8</p>
<pre><code>setWindowTitle("Sistema Integrado de Gestão Óptica - MÓDULO RETAGUARDA");


// Exibe a barra de status de QMainWindow
statusBar()-&gt;show();

// Prepara a area de trabalho MDI da aplicação
mdiarea = new QMdiArea;
setCentralWidget(mdiarea);


// Prepara o menu principal da aplicação
arquivos                        = menuBar()-&gt;addMenu("&amp;Arquivo");


// Prepara os itens de menu
clientes                        = new QAction("Clientes", arquivos);

// Carregando a lista de itens
QList &lt;QAction *&gt; listarquivos;

listarquivos &lt;&lt; clientes;


//Adicionando a lista de intens aos menus
arquivos-&gt;addActions(listarquivos);

// Deixando a janela no centro da tela
QRect ct = geometry();
ct.moveCenter(QApplication::desktop()-&gt;availableGeometry().center());
setGeometry(ct);

connect(clientes, SIGNAL(triggered()), this, SLOT(createMdiChild()));
</code></pre>
<p dir="auto">}</p>
<p dir="auto">WindowMain::~WindowMain()<br />
{<br />
delete mdiarea;<br />
}</p>
<p dir="auto">void WindowMain::createMdiChild()<br />
{<br />
SubWindClientes *child = new SubWindClientes;<br />
mdiarea-&gt;addSubWindow(child);<br />
child-&gt;show();<br />
}<br />
@</p>
<p dir="auto">@#include "WindowMain.h"<br />
#include &lt;QApplication&gt;</p>
<p dir="auto">int main(int argc, char *argv [])<br />
{<br />
QApplication programa(argc, argv);   // Objeto da aplicação</p>
<pre><code>WindowMain windmain;                 // Objeto da janela principal

windmain.show();

return programa.exec&amp;#40;&amp;#41;;
</code></pre>
<p dir="auto">}<br />
@</p>
<p dir="auto">Thanks for the help</p>
]]></description><link>https://forum.qt.io/post/94267</link><guid isPermaLink="true">https://forum.qt.io/post/94267</guid><dc:creator><![CDATA[Exotic_Devel]]></dc:creator><pubDate>Fri, 24 Jun 2011 22:18:11 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Fri, 24 Jun 2011 20:51:30 GMT]]></title><description><![CDATA[<p dir="auto">You can use the same logic as in the above mentioned example:</p>
<p dir="auto">@<br />
MdiChild *MainWindow::createMdiChild()<br />
{<br />
SubWindClientes  *child = new SubWindClientes ;<br />
mdiArea-&gt;addSubWindow(child);<br />
return child;<br />
}<br />
@</p>
]]></description><link>https://forum.qt.io/post/94261</link><guid isPermaLink="true">https://forum.qt.io/post/94261</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Fri, 24 Jun 2011 20:51:30 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Fri, 24 Jun 2011 20:48:27 GMT]]></title><description><![CDATA[<p dir="auto">for example</p>
<p dir="auto">@#ifndef SUBWINDCLIENTES_H<br />
#define SUBWINDCLIENTES_H</p>
<p dir="auto">#include &lt;QMdiSubWindow&gt;</p>
<p dir="auto">class SubWindClientes : public QMdiSubWindow<br />
{<br />
public:<br />
SubWindClientes(QWidget *parent = 0, Qt::WindowFlags flags = 0);<br />
};</p>
<p dir="auto">#endif // SUBWINDCLIENTES_H<br />
@</p>
<p dir="auto">@#include "SubWindClientes.h"</p>
<p dir="auto">SubWindClientes::SubWindClientes(QWidget *parent, Qt::WindowFlags flags)<br />
{</p>
<p dir="auto">}@</p>
<p dir="auto">@#ifndef WINDOWMAIN_H<br />
#define WINDOWMAIN_H</p>
<p dir="auto">#include &lt;QMainWindow&gt;<br />
#include &lt;QMdiArea&gt;</p>
<p dir="auto">class WindowMain : public QMainWindow<br />
{</p>
<pre><code>public:
    WindowMain(QWidget *parent = 0);

    ~WindowMain();

private:
    // Area MDI
    QMdiArea *mdiarea;

    // Menus
    QMenu *arquivos;

    // QActions de menus
    QAction *clientes;
</code></pre>
<p dir="auto">};</p>
<p dir="auto">#endif // WINDOWMAIN_H<br />
@</p>
<p dir="auto">@#include &lt;QApplication&gt;<br />
#include &lt;QTextCodec&gt;<br />
#include &lt;QDesktopWidget&gt;<br />
#include &lt;QRect&gt;<br />
#include &lt;QMenuBar&gt;<br />
#include &lt;QToolBar&gt;             // Cabeçalhos da API Qt que serão usadas na janela pincipal<br />
#include &lt;QStatusBar&gt;<br />
#include &lt;QList&gt;<br />
#include &lt;QLabel&gt;</p>
<p dir="auto">#include "WindowMain.h"         // Usa o arquivo de cabeçalho onde a classe foi definida</p>
<p dir="auto">/* Define a classe WindowMain e já invoca o<br />
construtor da classe pai, passando o ponteiro<br />
"parent" como parâmetro.*/</p>
<p dir="auto">WindowMain::WindowMain(QWidget *parent):QMainWindow(parent)<br />
{<br />
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));         // Define os caracteres da<br />
// aplicação p/ UTF-8</p>
<pre><code>setWindowTitle("Sistema Integrado de Gestão Óptica - MÓDULO RETAGUARDA");


// Exibe a barra de status de QMainWindow
statusBar()-&gt;show();

// Prepara a area de trabalho MDI da aplicação
mdiarea = new QMdiArea;
setCentralWidget(mdiarea);


// Prepara o menu principal da aplicação
arquivos                        = menuBar()-&gt;addMenu("&amp;Arquivo");


// Prepara os itens de menu
clientes                        = new QAction("Clientes", arquivos);

// Carregando a lista de itens
QList &lt;QAction *&gt; listarquivos;

listarquivos &lt;&lt; clientes;


//Adicionando a lista de intens aos menus
arquivos-&gt;addActions(listarquivos);

// Deixando a janela no centro da tela
QRect ct = geometry();
ct.moveCenter(QApplication::desktop()-&gt;availableGeometry().center());
setGeometry(ct);
</code></pre>
<p dir="auto">}</p>
<p dir="auto">WindowMain::~WindowMain()<br />
{<br />
delete mdiarea;<br />
}<br />
@</p>
<p dir="auto">How to open this QMdiSubWindow in this QMdiArea?</p>
]]></description><link>https://forum.qt.io/post/94260</link><guid isPermaLink="true">https://forum.qt.io/post/94260</guid><dc:creator><![CDATA[Exotic_Devel]]></dc:creator><pubDate>Fri, 24 Jun 2011 20:48:27 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Fri, 24 Jun 2011 20:24:02 GMT]]></title><description><![CDATA[<p dir="auto">hi matheusssilva_BR,</p>
<p dir="auto">you just create a combined widget that you use a QMdiSubwindow, like you do with dialogs.</p>
]]></description><link>https://forum.qt.io/post/94255</link><guid isPermaLink="true">https://forum.qt.io/post/94255</guid><dc:creator><![CDATA[giesbert]]></dc:creator><pubDate>Fri, 24 Jun 2011 20:24:02 GMT</pubDate></item><item><title><![CDATA[Reply to [Solved] Full MDI Example on Fri, 24 Jun 2011 20:18:24 GMT]]></title><description><![CDATA[<p dir="auto">Please don't use non-English language in non-national part of DevNet.</p>
]]></description><link>https://forum.qt.io/post/94253</link><guid isPermaLink="true">https://forum.qt.io/post/94253</guid><dc:creator><![CDATA[DenisKormalev]]></dc:creator><pubDate>Fri, 24 Jun 2011 20:18:24 GMT</pubDate></item></channel></rss>