Results 1 to 3 of 3

Thread: Inherit from QTabWidget

  1. #1
    Join Date
    Jun 2010
    Posts
    13
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Inherit from QTabWidget

    Hi, I want to add some code to addTab. Therefore I tried to build an inherit class of QTabWidget. What am I doing wrong?
    Thx -,
    Chris

    test.h
    Qt Code:
    1. #ifndef TEST_H
    2. #define TEST_H
    3.  
    4. #include <QtGui/QTabWidget>
    5.  
    6.  
    7. class CTest : public QTabWidget
    8. {
    9. Q_OBJECT
    10.  
    11. public:
    12. CTest(QWidget* parent = 0);
    13. ~CTest();
    14.  
    15. int addTab(QWidget* , const QString& );
    16.  
    17. };
    18.  
    19. #endif // TEST_H
    To copy to clipboard, switch view to plain text mode 

    test.cpp
    Qt Code:
    1. #include "test.h"
    2.  
    3. #include <QtGui>
    4.  
    5. CTest::CTest(QWidget* parent)
    6. : QTabWidget(parent)
    7. {
    8.  
    9. }
    10.  
    11. CTest::~CTest()
    12. {
    13.  
    14. }
    15.  
    16. int CTest::addTab(QWidget* page, const QString& label)
    17. {
    18. //some aditional code
    19.  
    20. return QTabWidget::addTab(page, label);
    21. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by Suncell; 27th June 2010 at 20:28.

  2. #2
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Thanks
    62
    Thanked 260 Times in 246 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Inherit from QTabWidget

    Post more details about the problem, it's a compile error? a run-time one? some functionality doesn't work?

  3. #3
    Join Date
    Jun 2010
    Posts
    13
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Inherit from QTabWidget

    problem solved - everything was fine - just included files into a wrong .pro file -sorry

Similar Threads

  1. How to use the ui_*.h,inherit it or as a member?
    By 75543255 in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2009, 10:45
  2. Inherit the QAxWidget
    By MrShahi in forum Qt Programming
    Replies: 3
    Last Post: 29th April 2008, 08:06
  3. How to inherit correct canReadLine()
    By The Storm in forum Qt Programming
    Replies: 7
    Last Post: 25th March 2008, 09:33
  4. SIGNALS in Inherit Classes
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 27th November 2006, 16:06
  5. Inherit and Overwrite signals
    By shaselsc in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2006, 15:39

Tags for this Thread

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.