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. Maximize table cell leads to segmentation fault

Maximize table cell leads to segmentation fault

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

    I have QTableWidget that gets its data from std::vector<MyCustomWidget *mywidget>
    I want to make one MyCustomWidget when double clicked to take the full size of QTableWidget and return to its default size when double clicked again.
    MyCustomWidget emit this signal

    emit maximizationRequested(this);
    

    to the QTableWidget
    The problem is when I try to maximize the widget with the following code

        this->setRowCount(1);
        this->setColumnCount(1);
        this->setCellWidget(0,0, maxiWidget);
        this->resizeColumnsToContents();
        this->resizeRowsToContents();
    

    All other MyCustomWidget are destroyed So When I try to access them again It leads to segmentation fault.
    I want to keep my vector of MyCustomWidget intact and I shouldn't modify MyCustomWidget what your opinions are?

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

      Use a QStackedLayout where you show your QTableWidget and another widget where you show your data when double clicked.

      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