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. Cannot interact with subclass of QTabWidget
Forum Updated to NodeBB v4.3 + New Features

Cannot interact with subclass of QTabWidget

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 281 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.
  • P Offline
    P Offline
    ppp1
    wrote on last edited by aha_1980
    #1

    Hello,
    I have subclassed QTabWidget. Added two tabs.

    addTab(new QLineEdit, "Test1");
    addTab(new QWidget,"Test2");
    connect(this,&QTabWidget::tabBarClicked, this, [=](int i){qDebug()<<QString::number(i);} );
    

    Problem is that I cannot switch to the other tab and I can't insert any text in the QLineEdit object. The behaviour is like a picture. You can see the tabs and the QLineEdit instance, but you are not able to interact with any instance.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ppp1 said in Cannot interact wiht subclass of QTabWidget:

      I have subclassed QTabWidget.

      Why do you subclassed it?

      Please show us more code, there is no picture.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • P Offline
        P Offline
        ppp1
        wrote on last edited by
        #3

        Hi,
        I could solve the problem.

        ui->setupUi(this);
        

        This command should the first command in the constructor. I have placed it after the declaration and definition of the tab widget. That was the reason why it didn'tr run properly.

        Christian EhrlicherC 1 Reply Last reply
        0
        • P ppp1

          Hi,
          I could solve the problem.

          ui->setupUi(this);
          

          This command should the first command in the constructor. I have placed it after the declaration and definition of the tab widget. That was the reason why it didn'tr run properly.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @ppp1 Then please mark this topic as solved, thx.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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