<?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[Funktionsübergreifende Zugriffe unter QT4]]></title><description><![CDATA[<p>Hallo!</p>
<p>Der Threadtitel sagt wenig, klingt dafür professionell: Mir ist leider nichts besseres eingefallen, dafür folgt ja hier jetzt die Beschreibung meines Problems:</p>
<p>Ich habe drei Dateien. Einmal die main.cpp, in dem sich der Hauptquellcode meines Programmes befindet. Dann habe ich noch zwei ui-Dateien, also ui_...1....h und ui_...2....h. Der Aufruf von der ui 1 Datei ist dabei ganz einfach, ich erstelle im Quellcode der main.cpp einfach einen neuen Dialog, der die Informationen aus der ui-Datei nutzt und lasse diesen mit dialog-&gt;show(); anzeigen. Das funktioniert auch. Nur gibt es nun in dieser ersten ui Datei jedoch einen Button, der beim draufklicken einen neuen Dialog öffnen soll, also die zweite ui-Datei. Beide sind natürlich in die main.cpp ordnungsgemäß schon deklariert, nur beim zweiten Dialog habe ich das dialog2-&gt;show() weggelassen, um ihn erst beim Klick auf den Button anzeigen zu lassen. Nun befinden sich der Button und die deklaration des zweiten Dialoges jedoch in Unterschiedlichen Gültigkeitsbereichen und daher funktioniert das ganze nicht so wirklich. Ich habe jetzt schon für 4 Stunden probiert, das irgendwie hinzubasteln, aber es hat partout nicht klappen wollen... Ich vermute mal meine Anwendung ist vom ganzen Konzept her falsch? Was könnte ich besser machen? Kann ich mein Problem doch noch irgendwie direkt lösen? Hier aber erstmal die Dateien:</p>
<p><strong>main.cpp:</strong></p>
<pre><code class="language-cpp">#include &lt;QApplication&gt;
#include &lt;QFont&gt;
#include &lt;QPushButton&gt;
#include &lt;QWidget&gt;
#include &lt;QMetaObject&gt;
#include &lt;iostream&gt;
#include &quot;ui_main.h&quot;
#include &quot;ui_readout.h&quot;

using namespace std;

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QDialog *dialog = new QDialog;
    Ui::getsysteminformation ui;
    ui.setupUi(dialog);
    dialog-&gt;show();
    QDialog *dialog2 = new QDialog;
    Ui::readout ui2;
    ui2.setupUi(dialog2);

    return app.exec();
}
</code></pre>
<p><strong>ui_main.h:</strong></p>
<pre><code class="language-cpp">#ifndef UI_MAIN_H
#define UI_MAIN_H

#include &lt;QtCore/QVariant&gt;
#include &lt;QtGui/QAction&gt;
#include &lt;QtGui/QApplication&gt;
#include &lt;QtGui/QButtonGroup&gt;
#include &lt;QtGui/QDialog&gt;
#include &lt;QtGui/QFrame&gt;
#include &lt;QtGui/QLabel&gt;
#include &lt;QtGui/QPushButton&gt;
#include &lt;QtGui/QTextBrowser&gt;

QT_BEGIN_NAMESPACE

class Ui_getsysteminformation
{
public:
    QPushButton *pushButton;
    QPushButton *startcheck;
    QFrame *line;
    QLabel *label;
    QLabel *information;
    QTextBrowser *textBrowser;

    void setupUi(QDialog *getsysteminformation)
    {
    if (getsysteminformation-&gt;objectName().isEmpty())
        getsysteminformation-&gt;setObjectName(QString::fromUtf8(&quot;getsysteminformation&quot;));
    getsysteminformation-&gt;setFixedSize(500, 300);
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(getsysteminformation-&gt;sizePolicy().hasHeightForWidth());
    getsysteminformation-&gt;setSizePolicy(sizePolicy);
    getsysteminformation-&gt;setMouseTracking(false);

    QPalette palette;
    QBrush brush(QColor(255, 255, 255, 0));
    brush.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Base, brush);
    palette.setBrush(QPalette::Inactive, QPalette::Base, brush);
    QBrush brush1(QColor(244, 244, 244, 255));
    brush1.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Disabled, QPalette::Base, brush1);
    getsysteminformation-&gt;setPalette(palette);

    pushButton = new QPushButton(getsysteminformation);
    pushButton-&gt;setObjectName(QString::fromUtf8(&quot;pushButton&quot;));
    pushButton-&gt;setGeometry(QRect(370, 260, 116, 30));
    pushButton-&gt;setAutoDefault(true);
    pushButton-&gt;setFlat(false);
    QObject::connect(pushButton, SIGNAL(clicked()), qApp, SLOT(quit()));

    startcheck = new QPushButton(getsysteminformation);
    startcheck-&gt;setObjectName(QString::fromUtf8(&quot;startcheck&quot;));
    startcheck-&gt;setGeometry(QRect(150, 170, 200, 30));
    startcheck-&gt;setAutoDefault(true);
    startcheck-&gt;setFlat(false);
    QObject::connect(startcheck, SIGNAL(clicked()), qApp, SLOT(show()));

    line = new QFrame(getsysteminformation);
    line-&gt;setObjectName(QString::fromUtf8(&quot;line&quot;));
    line-&gt;setGeometry(QRect(10, 250, 470, 3));
    line-&gt;setFrameShape(QFrame::HLine);
    line-&gt;setFrameShadow(QFrame::Sunken);

    label = new QLabel(getsysteminformation);
    label-&gt;setObjectName(QString::fromUtf8(&quot;label&quot;));
    label-&gt;setGeometry(QRect(82, 265, 215, 20));

    QFont font;
    font.setFamily(QString::fromUtf8(&quot;Arial Black&quot;));
    font.setPointSize(12);
    font.setKerning(false);
    font.setStyleStrategy(QFont::PreferAntialias);

    label-&gt;setFont(font);

	textBrowser = new QTextBrowser(getsysteminformation);
    textBrowser-&gt;setObjectName(QString::fromUtf8(&quot;textBrowser&quot;));
    textBrowser-&gt;setGeometry(QRect(15, 10, 470, 150));
    textBrowser-&gt;setFrameShape(QFrame::NoFrame);

    retranslateUi(getsysteminformation);

    QMetaObject::connectSlotsByName(getsysteminformation);
    } // setupUi

    void retranslateUi(QDialog *getsysteminformation)
    {
    getsysteminformation-&gt;setWindowTitle(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Get System Information&quot;, 0, QApplication::UnicodeUTF8));
    textBrowser-&gt;setHtml(QApplication::translate(&quot;getsysteminformation&quot;, &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.0//EN\&quot; \&quot;http://www.w3.org/TR/REC-html40/strict.dtd\&quot;&gt;\n&quot;
&quot;&lt;html&gt;&lt;head&gt;&lt;meta name=\&quot;qrichtext\&quot; content=\&quot;1\&quot; /&gt;&lt;style type=\&quot;text/css\&quot;&gt;\n&quot;
&quot;p, li { white-space: pre-wrap; }\n&quot;
&quot;&lt;/style&gt;&lt;/head&gt;&lt;body style=\&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;\&quot;&gt;\n&quot;
&quot;&lt;p style=\&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\&quot;&gt;This application was created to get as many information about your system as possible. That means for example your OS or your System architecture. But it goes to details like installed Applications etc. You could use this tool to create advanced information about your system for questions in internet forums or something similar, but you can also use it to remember all the configurations in your system if you want to reinstall your system.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&quot;, 0, QApplication::UnicodeUTF8));
    pushButton-&gt;setText(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Exit Program&quot;, 0, QApplication::UnicodeUTF8));
    startcheck-&gt;setText(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Start Systemcheck&quot;, 0, QApplication::UnicodeUTF8));
    label-&gt;setText(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Get System Information&quot;, 0, QApplication::UnicodeUTF8));
    Q_UNUSED(getsysteminformation);
    } // retranslateUi

};

namespace Ui {
    class getsysteminformation: public Ui_getsysteminformation {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_MAIN_H
</code></pre>
<p><strong>ui_readout.h:</strong><br />
Diese Datei ist ja nicht wirklich wichtig, weil sie nur aufgerufen werden soll. Der Dialog hier, der aufgerufen wird, heißt &quot;readout&quot;.</p>
<p>Wichtig sind in der main.cpp die Zeilen, die den Dialog2 deffinieren und in der ui_main.h die Zeile unter dem startcheck-Button, wo das QObject mit dem Signal clicked() verbunden wird.</p>
<p>Vielen Dank schonmal für eure Hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Liebe Grüße,</p>
<p>Jonathan</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/221830/funktionsübergreifende-zugriffe-unter-qt4</link><generator>RSS for Node</generator><lastBuildDate>Mon, 05 Oct 2026 19:36:12 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/221830.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Sep 2008 05:02:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Funktionsübergreifende Zugriffe unter QT4 on Thu, 04 Sep 2008 05:02:08 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Der Threadtitel sagt wenig, klingt dafür professionell: Mir ist leider nichts besseres eingefallen, dafür folgt ja hier jetzt die Beschreibung meines Problems:</p>
<p>Ich habe drei Dateien. Einmal die main.cpp, in dem sich der Hauptquellcode meines Programmes befindet. Dann habe ich noch zwei ui-Dateien, also ui_...1....h und ui_...2....h. Der Aufruf von der ui 1 Datei ist dabei ganz einfach, ich erstelle im Quellcode der main.cpp einfach einen neuen Dialog, der die Informationen aus der ui-Datei nutzt und lasse diesen mit dialog-&gt;show(); anzeigen. Das funktioniert auch. Nur gibt es nun in dieser ersten ui Datei jedoch einen Button, der beim draufklicken einen neuen Dialog öffnen soll, also die zweite ui-Datei. Beide sind natürlich in die main.cpp ordnungsgemäß schon deklariert, nur beim zweiten Dialog habe ich das dialog2-&gt;show() weggelassen, um ihn erst beim Klick auf den Button anzeigen zu lassen. Nun befinden sich der Button und die deklaration des zweiten Dialoges jedoch in Unterschiedlichen Gültigkeitsbereichen und daher funktioniert das ganze nicht so wirklich. Ich habe jetzt schon für 4 Stunden probiert, das irgendwie hinzubasteln, aber es hat partout nicht klappen wollen... Ich vermute mal meine Anwendung ist vom ganzen Konzept her falsch? Was könnte ich besser machen? Kann ich mein Problem doch noch irgendwie direkt lösen? Hier aber erstmal die Dateien:</p>
<p><strong>main.cpp:</strong></p>
<pre><code class="language-cpp">#include &lt;QApplication&gt;
#include &lt;QFont&gt;
#include &lt;QPushButton&gt;
#include &lt;QWidget&gt;
#include &lt;QMetaObject&gt;
#include &lt;iostream&gt;
#include &quot;ui_main.h&quot;
#include &quot;ui_readout.h&quot;

using namespace std;

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QDialog *dialog = new QDialog;
    Ui::getsysteminformation ui;
    ui.setupUi(dialog);
    dialog-&gt;show();
    QDialog *dialog2 = new QDialog;
    Ui::readout ui2;
    ui2.setupUi(dialog2);

    return app.exec();
}
</code></pre>
<p><strong>ui_main.h:</strong></p>
<pre><code class="language-cpp">#ifndef UI_MAIN_H
#define UI_MAIN_H

#include &lt;QtCore/QVariant&gt;
#include &lt;QtGui/QAction&gt;
#include &lt;QtGui/QApplication&gt;
#include &lt;QtGui/QButtonGroup&gt;
#include &lt;QtGui/QDialog&gt;
#include &lt;QtGui/QFrame&gt;
#include &lt;QtGui/QLabel&gt;
#include &lt;QtGui/QPushButton&gt;
#include &lt;QtGui/QTextBrowser&gt;

QT_BEGIN_NAMESPACE

class Ui_getsysteminformation
{
public:
    QPushButton *pushButton;
    QPushButton *startcheck;
    QFrame *line;
    QLabel *label;
    QLabel *information;
    QTextBrowser *textBrowser;

    void setupUi(QDialog *getsysteminformation)
    {
    if (getsysteminformation-&gt;objectName().isEmpty())
        getsysteminformation-&gt;setObjectName(QString::fromUtf8(&quot;getsysteminformation&quot;));
    getsysteminformation-&gt;setFixedSize(500, 300);
    QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(getsysteminformation-&gt;sizePolicy().hasHeightForWidth());
    getsysteminformation-&gt;setSizePolicy(sizePolicy);
    getsysteminformation-&gt;setMouseTracking(false);

    QPalette palette;
    QBrush brush(QColor(255, 255, 255, 0));
    brush.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Base, brush);
    palette.setBrush(QPalette::Inactive, QPalette::Base, brush);
    QBrush brush1(QColor(244, 244, 244, 255));
    brush1.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Disabled, QPalette::Base, brush1);
    getsysteminformation-&gt;setPalette(palette);

    pushButton = new QPushButton(getsysteminformation);
    pushButton-&gt;setObjectName(QString::fromUtf8(&quot;pushButton&quot;));
    pushButton-&gt;setGeometry(QRect(370, 260, 116, 30));
    pushButton-&gt;setAutoDefault(true);
    pushButton-&gt;setFlat(false);
    QObject::connect(pushButton, SIGNAL(clicked()), qApp, SLOT(quit()));

    startcheck = new QPushButton(getsysteminformation);
    startcheck-&gt;setObjectName(QString::fromUtf8(&quot;startcheck&quot;));
    startcheck-&gt;setGeometry(QRect(150, 170, 200, 30));
    startcheck-&gt;setAutoDefault(true);
    startcheck-&gt;setFlat(false);
    QObject::connect(startcheck, SIGNAL(clicked()), qApp, SLOT(show()));

    line = new QFrame(getsysteminformation);
    line-&gt;setObjectName(QString::fromUtf8(&quot;line&quot;));
    line-&gt;setGeometry(QRect(10, 250, 470, 3));
    line-&gt;setFrameShape(QFrame::HLine);
    line-&gt;setFrameShadow(QFrame::Sunken);

    label = new QLabel(getsysteminformation);
    label-&gt;setObjectName(QString::fromUtf8(&quot;label&quot;));
    label-&gt;setGeometry(QRect(82, 265, 215, 20));

    QFont font;
    font.setFamily(QString::fromUtf8(&quot;Arial Black&quot;));
    font.setPointSize(12);
    font.setKerning(false);
    font.setStyleStrategy(QFont::PreferAntialias);

    label-&gt;setFont(font);

	textBrowser = new QTextBrowser(getsysteminformation);
    textBrowser-&gt;setObjectName(QString::fromUtf8(&quot;textBrowser&quot;));
    textBrowser-&gt;setGeometry(QRect(15, 10, 470, 150));
    textBrowser-&gt;setFrameShape(QFrame::NoFrame);

    retranslateUi(getsysteminformation);

    QMetaObject::connectSlotsByName(getsysteminformation);
    } // setupUi

    void retranslateUi(QDialog *getsysteminformation)
    {
    getsysteminformation-&gt;setWindowTitle(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Get System Information&quot;, 0, QApplication::UnicodeUTF8));
    textBrowser-&gt;setHtml(QApplication::translate(&quot;getsysteminformation&quot;, &quot;&lt;!DOCTYPE HTML PUBLIC \&quot;-//W3C//DTD HTML 4.0//EN\&quot; \&quot;http://www.w3.org/TR/REC-html40/strict.dtd\&quot;&gt;\n&quot;
&quot;&lt;html&gt;&lt;head&gt;&lt;meta name=\&quot;qrichtext\&quot; content=\&quot;1\&quot; /&gt;&lt;style type=\&quot;text/css\&quot;&gt;\n&quot;
&quot;p, li { white-space: pre-wrap; }\n&quot;
&quot;&lt;/style&gt;&lt;/head&gt;&lt;body style=\&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;\&quot;&gt;\n&quot;
&quot;&lt;p style=\&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\&quot;&gt;This application was created to get as many information about your system as possible. That means for example your OS or your System architecture. But it goes to details like installed Applications etc. You could use this tool to create advanced information about your system for questions in internet forums or something similar, but you can also use it to remember all the configurations in your system if you want to reinstall your system.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;&quot;, 0, QApplication::UnicodeUTF8));
    pushButton-&gt;setText(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Exit Program&quot;, 0, QApplication::UnicodeUTF8));
    startcheck-&gt;setText(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Start Systemcheck&quot;, 0, QApplication::UnicodeUTF8));
    label-&gt;setText(QApplication::translate(&quot;getsysteminformation&quot;, &quot;Get System Information&quot;, 0, QApplication::UnicodeUTF8));
    Q_UNUSED(getsysteminformation);
    } // retranslateUi

};

namespace Ui {
    class getsysteminformation: public Ui_getsysteminformation {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_MAIN_H
</code></pre>
<p><strong>ui_readout.h:</strong><br />
Diese Datei ist ja nicht wirklich wichtig, weil sie nur aufgerufen werden soll. Der Dialog hier, der aufgerufen wird, heißt &quot;readout&quot;.</p>
<p>Wichtig sind in der main.cpp die Zeilen, die den Dialog2 deffinieren und in der ui_main.h die Zeile unter dem startcheck-Button, wo das QObject mit dem Signal clicked() verbunden wird.</p>
<p>Vielen Dank schonmal für eure Hilfe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Liebe Grüße,</p>
<p>Jonathan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1576213</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1576213</guid><dc:creator><![CDATA[Mefisto]]></dc:creator><pubDate>Thu, 04 Sep 2008 05:02:08 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsübergreifende Zugriffe unter QT4 on Thu, 04 Sep 2008 05:20:53 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">QObject::connect(startcheck, SIGNAL(clicked()), qApp, SLOT(show()));
</code></pre>
<p>QApplication hat keinen show() slot. da muss der zeiger der instance deines zweiten dialoges rein. desweiteren sollte man keinen eigen code in die ui_&lt;&gt;.h header, die von uic erzeugt werden schreiben. lieber subclassen, ui.setupUI() dann vom konstruktor der abgeleiteten klasse aufrufen. also eben folgendes standard qt layout:</p>
<p>form.ui</p>
<pre><code class="language-cpp">// vom ui designer erstellt
</code></pre>
<p>form.h</p>
<pre><code class="language-cpp">#include &quot;ui_form.h&quot;

//member deklarationen, slots und krams
</code></pre>
<p>form.cpp</p>
<pre><code class="language-cpp">#include &quot;form.h&quot;

form::form()
{
    ui.setupUI(this);
}

// definitionen des anderen kram
</code></pre>
<p>main.cpp</p>
<pre><code class="language-cpp">#include &quot;form.h&quot;

form mainwindow;
mainwindow.show();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1576218</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1576218</guid><dc:creator><![CDATA[sothis_]]></dc:creator><pubDate>Thu, 04 Sep 2008 05:20:53 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsübergreifende Zugriffe unter QT4 on Thu, 04 Sep 2008 12:46:09 GMT]]></title><description><![CDATA[<p>Hm, irgendwie bekomme ich es einfach noch hin... Ich habe das ganze jetzt so umgeändert:</p>
<p><strong>main.cpp:</strong></p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &quot;main.h&quot;
#include &quot;ui_readout.h&quot;

maindialog::maindialog( QDialog * parent, Qt::WFlags f)
    : QDialog(parent, f)
{
    setupUi(this);
    connect(pushbutton, SIGNAL(clicked()), this, SLOT(quit()));
}
</code></pre>
<p><strong>main.h:</strong></p>
<pre><code class="language-cpp">#ifndef MAIN_H
#define MAIN_H

#include &quot;ui_main.h&quot;

class maindialog : public QDialog, public Ui::getsysteminformation
{
Q_OBJECT
    public:
        getsysteminformation( QDialog * parent = 0, Qt::WFlags f = 0 );
};
#endif
</code></pre>
<p><strong>ui_main.h:</strong><br />
Der Inhalt ist exakt der selbe wie oben, hier hat sich also nichts geändert...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1576477</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1576477</guid><dc:creator><![CDATA[Mefisto]]></dc:creator><pubDate>Thu, 04 Sep 2008 12:46:09 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsübergreifende Zugriffe unter QT4 on Thu, 04 Sep 2008 13:58:55 GMT]]></title><description><![CDATA[<p>QDialog hat keinen quit() Slot. Meinst du da nicht eher qApp?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1576504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1576504</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 04 Sep 2008 13:58:55 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsübergreifende Zugriffe unter QT4 on Thu, 04 Sep 2008 15:14:20 GMT]]></title><description><![CDATA[<p>Jojo, hat sich erledigt, habe das jetzt hinbekommen... Habe allerdings ein neues Problem. Also hier mal mein Aufbau:</p>
<p>main.cpp -&gt; ruft Dialog1 auf, also mein Hauptfenster<br />
Dialog 1 ist deffiniert in &quot;main.h&quot;<br />
Dialog 2 ist deffiniert in &quot;readout.h&quot;<br />
In Dialog 1 befindet sich ein Button, der Dialog 2 per funktion aufruft. Das ganze sieht so aus:</p>
<pre><code class="language-cpp">#include &lt;QtGui&gt; 
#include &lt;QDialog&gt;
#include &quot;main.h&quot;
#include &quot;readout.h&quot;

maindialog::maindialog(QDialog *parent)
{
	setupUi(this); // this sets up GUI

    // signals/slots mechanism in action
    connect(pushButton, SIGNAL(clicked()), this, SLOT(quit()));
    connect(startCheck, SIGNAL(clicked()), this, SLOT(show()));
}

readout::readout(QDialog *parent)
{
	setupUi(this); // this sets up GUI

    // signals/slots mechanism in action
    connect(pushButton, SIGNAL(clicked()), this, SLOT(close()));
}

void maindialog::show()
{
	readout *dialog2 = new readout;
	dialog2-&gt;show();
}
</code></pre>
<p>Jedoch wird aus irgendeinem Grund sofort die Funktion beim start aufgerufen, das heißt es wird nicht gewartet, bis der User den Knopf drückt und dadurch die Funktion &quot;show()&quot; auslöst. Es wird also unmittelbar &quot;dialog2&quot; angezeigt, nicht das Hauptfenster. Weiß einer woran das liegen könnte? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1576585</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1576585</guid><dc:creator><![CDATA[Mefisto]]></dc:creator><pubDate>Thu, 04 Sep 2008 15:14:20 GMT</pubDate></item><item><title><![CDATA[Reply to Funktionsübergreifende Zugriffe unter QT4 on Thu, 04 Sep 2008 15:38:53 GMT]]></title><description><![CDATA[<p>hat sich erledigt, habe gesehen, dass ich die normale qdialog show-funktion überschrieben habe <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1576608</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1576608</guid><dc:creator><![CDATA[Mefisto]]></dc:creator><pubDate>Thu, 04 Sep 2008 15:38:53 GMT</pubDate></item></channel></rss>