Article View: es.comp.os.linux.programacion
Article #8257Perdido en KDE
From: juan
Date: Wed, 04 Dec 2002 18:29
Date: Wed, 04 Dec 2002 18:29
49 lines
2158 bytes
2158 bytes
Hola a todos
Estoy intentando aprender un poco de programaci�n en KDE y tengo bastantes problemas en avanzar un poco.
El problema es el siguiente si intento acceder a un widget fuera del constructor me da error cuando se ejecuta el programa.
El siguiente programa se compila bien sin errores, cuando se ejecuta va bien hasta que se pulsa el boton cancelar y se intenta ejecutar la orden:
texto1->setText(QString("hola"));
entonces se produce la salida del programa con un error.
Si le quitas esta linea el programa funciona bien.
Es curioso porque la misma linea se ejecuta en el constructor sin problemas.
�No se puede acceder si no es dentro del constructor?
Ayuda.........
Gracias
JUAN
#include <qtextview.h>
#include <kapp.h>
#include <qhbox.h>
#include <qpushbutton.h>
#include <qcombobox.h>
#include <qspinbox.h>
#include <qlabel.h>
#include "pru2.h"
Pru2::Pru2(QWidget *parent, const char *name) : QWidget(parent, name)
{
QHBox *vcaja=new QHBox(this);
QLabel *texto1=new QLabel (vcaja);
texto1->setText(QString("hola"));
QPushButton *salir=new QPushButton(vcaja,"ok");
salir->setText("SALIR");
connect(salir,SIGNAL(clicked()),this,SLOT(boton_cancelar()));
}
Pru2::~Pru2()
{
}
void Pru2::boton_cancelar()
{
texto1->setText(QString("hola"));
}
Technical Details
Message-ID:
<aslhgl$rm8s0$1@ID-142383.news.dfncis.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!81.0.46.87!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,843253a356f42382,start X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2002-12-04 10:28:42 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!81.0.46.87!not-for-mail From: "juan" <SETASETA@inicia.es> Newsgroups: es.comp.os.linux.programacion Subject: Perdido en KDE Date: Wed, 04 Dec 2002 19:29:37 +0100 Lines: 49 Message-ID: <aslhgl$rm8s0$1@ID-142383.news.dfncis.de> NNTP-Posting-Host: 81.0.46.87 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 X-Trace: fu-berlin.de 1039026521 29041536 81.0.46.87 (16 [142383]) User-Agent: Pan/0.13.0 (The whole remains beautiful)