[Qt-interest] QtableWidget

Andre Somers andre at familiesomers.nl
Tue Mar 16 08:12:05 CET 2010


Hi,

I see your problem now, yes. Thanks for the clarification.

I think there is something wrong with this example. It connects to that 
slot, but I really don't see where it comes from, or what it is supposed 
to do. table() returns a QTable pointer, but QTable nor it's derived 
Table class has a doValueChanged() slot defined, according to the 
documentation and the code you pointed to.

As it turns out, doValueChanged() is a private slot and thus not 
documented (see q3table.h, line 461 and q3table.cpp on line 3773 in 
version 4.6.2). It just emits valueChanged with the right row and column 
number. You can call it because slots don't adhere to the 
private/protected/public rules. They are all public.

IMHO, it is a bug that a reference to that slot is used in an example. 
However, since you now know what the method does, it's not that hard to 
emulate anymore I think :-) You can connect a signal to a signal in 
another object, and that signal will then be emitted. Or, if you use a 
subclass of QTableWidget, you can emit the signal directly. Or you can 
emit it through QMetaObject.

HTH,

André

Qrikg wrote:
> Please check http://doc.trolltech.com/3.0/statistics-example.html
>
> The createEditor() method connects
>     QObject::connect( cb, SIGNAL( activated( int ) ), table(), SLOT( 
> doValueChanged() ) );
>
> We have similar code in our project,but now we are using QTableWidget 
> instead of Q3Table.But we couldn;t find any slot similar to 
> doValueChanged().Hope you got my problem.
>
> --- On *Mon, 3/15/10, Andre Somers /<andre at familiesomers.nl>/* wrote:
>
>
>     From: Andre Somers <andre at familiesomers.nl>
>     Subject: Re: [Qt-interest] QtableWidget
>     To: "Qt-interest" <qt-interest at trolltech.com>
>     Date: Monday, March 15, 2010, 9:58 AM
>
>     Qrikg wrote:
>     >
>     > Its a private slot,which emits valueChanged() signal.
>     >
>     You mean it is private in Qt? In that case, you should not be
>     supprised
>     that it breaks. Or is it private in your own code? If you don't
>     tell us
>     what it does, how can we tell you how to achieve that function with
>     QTableWidget?
>     Really, you do need to give enough context to enable us to actually
>     answer your query. Be explicit in what you want to know, and what the
>     problem is you are running into.
>
>     André
>
>     > --- On *Sat, 3/13/10, André Somers /<andre at familiesomers.nl
>     </mc/compose?to=andre at familiesomers.nl>>/* wrote:
>     >
>     >
>     >     From: André Somers <andre at familiesomers.nl
>     </mc/compose?to=andre at familiesomers.nl>>
>     >     Subject: Re: [Qt-interest] QtableWidget
>     >     To: qt-interest at trolltech.com
>     </mc/compose?to=qt-interest at trolltech.com>
>     >     Date: Saturday, March 13, 2010, 1:02 PM
>     >
>     >     Looking at the docs, I don’t see a doValueChanged() slot in
>     >     Q3Table. There only is a valueChanged() signal. Could you
>     clarify
>     >     what it is you want to know?
>     >
>     >     
>     >
>     >     André
>     >
>     >     
>     >
>     >     
>     >
>     >     *Van:* qt-interest-bounces at trolltech.com
>     </mc/compose?to=qt-interest-bounces at trolltech.com>
>     >     [mailto:qt-interest-bounces at trolltech.com
>     </mc/compose?to=qt-interest-bounces at trolltech.com>] *Namens *Qrikg
>     >     *Verzonden:* zaterdag 13 maart 2010 12:03
>     >     *Aan:* qt-interest at trolltech.com
>     </mc/compose?to=qt-interest at trolltech.com>
>     >     *Onderwerp:* [Qt-interest] QtableWidget
>     >
>     >     
>     >
>     >     Which is the function similar to Q3Table::doValueChanged() in
>     >     QTableWidget?
>     >
>     >     
>     >
>     >     Our old code is
>     >
>     >     "QObject::connect( pCb, SIGNAL( textChanged( const QString &
>     ) ),
>     >     table(), SLOT( doValueChanged() ) );"
>     >
>     >     
>     >
>     >     Now we are using QtableWidget instead of Q3Table.
>     >
>     >     
>     >
>     >     Thanks.
>     >
>     >     
>     >
>     >
>     >     -----Inline Attachment Follows-----
>     >
>     >     _______________________________________________
>     >     Qt-interest mailing list
>     >     Qt-interest at trolltech.com
>     </mc/compose?to=Qt-interest at trolltech.com>
>     </mc/compose?to=Qt-interest at trolltech.com
>     </mc/compose?to=Qt-interest at trolltech.com>>
>     >     http://lists.trolltech.com/mailman/listinfo/qt-interest
>     >
>     >
>
>     _______________________________________________
>     Qt-interest mailing list
>     Qt-interest at trolltech.com </mc/compose?to=Qt-interest at trolltech.com>
>     http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>




More information about the Qt-interest-old mailing list