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

Assert in QTabWidgwt

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 359 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.
  • S Offline
    S Offline
    Shayne
    wrote last edited by
    #1

    Use QTableWidget like this (Qt6.8.3 msvc2022_64):

    #include <qapplication.h>
    #include <QtWidgets/QHBoxLayout>
    #include <QtWidgets/QTreeWidget>

    class TestWidget : public QWidget
    {
    public:
    TestWidget(QWidget* pParent = nullptr)
    : QWidget(pParent)
    {
    QHBoxLayout* mainLayout = new QHBoxLayout(this);
    auto* m_pTabWidget = new QTabWidget(this);
    mainLayout->addWidget(m_pTabWidget);
    QWidget* pTabDocWidget = new QWidget(m_pTabWidget);
    m_pTabWidget->addTab(pTabDocWidget, QString("aaa"));
    }
    };

    int main(int argc, char* argv[])
    {
    QApplication app(argc, argv);
    TestWidget wid;
    wid.show();
    return app.exec();
    }

    An assert occourred in Debug Mode at "m_pTabWidget->addTab(pTabDocWidget, QString("aaa"));" , release mode is ok.

    this is the callstack:
    d08fc456-901e-4b04-853b-4b4439a723ee-image.png

    Is there any problem with my codes ?

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

      Your code above is correct so you either mix debug and release libraries (e.g. you compile your app in release mode but using debug Qt libs) or you don't show your full code.

      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
      2

      • Login

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