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. QTabWidget::QTabWidget(const QTabWidget&)' is private
QtWS25 Last Chance

QTabWidget::QTabWidget(const QTabWidget&)' is private

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.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.
  • M Offline
    M Offline
    mehdi.nine
    wrote on last edited by
    #1

    I develop a program and have 10 backup from it. i add some line to it and when i compile project it have following error:
    @
    C:\Qt\Qt5.0.1\5.0.1\mingw47_32\include\QtWidgets\qtabwidget.h:173: error: 'QTabWidget::QTabWidget(const QTabWidget&)' is private
    @
    the error is from * line
    @
    namespace Ui {
    class ContentControl;
    }

    class ContentControl:public QTabWidget //* from this line///////////////////////////////
    {
    Q_OBJECT

    public:
    .
    .
    .
    }
    @
    all backups has this error now. any idea? i re install QT but problem has exist.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      The error is correct, you can not copy QObjects (and all QWidgets are QObjects).

      My guess is that you have a copy constructor defined for ContentControl.

      Try reinstalling Qt a couple more times and then fix your code when you are tired of doing that:)

      1 Reply Last reply
      0
      • Chris KawaC Offline
        Chris KawaC Offline
        Chris Kawa
        Lifetime Qt Champion
        wrote on last edited by
        #3

        The copy constructor is generated automatically if you don't prevent it manually (by declaring it private or via c++11 delete).

        These are few (horrible) examples that could generate this error:
        @
        ContentControl c1;
        ContentControl c2 = c1; // error

        void someFunction(ContentControl) {...}
        someFunction(c1); //error

        ContentControl someFunc2() { return ContentControl; }
        someFunc2(); //error
        @
        In short don't try to pass QObjects by value.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mehdi.nine
          wrote on last edited by
          #4

          thanks for you reply the problem has solved when i delete ContentControl that send to another class.

          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