Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Calling functions from one class to another
Forum Updated to NodeBB v4.3 + New Features

Calling functions from one class to another

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 3.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    petergeng
    wrote on last edited by
    #1

    I am working in one class (named 'ModelBrowserTree') and want to pass some information to another class (named 'Dialog')that i've created. However, in the function call it seems that only objects are allowed in this passing process... why this is? is this necessary? how can i bypass this?

    the function call while in a member function of ModelBrowserTree i have is:
    Dialog::ModelChangedInfo(docAnno);

    ModelChangedInfo is a member function of Dialog, and docAnno is a string........
    QString ModelChangedInfo(QString str)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      This is really, really basic C++, that has nothing to do with Qt. Please pick up any basic C++ book to get started.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lgeyer
        wrote on last edited by
        #3

        [quote author="petergeng" date="1319129803"]However, in the function call it seems that only objects are allowed in this passing process... why this is? is this necessary? how can i bypass this?[/quote]
        Well - it isn't. The call fails in your case because ModelChangedInfo() is a non-static method. So you either make it a static method (which is what you most probably do not want) or you call ModelChangedInfo() on an object of Dialog.

        If you do not know what I am talking about you should seriously consider what Andre said. Qt absolutely requires you to have at least a basic understanding of C++. If there are any specific (and Qt-related) questions feel free to come back here.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved