Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QList no matching constructor error
Qt 6.12 LTS is out! See what's new in the release blog

QList no matching constructor error

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 3.1k Views
  • 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.
  • B Offline
    B Offline
    Bharth
    wrote on last edited by
    #1

    Hi ,,,
    its showing no matching constructor for initialization of qList
    please help me to slove this
    this is the line i added

    QList<XperienceAccount*> memberList = new QList<XperienceAccount>(contactlist)

    thanks in adavnce

    JonBJ 1 Reply Last reply
    0
    • B Bharth

      Hi ,,,
      its showing no matching constructor for initialization of qList
      please help me to slove this
      this is the line i added

      QList<XperienceAccount*> memberList = new QList<XperienceAccount>(contactlist)

      thanks in adavnce

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Bharth
      I don't do C++, but the lhs is a list of pointers XperienceAccount* while the rhs is a list of XperienceAccount. One or other needs changing (depending on what you've got in contactlist) so that they match either pointer or non-pointer.

      1 Reply Last reply
      3
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
        wrote on last edited by
        #3

        In addition to what @JonB said you can look at the following snippet

        QList<QPushButton*> list1;
        for(int i=0;i<10;i++){
             list1.append(new QPushButton);
        }
        
        QList<QPushButton*> *list = new QList<QPushButton*>(list1);
        

        Dheerendra
        @Community Service
        Certified Qt Specialist
        https://www.pthinks.com

        1 Reply Last reply
        3

        • Login

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