i allready tried yours but i got a error like
error:request for member 'exec' in 'ca', which is of non-class type 'formCari'
i allready tried yours but i got a error like
error:request for member 'exec' in 'ca', which is of non-class type 'formCari'
The only difference to your example is that I allocated the dialog on the stack. A modal dialog is one of the cases where it is acceptable to allocate a QWidget on the stack. QDialog::exec() blocks as long as the modal dialog is accepted/rejected.
I assumed that "formCari" is a subclass of QDialog. You have used exec():
So isn't "formCari" a subclass of QDialog? Or did you just mix operators "." and "->" up or even forget an include statement?
Last edited by jpn; 20th January 2007 at 19:06. Reason: spelling error
J-P Nurmi
We have solved the problem thank you very much,
We have tried to change some codes
connect(tableCariler, SIGNAL(doubleClicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));
void slotCarilerEdit(const QModelIndex qm)
{
formCari *ce = new formCari(this, qm.sibling(qm.row(),0).data().toString());
ce->exec();
return;
}
Now we would like to do something else with this table. We would like to select something from the the table and send it to slotCarilerEdit with a push button. Any suggestion that we could use?
In Qt, how do you act in general to a button click? The answer is; signals and slots.
J-P Nurmi
Yes, we know about the signals and slots but, is it possible to select from table?
To tell more,
for the doubleClick
connect(tableCariler, SIGNAL(doubleClicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));
the signal starts from tableCariler
we dont know how to connect tablecariler with a push button so that it will take the QModelIndex from tableCariler?
Last edited by aekilic; 24th January 2007 at 11:51.
Maybe you could rely on the fact that the modal formCari dialog was shown when the user double clicked on some certain item. So as long as the dialog is blocking the users input, the same item remains active in the table view.
So maybe you could just connect to the clicked() signal and act in the view according to the current index.
J-P Nurmi
But if we say we have a slot like this
connect(pushInceleCari, SIGNAL(clicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));
how could program could understand that there should be link between table and button?
You cannot do this. You cannot add random parameter types to signals. QPushButton offers a signal clicked(), not clicked(QModelIndex).
Qt Code:
connect(pushInceleCari, SIGNAL(clicked()), parent, SLOT(doSomething())); void doSomething() { ... }To copy to clipboard, switch view to plain text mode
J-P Nurmi
Bookmarks