Hi, all:
Is it possible to overwrite Qt slot?
For instance:
CFather:
{
Q_OBJECT
.....
protected slots:
void about();
}
void CFather::about()
{
"Father",
"......");
}
class CFather : public QMainWindow
{
Q_OBJECT
.....
protected slots:
void about();
}
void CFather::about()
{
QMessageBox::information(this,
"Father",
"......");
}
To copy to clipboard, switch view to plain text mode
CSon:
class CSon : public CFather
{
Q_OBJECT
.....
protected slots:
void about();
}
void CSon::about()
{
"Son",
"......");
}
class CSon : public CFather
{
Q_OBJECT
.....
protected slots:
void about();
}
void CSon::about()
{
QMessageBox::information(this,
"Son",
"......");
}
To copy to clipboard, switch view to plain text mode
I just want to realize:
A CFather object will call CFather::about() when the menu item "about" is invoked.
A CSon object will call CSon::about() when the menu item "about" is invoked.
(Note: CFather and CSon are almost the same QMainWindow with only a little bit modification.
But, I just want the about() will invoke two different dialogs, with clear indication that this is a "Son" or a "Father" window)
I tried "virtual" already, but whenever I clicked "OK" on the poped CSon:about() QMessageBox, it will CSon QMessageBox once again. That is to say, I've got to click "OK" twice to close QMessageBox thoroughly.
How to deal with this problem?
Best Regards
JIA
Bookmarks