Try adding #include <qtable.h> at the beginning of a file with that connect statement.
Try adding #include <qtable.h> at the beginning of a file with that connect statement.
Thanks, but that didn't work.Originally Posted by jacek
I made this file with the designer and I have a default QTable in a widgetstack.
When the right things happens that default table is set by another table like this:
tbl = (QTable *)_rs.reg("string","string");reg(...) is returning an object which inherit QTable, hence the casting.
I then set the name for tbl:
tbl->setName("tbl");Then I connect the tbl and remove the default page in the widgetstack and add the tbl, like this:
_widStack->removeWidget(_widStack->widget(2));
_widStack->addWidget(tbl,2);
_widgStack->raiseWidget(tbl);
Can you see something wrong about this - is there something I'm missing?
Chaimar...
Try using only "QPoint" within the SIGNAL/SLOT macros instead of "const QPoint&". Those decorations are not needed there, only the plain type.
Could you post the line in which you declare that tbl variable?
Isn't there a space in "const" in the signal signature? And be sure you have that qtable.h included.QObject::connect(tbl,SIGNAL(clicked(int,int,int,co nst QPoint&)),this,SLOT(registerDblKlikket(int,int,int ,const QPoint&)));
BTW. The "decorations" are important :)
The header qtable.h need not be included unless you call methods of QTable somewhere else in the file. You're right about the co nst though.Originally Posted by wysota
There is one more situation when the header file is needed -- to check if the class inherits some other class, for example:Originally Posted by Chicken Blood Machine
Qt Code:
connect(someclass, SIGNAL(x()), this, SLOT(y)));To copy to clipboard, switch view to plain text mode
The header file for "someclass" is needed for the compiler to see if it inherits QObject.
Good point, yes you're right.Originally Posted by wysota
wysota:I didn't use copy-paste on that sentence, there's no space in the code. My mistake
![]()
I have included the qtable.h too.
seneca:I tried using just QPoint, but it didn't make any difference.
Here's the declaration of the tbl, which the designer has made:
tbl = new QTable( privateLayoutWidget_2, "tbl" );
tbl->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,0, 0, tbl->sizePolicy().hasHeightForWidth() ) );
tbl->setMinimumSize( QSize( 1150, 330 ) );
tbl->setMaximumSize( QSize( 1450, 750 ) );
tbl->setNumRows( 3 );
tbl->setNumCols( 12 );
next part where something happens to the tbl is, like I mentioned earlier today:
I've made a similar signal-slot call in designer with another table in this file and it is name-similar slot, could that cause any problem?I made this file with the designer and I have a default QTable in a widgetstack.
When the right things happens that default table is set by another table like this:
tbl = (QTable *)_rs.reg("string","string");
reg(...) is returning an object which inherit QTable, hence the casting.
I then set the name for tbl:
tbl->setName("tbl");
Then I connect the tbl and remove the default page in the widgetstack and add the tbl, like this:
_widStack->removeWidget(_widStack->widget(2));
_widStack->addWidget(tbl,2);
_widgStack->raiseWidget(tbl);
Last edited by chaimar; 24th January 2006 at 18:06.
Are you sure that this returns a QTable object?Originally Posted by chaimar
What does this print?Qt Code:
tbl = (QTable *)_rs.reg("string","string"); qDebug( "tbl is a %s", tbl->className() );To copy to clipboard, switch view to plain text mode
jacek wrote:
Are you sure that this returns a QTable object?I'm so sorry, I'm very, very sorry
.
Big mistake here, I tried to write out the classname as you said jacek, and it seemed that, what I thougt was a QTable, returned a QWidget.
Damn it, I'm mad at myself...
Jacek and wysota, I'm truly sorry that I took up your time with this bad thread, but thank you anyway. I'm might be wandering in the darkness for a long time otherwise.
Well it returned a QWidget and the main widget in that class is a QTable and thats the table I really want.
Do you guys have any idea how I should accomplish this. There is obvious no use casting it to a QTable like I did:
tbl = (QTable *)_rs.reg("string","string");I can of course try to return just the table I want![]()
I write before I think.
Thank you very much guys, I will search my code an extra time before I next time send a question.
Yours sincerely
Chaimar
Don't worry, it is most important that you learnt something from it and that you know what the problem was. We don't consider time spent on your question wasted. We're here to answer questions, right?Originally Posted by chaimar
![]()
Bookmarks