<?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[Question about an example of “C++ GUI Programming with Qt 4]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I am working on the same example with QT 4.8.4 and QT Creator 2.6.2. When I run it, several errors including the followings occur. I have tried all the ways from the forum but I haven’t fixed.</p>
<p dir="auto">I have cleaned the project, rebuild and run qmake. But, it doesn’t solve. Any help is appreciated.</p>
<p dir="auto">Regards,</p>
<ol>
<li>error: C2628: ‘FindDialog’ followed by ‘int’ is illegal (did you forget a ‘;’?)</li>
<li>error: C3874: return type of ‘main’ should be ‘int’ instead of ‘FindDialog’ 3. error: C2664: ‘FindDialog::FindDialog(QWidget *)’ : cannot convert parameter 1 from ‘int’ to ‘QWidget *’</li>
<li>Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast</li>
</ol>
<p dir="auto">@    <a href="//finddialog.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">//finddialog.cpp</a><br />
#include &lt;QtGui&gt;<br />
#include "FindDialog.h"</p>
<pre><code>FindDialog::FindDialog(QWidget *parent)
        : QDialog(parent){
    label = new QLabel(tr("Find &amp;what: "));
    lineEdit = new QLineEdit;
    label-&gt;setBuddy(lineEdit);
 
    caseCheckBox = new QCheckBox(tr("Match &amp;case"));
    backwardCheckBox = new QCheckBox(tr("Search &amp;Backward"));
 
    findButton = new QPushButton(tr("&amp;Find"));
    findButton-&gt;setDefault(true);
    findButton-&gt;setEnabled(false);
 
    closeButton = new QPushButton(tr("Close"));
 
    connect(lineEdit, SIGNAL(textChanged(QString &amp;)),this, SLOT(enableFindButton(QString &amp;)));
    connect(findButton, SIGNAL(clicked()), this, SLOT(findclicked()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
 
    QHBoxLayout *topLeftLayout = new QHBoxLayout;
    topLeftLayout-&gt;addWidget(label);
    topLeftLayout-&gt;addWidget(lineEdit);
 
    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout-&gt;addLayout(topLeftLayout);
    leftLayout-&gt;addWidget(caseCheckBox);
    leftLayout-&gt;addWidget(backwardCheckBox);
 
    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout-&gt;addWidget(findButton);
    rightLayout-&gt;addWidget(closeButton);
    rightLayout-&gt;addStretch();
 
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout-&gt;addLayout(leftLayout);
    mainLayout-&gt;addLayout(rightLayout);
    setLayout(mainLayout);
 
    setWindowTitle(tr("Find"));
    setFixedHeight(sizeHint().height());
 
}
 
void FindDialog::findClicked() // kullanici find butonunu tıkladığında calisir
{
    QString text = lineEdit-&gt;text();
 
    Qt::CaseSensitivity cs = caseCheckBox-&gt;isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;
 
    if (backwardCheckBox-&gt;isChecked()) { //backward Checkbox secili ise findPrevious sinyali yayar
        emit findPrevious(text, cs);}
    else {
        emit findNext(text, cs);}
}
 
 void FindDialog::enableFindButton(const QString &amp;text) // satır editöründe metin degisiligi olunca finbutton calistirilir...
{
  findButton-&gt;setEnabled(!text.isEmpty());
}

//finddialog.h
#ifndef FINDDIALOG_H
#define FINDDIALOG_H
 
#include &lt;QDialog&gt;
 
class QCheckbox;
class QLabel;
class QLineEdit;
class QPushButton;
 
class FindDialog : public QDialog
{
    Q_OBJECT
 
public:
    FindDialog (QWidget *parent = 0);
signals: // sinyal bildirimleri
    void findNext(const QString &amp;str, Qt::CaseSensitivity cs);
    void findPrevious(const QString &amp;str, Qt::CaseSensitivity cs);
private slots: // yuva bildirimleri
    void findclicked();
    void enableFindButton(const QString &amp;text);
private:
    QLabel *label;
    QLineEdit *lineEdit;
    QCheckbox *caseCheckBox;
    QCheckbox *backwardCheckBox;
    QPushButton *findButton;
    QPushButton *closeButton;
}
 
#endif // FINDDIALOG_H

//main.cpp
#include &lt;QApplication&gt;
#include "FindDialog.h"
 
int main(int argc, char *argv[])
{
 
    QApplication app(argc, argv);
    FindDialog *dialog = new FindDialog;
 
    dialog-&gt;show();
    return app.exec();
}
</code></pre>
<p dir="auto">@</p>
]]></description><link>https://forum.qt.io/topic/24809/question-about-an-example-of-c-gui-programming-with-qt-4</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Apr 2026 11:52:03 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/24809.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 03 Mar 2013 22:02:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Tue, 05 Mar 2013 15:12:35 GMT]]></title><description><![CDATA[<p dir="auto">Ow its closed now??</p>
]]></description><link>https://forum.qt.io/post/169219</link><guid isPermaLink="true">https://forum.qt.io/post/169219</guid><dc:creator><![CDATA[iamfrankenstein]]></dc:creator><pubDate>Tue, 05 Mar 2013 15:12:35 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Tue, 05 Mar 2013 15:11:59 GMT]]></title><description><![CDATA[<p dir="auto">Aren’t you suppose to terminate a class definition with ‘;’?<br />
I don’t see that in you header file finddialog.h</p>
<p dir="auto">That is what the compiler means with “did you forget a ‘;’?”<br />
I’ll check in a few hours to see your response if its not the case.</p>
<p dir="auto">(Why have you posted you question twice??)</p>
]]></description><link>https://forum.qt.io/post/169218</link><guid isPermaLink="true">https://forum.qt.io/post/169218</guid><dc:creator><![CDATA[iamfrankenstein]]></dc:creator><pubDate>Tue, 05 Mar 2013 15:11:59 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Mon, 04 Mar 2013 00:22:46 GMT]]></title><description><![CDATA[<p dir="auto">Thanks a lot,</p>
<p dir="auto">Also, I have mistaken on findclicked function. I will be much more careful,</p>
<p dir="auto">Regards,</p>
]]></description><link>https://forum.qt.io/post/169058</link><guid isPermaLink="true">https://forum.qt.io/post/169058</guid><dc:creator><![CDATA[bc913]]></dc:creator><pubDate>Mon, 04 Mar 2013 00:22:46 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Mon, 04 Mar 2013 00:20:34 GMT]]></title><description><![CDATA[<p dir="auto">you also need to include the QString header. thats why it is complaining on line 50. The compiler has no idea about QString</p>
]]></description><link>https://forum.qt.io/post/169057</link><guid isPermaLink="true">https://forum.qt.io/post/169057</guid><dc:creator><![CDATA[mwright]]></dc:creator><pubDate>Mon, 04 Mar 2013 00:20:34 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Mon, 04 Mar 2013 00:13:33 GMT]]></title><description><![CDATA[<p dir="auto">Okay so you have a typo for QCheckbox. it should be QCheckBox. please check your code and let us know of any other issue.</p>
]]></description><link>https://forum.qt.io/post/169056</link><guid isPermaLink="true">https://forum.qt.io/post/169056</guid><dc:creator><![CDATA[mwright]]></dc:creator><pubDate>Mon, 04 Mar 2013 00:13:33 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Mon, 04 Mar 2013 00:09:18 GMT]]></title><description><![CDATA[<p dir="auto">Error lines:<br />
<a href="//finddialog.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">//finddialog.cpp</a></p>
<p dir="auto">Lines: 11,12,30,31,48,50,52,55, 56, 58</p>
]]></description><link>https://forum.qt.io/post/169055</link><guid isPermaLink="true">https://forum.qt.io/post/169055</guid><dc:creator><![CDATA[bc913]]></dc:creator><pubDate>Mon, 04 Mar 2013 00:09:18 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Mon, 04 Mar 2013 00:07:02 GMT]]></title><description><![CDATA[<p dir="auto">Here is the error list,</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/error">@<bdi>error</bdi></a> C2440: '=' : cannot convert from 'QCheckBox *' to 'QCheckbox *'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
..\bc1\finddialog.cpp(12) : error C2440: '=' : cannot convert from 'QCheckBox *' to 'QCheckbox *'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
..\bc1\finddialog.cpp(30) : error C2664: 'QBoxLayout::addWidget' : cannot convert parameter 1 from 'QCheckbox *' to 'QWidget *'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
..\bc1\finddialog.cpp(31) : error C2664: 'QBoxLayout::addWidget' : cannot convert parameter 1 from 'QCheckbox *' to 'QWidget *'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
..\bc1\finddialog.cpp(48) : error C2039: 'findClicked' : is not a member of 'FindDialog'<br />
d:\bc913\egitim\yazilim\qt\proje\bc1\FindDialog.h(11) : see declaration of 'FindDialog'<br />
..\bc1\finddialog.cpp(50) : error C2065: 'lineEdit' : undeclared identifier<br />
..\bc1\finddialog.cpp(50) : error C2227: left of '-&gt;text' must point to class/struct/union/generic type<br />
type is ''unknown-type''<br />
..\bc1\finddialog.cpp(52) : error C2065: 'caseCheckBox' : undeclared identifier<br />
..\bc1\finddialog.cpp(52) : error C2227: left of '-&gt;isChecked' must point to class/struct/union/generic type<br />
type is ''unknown-type''<br />
..\bc1\finddialog.cpp(54) : error C2065: 'backwardCheckBox' : undeclared identifier<br />
..\bc1\finddialog.cpp(54) : error C2227: left of '-&gt;isChecked' must point to class/struct/union/generic type<br />
type is ''unknown-type''<br />
..\bc1\finddialog.cpp(55) : error C3861: 'findPrevious': identifier not found<br />
..\bc1\finddialog.cpp(57) : error C3861: 'findNext': identifier not found@</p>
]]></description><link>https://forum.qt.io/post/169054</link><guid isPermaLink="true">https://forum.qt.io/post/169054</guid><dc:creator><![CDATA[bc913]]></dc:creator><pubDate>Mon, 04 Mar 2013 00:07:02 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Mon, 04 Mar 2013 00:02:00 GMT]]></title><description><![CDATA[<p dir="auto">Can you provide the error(errors) and line(lines) in the code the compiler is pointing to?</p>
]]></description><link>https://forum.qt.io/post/169053</link><guid isPermaLink="true">https://forum.qt.io/post/169053</guid><dc:creator><![CDATA[mwright]]></dc:creator><pubDate>Mon, 04 Mar 2013 00:02:00 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Sun, 03 Mar 2013 23:56:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Yer, you are right. I forgot it but after I have added the semi-colon, error situation continues. Only the number of errors were decreased...</p>
<p dir="auto">Only, the errors about QCheckBox still exist.</p>
]]></description><link>https://forum.qt.io/post/169052</link><guid isPermaLink="true">https://forum.qt.io/post/169052</guid><dc:creator><![CDATA[bc913]]></dc:creator><pubDate>Sun, 03 Mar 2013 23:56:58 GMT</pubDate></item><item><title><![CDATA[Reply to Question about an example of “C++ GUI Programming with Qt 4 on Sun, 03 Mar 2013 23:17:37 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">In the header file did you end the class definition with a semi-colon. The example you have shown hasn't.</p>
]]></description><link>https://forum.qt.io/post/169051</link><guid isPermaLink="true">https://forum.qt.io/post/169051</guid><dc:creator><![CDATA[mwright]]></dc:creator><pubDate>Sun, 03 Mar 2013 23:17:37 GMT</pubDate></item></channel></rss>