PDA

View Full Version : setLabel in QprogressDialog



mickey
11th July 2006, 21:31
hi, I create a progress dialog from disigner and subclassedit; then I need set its label but the error below occur...why this?


myProgressDialog* progress = new myProgressDialog (steps, this, "progress", TRUE );
QLabel* l = new QLabel ("progress", 0);
progress->setLabel(l);
error C2039: 'setLabel' : is not a member of 'myProgressDialog'


...also other members get same error.....

jacek
11th July 2006, 22:22
How did you define that subclass? Maybe you forgot to add "public" before the superclass name?

mickey
12th July 2006, 00:26
class myProgressDialog : public progressDialog {
Q_OBJECT
public:
myProgressDialog(int steps, QWidget* creator=0, const char* name=0, bool modal=FALSE, WFlags f =0);
~myProgressDialog();
};

jacek
12th July 2006, 00:36
What is that progressDialog class? If it was generated by uic from .ui file, then it only contains member variables (public, AFAIR) named in the same way as in Qt Designer --- just see the header generated by uic.

mickey
12th July 2006, 10:11
progressDialog.h in ui directory is a class that inherit from QDialog and not from QProgressDialog..is this problem? I designed a dialog called progressDialog from designer;but I'd ike design it and make it inherit from QProgressDialog. What do I have to do? How do I change it? Do you understand what I'd like do? thanks

jacek
12th July 2006, 11:19
progressDialog.h in ui directory is a class that inherit from QDialog and not from QProgressDialog..is this problem?
Yes, your class is a QDialog not a QProgressDialog, so you can't use QProgressDialog's methods.


but I'd ike design it and make it inherit from QProgressDialog. What do I have to do? How do I change it?
Unfortunately you can't design custom dialog that inherits from QProgressDialog, because QProgressDialog creates its own layout. Either create your own dialog that behaves like QProgressDialog or customize QProgressDialog using setBar(), setCancelButton() and setLabel() methods.