<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    Oh you are right, sorry<br>
    <br>
    I didn't refactor the "quit_action" part : <br>
    <br>
    dialog.connect(quit_action, SIGNAL("triggered()"), app,
    SLOT("quit()"));    <br>
    quit_action.connect(quit_action, SIGNAL("triggered()"), app,
    SLOT("quit()"));    <br>
    -> Segmentation Fault<br>
    <br>
    quit_action.triggered.connect(quit)<br>
    -> fixes the problem<br>
    <br>
    Even if I don't understand where the "quit" function come from lol.<br>
    <br>
    Thanks a lot !!!<br>
    <br>
    Cyril.<br>
    <br>
    <br>
    <br>
    Le 20/09/2010 13:06, Vincent Vande Vyvre a écrit :
    <blockquote cite="mid:4C974044.3030502@swing.be" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <title></title>
      Le 20/09/10 11:42, Cyril Giraudon a écrit :
      <blockquote cite="mid:4C972C8F.70502@free.fr" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        Modifications in the code don't make things nicer :-( :<br>
        <br>
        Sorry for not reporting the system characteristics :<br>
        <br>
        (sandbox)cyril@CGN-L: pyqt$ python example.py <br>
        Platform :  Linux-2.6.32-24-generic-i686-with-Ubuntu-10.04-lucid<br>
        Machine :  i686<br>
        Qt version :  4.6.2<br>
        PyQt version :  4.7.2<br>
        Just after exec_ ...<br>
        Erreur de segmentation<br>
        <br>
        I note the same behaviour on x86_64-with-Ubuntu-10.04-lucid<br>
        <br>
        Regards,<br>
        <br>
        Cyril.<br>
        <br>
        <br>
        <br>
        Le 20/09/2010 11:04, Vincent Vande Vyvre a écrit :
        <blockquote cite="mid:4C9723B1.9040003@swing.be" type="cite">
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          <title></title>
          Le 20/09/10 10:07, Cyril Giraudon a écrit :
          <blockquote cite="mid:4C971642.3040102@free.fr" type="cite"> Hello,

            <br>
            <br>
            I am a PyQt newbye and I wanted to do some tests with
            QToolBar in a
            QDialog (Seems multiple QMainWindow use is not recommanded
            in a
            QApplication), so I started coding a simple example
            (reported below). <br>
            <br>
            The code seems correct but it terminates with a segmentation
            fault when
            the QUIT button is pressed : <br>
            <br>
            """"""""""""""""""""""""""""""""""""" <br>
            (sandbox)cyril@CGN-L: pyqt$ python example.py <br>
            Qt version :  4.6.2 <br>
            PyQt version :  4.7.2 <br>
            Erreur de segmentation <br>
            """"""""""""""""""""""""""""""""""""" <br>
            <br>
            I don't understand what happens. <br>
            Is there any explanation ? <br>
            <br>
            Thanks a lot, <br>
            <br>
            Cyril. <br>
            <br>
            <br>
            """"""""""""""""""""""""""""""""" <br>
            example.py source code <br>
            """"""""""""""""""""""""""""""""" <br>
            # -*- coding: utf8 -*- <br>
            <br>
            import sys <br>
            <br>
            from PyQt4.QtCore import SIGNAL, SLOT, QT_VERSION_STR,
            PYQT_VERSION_STR <br>
            from PyQt4.QtGui import (QApplication, QDialog, QVBoxLayout,
            <br>
                                     QToolBar, QAction, QLabel) <br>
            <br>
            if __name__=='__main__': <br>
                print "Qt version : ", QT_VERSION_STR <br>
                print "PyQt version : ", PYQT_VERSION_STR <br>
            <br>
                app = QApplication(sys.argv) <br>
            <br>
                dialog = QDialog() <br>
                dialog.setWindowTitle(u"Bye bye") <br>
            <br>
                layout = QVBoxLayout(dialog) <br>
            <br>
                toolbar = QToolBar() <br>
            <br>
                label = QLabel("Hello World!") <br>
                def say_bye(): <br>
                    label.setText("Bye Bye") <br>
                bye_action = QAction("Bye bye", dialog,
            triggered=say_bye) <br>
                toolbar.addAction(bye_action) <br>
            <br>
                quit_action = QAction("Quit", dialog) <br>
                dialog.connect(quit_action, SIGNAL("triggered()"), <br>
                               app, SLOT("quit()")); <br>
                toolbar.addAction(quit_action) <br>
            <br>
                layout.addWidget(toolbar) <br>
                layout.addWidget(label) <br>
            <br>
                dialog.show() <br>
                app.exec_() <br>
            """"""""""""""""""""""""""""""""""""""""" <br>
            _______________________________________________ <br>
            PyQt mailing list    <a moz-do-not-send="true"
              class="moz-txt-link-abbreviated"
              href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
            <br>
            <a moz-do-not-send="true" class="moz-txt-link-freetext"
              href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
            <br>
            <br>
          </blockquote>
          Salut,<br>
          <br>
          Change these lines:<br>
          <br>
              bye_action = QAction("Bye bye", dialog)<br>
              bye_action.triggered.connect(say_bye)<br>
              toolbar.addAction(bye_action)<br>
          <br>
              quit_action = QAction("Quit", dialog)<br>
              quit_action.triggered.connect(quit)<br>
              toolbar.addAction(quit_action)<br>
          <br>
          and this one:<br>
          <br>
              sys.exit(app.exec_())  <br>
          <br>
          Cheers<br>
          <br>
          <div class="moz-signature">-- <br>
            Vincent V.V.<br>
            <a moz-do-not-send="true" href="https://launchpad.net/oqapy">Oqapy</a></div>
          <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list    <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
        </blockquote>
        <br>
        <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list    <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
      </blockquote>
      It's strange, After the changes I do not have any more errors<br>
      <br>
      I'm under Lucid 32b<br>
      <br>
      vincent@tiemoko:~/Bureau$ python bye.py <br>
      Qt version :  4.6.2<br>
      PyQt version :  4.7.2<br>
      vincent@tiemoko:~/Bureau$<br>
      <br>
      <div class="moz-signature">-- <br>
        Vincent V.V.<br>
        <a moz-do-not-send="true" href="https://launchpad.net/oqapy">Oqapy</a></div>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list    <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
    </blockquote>
    <br>
  </body>
</html>