Hi, im having the same sort of problem with a QLineEdit. The compiler succesfully compile the project and when you try to change a property of QLineEdit it ends in a segmentation fault... here is my code
ojimetro.cpp
Qt Code:
  1. #include <QLabel>
  2. #include <QTextLine>
  3. #include <QtGui>
  4. //#include <QLineEdit>
  5. #include "ojimetro.h"
  6.  
  7.  
  8.  
  9. Window::Window()
  10. {
  11. setFixedSize(800, 600);
  12.  
  13.  
  14. QPushButton *salir = new QPushButton(tr("Salir"), this);
  15. // salir->setGeometry(1, 1, 75, 30);
  16. salir->setFont(QFont("Times", 18, QFont::Bold));
  17. QPushButton *probar = new QPushButton(tr("Probar"), this);
  18. //probar->setGeometry(76, 1, 75, 30);
  19. probar->setFont(QFont("Times", 18, QFont::Bold));
  20. QLabel *viendo=new QLabel(tr("viendo"),this);
  21. //viendo->setGeometry(150,1,40,40);
  22. QLineEdit *lineat=new QLineEdit("casa",this);
  23.  
  24.  
  25.  
  26.  
  27. connect(salir, SIGNAL(clicked()), qApp, SLOT(quit()));
  28. connect(probar,SIGNAL(clicked()),this,SLOT(copia()));
  29. //renderArea->setGeometry(90,100,350,200);
  30. QGridLayout *mainLayout = new QGridLayout;
  31. mainLayout->setColumnStretch(0, 1);
  32. mainLayout->setColumnStretch(3, 1);
  33. mainLayout->addWidget(renderArea, 0, 0, 1, 4);
  34. mainLayout->setRowMinimumHeight(1, 6);
  35. mainLayout->addWidget(viendo, 2, 1, Qt::AlignRight);
  36. mainLayout->addWidget(lineat, 2, 2);
  37. mainLayout->addWidget(salir, 3, 1, Qt::AlignRight);
  38. mainLayout->addWidget(probar, 3, 2);
  39.  
  40.  
  41.  
  42. setLayout(mainLayout);
  43. //renderArea->adjustSize();
  44. //dato=lineat->text();
  45.  
  46.  
  47. setWindowTitle(tr("Ojimetro v0.1"));
  48.  
  49.  
  50. }
  51.  
  52. void Window::copia()
  53. {
  54. int a,b,c;
  55. QString texto1;
  56. int poin;
  57.  
  58.  
  59.  
  60. a=1;
  61.  
  62. //texto1=lineat->text();
  63. //this->lineat->setText("oo");
  64. //qDebug() << this->lineat->text();
  65. b=2;
  66. c=0;
  67.  
  68. lineat->setText("hola!!!");
  69. c=a+b;
  70. a=2;
  71.  
  72.  
  73.  
  74. }
To copy to clipboard, switch view to plain text mode 
when im debugging, the debugger stops at lineat->setText("hola!!!") and shows the segmentation fault
ojimetro.h

Qt Code:
  1. #ifndef OJIMETRO_H
  2. #define OJIMETRO_H
  3. #include <QTextLine>
  4. #include <QWidget>
  5. #include <QObject>
  6. QT_BEGIN_NAMESPACE
  7. class QCheckBox;
  8. class QLineEdit;
  9. class QComboBox;
  10. class QLabel;
  11. class QSpinBox;
  12. class QTextLine;
  13. QT_END_NAMESPACE
  14.  
  15.  
  16.  
  17. class Window : public QWidget
  18. {
  19. Q_OBJECT
  20. public:
  21.  
  22. Window();
  23.  
  24. public slots:
  25. void copia();
  26.  
  27.  
  28. public:
  29. QLineEdit *lineat;
  30. #endif // OJIMETRO_H
  31. };
To copy to clipboard, switch view to plain text mode 




gbd reports this...

Program received signal SIGSEGV, Segmentation fault.
0x009b54e5 in QLineEdit::setText (this=0x3e4be8, text=@0x22cee8)
at widgets\qlineedit.cpp:383
383 widgets\qlineedit.cpp: No such file or directory.
in widgets\qlineedit.cpp


i forgot to say what im trying to do.. The idea is just to get the text of the QLineEdit, in this code, im setting the text but it does the same error. thanks in advance!