[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-edu-devel
Subject:    Re: [Qt-creator] mainwindow.cpp has unexpectedly finished.
From:       Diego Iastrubni <diegoiast () gmail ! com>
Date:       2012-07-01 15:19:18
Message-ID: CALR4fELKL_Gq7CuoYsHf2f__dm-Y-r3bbmsSZfx0xqbQ8581YA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sun, Jul 1, 2012 at 5:38 PM, Heena Mahur <hena18@rocketmail.com> wrote:

> Hey,
> Please have a look at mainwindow.cpp
>
> #include "mainwindow.h"
>
> #include "ui_mainwindow.h"
>
> #include <QSplitter>
>
>
>
> MainWindow::MainWindow(QWidget *parent) :
>
>
>     QMainWindow(parent),
>
>
>     ui(new Ui::MainWindow)
>
> {    QSplitter *splitter1 = new QSplitter(parent);
>
>      QSplitter *splitter2 = new QSplitter(parent);
>
>
ui->treeWidget is null. It is constructed in setupUi()



>      ui->setupUi(this);
>
>
Move this line to the beginning  of the method.

PS: use a debugger - or valgrind. It will help you find those bugs.

[Attachment #5 (text/html)]

<div dir="ltr"><br><div class="gmail_quote">On Sun, Jul 1, 2012 at 5:38 PM, Heena \
Mahur <span dir="ltr">&lt;<a href="mailto:hena18@rocketmail.com" \
target="_blank">hena18@rocketmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">

<div><div style="font-size:12pt;font-family:arial,helvetica,sans-serif"><div \
style="font-family:arial,helvetica,sans-serif;font-size:12pt">Hey,</div><div \
style="font-family:arial,helvetica,sans-serif;font-size:12pt">Please have a look at \
mainwindow.cpp</div>

<div>
<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#000080">#include</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">&quot;mainwindow.h&quot;</span></pre>


<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#000080">#include</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">&quot;ui_mainwindow.h&quot;</span></pre>


<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#000080">#include</span><span style="color:#c0c0c0"> </span><span \
style="color:#008000">&lt;QSplitter&gt;</span></pre>


<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><br></pre>
 <pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><br></pre>
 <pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#800080">MainWindow</span>::<span \
style="color:#800080">MainWindow</span>(<span \
style="color:#800080">QWidget</span><span style="color:#c0c0c0"> </span>*parent)<span \
style="color:#c0c0c0"> </span>:</pre>


<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><br></pre>
 <pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0">    </span><span \
style="color:#800080">QMainWindow</span>(parent),</pre> <pre \
style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><br></pre>
 <pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0">    </span><span style="color:#800000">ui</span>(<span \
style="color:#808000">new</span><span style="color:#c0c0c0"> </span><span \
style="color:#800080">Ui</span>::<span style="color:#800080">MainWindow</span>)</pre>


<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px">{<span \
style="color:#c0c0c0">    </span><span style="color:#800080">QSplitter</span><span \
style="color:#c0c0c0"> </span>*splitter1<span style="color:#c0c0c0"> </span>=<span \
style="color:#c0c0c0"> </span><span style="color:#808000">new</span><span \
style="color:#c0c0c0"> </span><span \
style="color:#800080">QSplitter</span>(parent);</pre>


<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="color:#c0c0c0">     </span><span style="color:#800080">QSplitter</span><span \
style="color:#c0c0c0"> </span>*splitter2<span style="color:#c0c0c0"> </span>=<span \
style="color:#c0c0c0"> </span><span style="color:#808000">new</span><span \
style="color:#c0c0c0"> </span><span \
style="color:#800080">QSplitter</span>(parent);</pre>

</div></div></div></blockquote><div><br></div><div>ui-&gt;treeWidget is null. It is \
constructed in setupUi()</div><div><br></div><div> </div><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">

<div><div style="font-size:12pt;font-family:arial,helvetica,sans-serif">
<pre style="font-family:arial,helvetica,sans-serif;font-size:12pt;margin-top:0px;margin-bottom:0px"><span \
style="font-size:12pt;color:rgb(192,192,192)">    </span><span \
style="font-size:12pt;color:rgb(128,0,0)">ui</span><span \
style="font-size:12pt">-&gt;setupUi(</span><span \
style="font-size:12pt;color:rgb(128,128,0)">this</span><span \
style="font-size:12pt">);</span></pre>

</div></div></blockquote><div><br></div><div>Move this line to the beginning  of the \
method.</div><div><br></div><div>PS: use a debugger - or valgrind. It will help you \
find those bugs.</div></div></div>



_______________________________________________
kde-edu mailing list
kde-edu@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-edu


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic