[Qt-interest] Fwd: problem with signal of QListWidget
mierdatutis mi
mmm286 at gmail.com
Tue Jun 23 07:12:36 CEST 2009
So...
If I would like to put some text in a objet that I have in the mainwindow
(for instance in the textEdit) I must write the code in the function:
MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
: QMainWindow(parent, f)
I can't wirite in a function?
Many thanks!!!
2009/6/22 mierdatutis mi <mmm286 at gmail.com>
> Many thanks Stephen!!!!!!
>
> It works!
>
> So, I have 2 objects QListWidget that they are named Lista. One in my
> MainWindowImp and other in the function main(). Well I thought that it was
> the same where I declared the object lista. So for I can populate the
> contents of a directory in the object "Lista" of my MainWindow I must write
> the code in the function MainWindowImp and not in the main function.
>
>
> Many thanks, I've learned a lot, I try with a manual but it's very
> difficult.
>
> Regards
>
>
>
>
> 2009/6/22 Stephen Jackson <spjackson42 at gmail.com>
>
> On Mon, Jun 22, 2009 at 6:12 AM, mierdatutis mi wrote:
>> > Sorry Stephen
>> >
>> > I'm newbie and I havent realised.
>> > The ui have:
>> >
>> > object:Mainwindow Class:QMainWindow
>> > object centralwidget: class: QWidget
>> > object: boton class QPushButton
>> > object: lista class QListWidget
>> > object: text class QTextEdit
>> >
>> > I attach the ui file
>> >
>> > Many thanks!!!!
>> > Regards
>> >
>> >
>>
>> Thanks. Now we have all the relevant source, we can see what is going on.
>>
>> When your application runs, 3 top level windows are shown, each of
>> which is created in main() thus.
>> MainWindowImpl win;
>> QTextEdit text;
>> QListWidget lista;
>>
>> In main() you populate this lista with the contents of a directory.
>>
>> Your MainWindowImpl has a number of child widgets, one of which is a
>> QListWidget called "lista". This lista contains no items and this is
>> the one that you are connecting your slot to. If you add some items to
>> it and click one of these, then your cambio() slot is indeed called.
>> e.g.
>>
>> MainWindowImpl::MainWindowImpl( QWidget * parent, Qt::WFlags f)
>> : QMainWindow(parent, f)
>> {
>> setupUi(this);
>> lista->addItem("This");
>> lista->addItem("is");
>> lista->addItem("MainWindowImpl::lista");
>> connect(boton, SIGNAL(clicked()), this, SLOT(sinopsis()));
>> connect(lista, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT(
>> cambio(QListWidgetItem*) ) );
>> }
>>
>> I hope this helps you solve this problem.
>>
>> Regards,
>>
>> Stephen Jackson
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090623/c336eaab/attachment.html
More information about the Qt-interest-old
mailing list