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. Passing pointer issue
Qt 6.11 is out! See what's new in the release blog

Passing pointer issue

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 375 Views 2 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.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    I would like to have an access between objects.

    I can view both object when I do not pass "this " pointer, as shown in attached. .
    I can test fill the "combo box" , no problem.

    When I add "this" pointer into Form_SetupLocalAdapte(this) r I can see only the "combo box", and nothing else.

    Should I be able to pass ( replacing the default null pointer ) and return a pointer to the " Form_SetupLocalAdapter " - from calling code ?

    At this point I am not coding for passing "connectt" messages, just like to have the pointer passing working.

    .
    d3f02370-100e-4ac2-ac9b-7f1da33e0185-image.png

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      whether it is safe or not will depend on architectural decisions: who should own the object, and what is its duration? and explicit use of this is only rarely needed, usually just to get around some weird syntactical dereferencing issue. in class instance methods this is implicit

      The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by Anonymous_Banned275
        #3

        I have changed "my architecture" and decided to pass only part of the data - QList.

            //LocalAdapterAddressList
            FSLA = new Form_SetupLocalAdapter(); // LocalAdapterAddressList);
            FSLA = new Form_SetupLocalAdapter(LocalAdapterAddressList); // &LocalAdapterAddressList);
            FSLA->show();
        

        i also added a constructor to process the passed data (pointer )

        public:
        explicit Form_SetupLocalAdapter(QWidget *parent = nullptr);
        explicit Form_SetupLocalAdapter(QList <*data_list>);
        //LocalAdapterAddressList

        Now I am getting this error

        /mnt/07b7c3f8-0efb-45ab-8df8-2a468771de1f/PROJECTS/RECOVERY/BLUETOOTH/SOURCE/CCC_SOURCE/terminal_SERIAL_BLUETOOTH_VER_1/terminal_SERIAL_BLUETOOTH/terminal_BLUETOOTH/form_setuplocaladapter.h:17: error: use of undeclared identifier 'data_list'
        In file included from form_setuplocaladapter.cpp:1:
        ./form_setuplocaladapter.h:17:45: error: use of undeclared identifier 'data_list'
        explicit Form_SetupLocalAdapter(QList <*data_list>);
        ^

        I am not familiar with "template" and have no idea how to fix this.

        I have been RTFM and have not found a single example of passing template variable (object) as a parameter . All examples are about HOW to build template class. I do not need that, I already have a class I want to reuse.

        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