Results 1 to 2 of 2

Thread: access to class functions/members in QTabWidget

  1. #1
    Join Date
    Mar 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default access to class functions/members in QTabWidget

    Hi,

    In my program i have class like this:
    Qt Code:
    1. class WorkingTab : public QWidget
    To copy to clipboard, switch view to plain text mode 

    and QTabWidget in a mainwindow where i'm adding WorkingTab into tabs
    Qt Code:
    1. WorkingTab *newtab = new WorkingTab;
    2. tab_widget->addTab(newtab,"something")
    To copy to clipboard, switch view to plain text mode 

    And my question is...how can i access to WorkingTab class public functions/members via QTabWidget? I have no idea, QTabWidget::widget(int) returning only QWidget...i need my own WorkingTab class.

    regards

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: access to class functions/members in QTabWidget

    The best would probably be to store the pointer in alocal variable. If not, cast the pointer into a pointer of your class. If they are Qt classes you can use qobject_cast.

Similar Threads

  1. Replies: 2
    Last Post: 7th July 2010, 01:14
  2. Abstract base class and inherited class members
    By JovianGhost in forum General Programming
    Replies: 3
    Last Post: 19th March 2010, 13:32
  3. Replies: 4
    Last Post: 14th January 2010, 17:30
  4. Replies: 4
    Last Post: 26th June 2007, 20:19
  5. Static functions and class members
    By Raistlin in forum General Programming
    Replies: 5
    Last Post: 22nd December 2006, 11:00

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.