Page 2 of 2 FirstFirst 12
Results 21 to 22 of 22

Thread: Subclass Problem

  1. #21
    Join Date
    Jan 2011
    Posts
    42
    Thanks
    8
    Qt products
    Qt4 Qt/Embedded

    Default Re: Subclass Problem

    Qt Code:
    1. int main(int argc, char *argv[]){
    2. QApplication a(argc, argv);
    3. Text w;
    4. w.show();
    5. return a.exec();
    6. }
    To copy to clipboard, switch view to plain text mode 
    This is where the error i am gettting from main.cpp.
    I was creating a textEdit by code not in designer form ,like this
    Qt Code:
    1. textEdit = new QTextEdit(this);
    To copy to clipboard, switch view to plain text mode 
    I just want to know how to promote the custom MyTextEdit(which inherits QTextEdit) class to texEdit area....

  2. #22
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Subclass Problem

    I was creating a textEdit by code not in designer form ,like this
    It's not about how you create your widget, read again what SixDegrees written, compiler is confused, because you do something like this:
    Qt Code:
    1. class A{
    2. public:
    3. void show(){
    4. }
    5. };
    6.  
    7. class B{
    8. public:
    9. void show(){
    10. }
    11. };
    12.  
    13.  
    14. class C : public A, public B{
    15. };
    16.  
    17. int main(){
    18. //...
    19. C c;
    20. c.show(); //!< and what is supposed to be called here : A::show() or B::show() ?
    21. }
    To copy to clipboard, switch view to plain text mode 

    I just want to know how to promote the custom MyTextEdit(which inherits QTextEdit) class to texEdit area....
    Stef has already given you a nice tutorial on promoting widgets in designer. Which part of it is not clear ?

Similar Threads

  1. Replies: 1
    Last Post: 25th October 2010, 13:07
  2. Replies: 8
    Last Post: 12th February 2010, 02:41
  3. Problem emiting signal in QTreeWidgetItem's subclass
    By Shawn in forum Qt Programming
    Replies: 12
    Last Post: 4th September 2007, 12:08
  4. Subclass
    By merry in forum General Programming
    Replies: 2
    Last Post: 1st March 2007, 10:34
  5. problem of subclass QTableItem
    By hesummar in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2006, 09:41

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.