June 23, 2011

Ruzik Ruzik
Lab Rat
293 posts

Problem with transform of pointer

 

I have parent class and widget, and in class of this widget i write

  1.  RizekColorManager * rcm;
  2.     rcm = qobject_cast<RizekColorManager*>(parent());
  3.     if (rcm)
  4.         rcm->setWindowTitle("asd");

There no some mistakes, but there are doesnt work, why?
Advance thanks for your help!

4 replies

June 23, 2011

Denis Kormalev Denis Kormalev
Lab Rat
1654 posts

Are you sure that parent of your widget is RizekColorManager instance?

June 24, 2011

steno steno
Ant Farmer
239 posts

RizekColorManager has to derive or indirectly derive from QObject and must also have the Q_Object macro according to Qt Assistant.

June 24, 2011

Franzk Franzk
Lab Rat
837 posts

For a widget, parent has to be a widget. The problem is probably that the parent widget is not actually the expected RizekColorManager.

 Signature 

“Horse sense is the thing a horse has which keeps it from betting on people.”—W.C. Fields

http://www.catb.org/~esr/faqs/smart-questions.html

June 24, 2011

Ruzik Ruzik
Lab Rat
293 posts

Many thanks for your help, I did not consider object CentralWidget

 
  ‹‹ [Solved] QML files and JPG image in QRC      [Solved] Display QTableView in QTabWidget or QWidget ››

You must log in to post a reply. Not a member yet? Register here!