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. Memory Leak in the variables in the UI section of a Qt Widget's application!
QtWS25 Last Chance

Memory Leak in the variables in the UI section of a Qt Widget's application!

Scheduled Pinned Locked Moved Solved General and Desktop
designerleak detection
2 Posts 2 Posters 196 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.
  • J Offline
    J Offline
    jdent
    wrote on last edited by
    #1

    Hi,

    when using Qt Designer to build your form, a bunch of variables are created with new and are never released! Doesn't this constitute a leakage? Example:

    class Ui_QtWidgetMinWindowClass
    {
    public:
        QAction *actionOpen;
        QAction *action_Exit;
        QWidget *centralWidget;
        QTableView *tableView;
        QCheckBox *checkbox;
        QTableWidget *mainTableWidget;
        QListWidget *listWidget;
        QGraphicsView *graphicsView;
        QtDesignerWidget1 *designerWidget1;
        QPushButton *pushButton;
        QLineEdit *lineEdit;
        QtCustomChart *customChart;
        QMenuBar *menuBar;
        QMenu *menuFile;
        QToolBar *mainToolBar;
        QStatusBar *statusBar;
    

    Why can't i delete these elements?

    M 1 Reply Last reply
    0
    • J jdent

      Hi,

      when using Qt Designer to build your form, a bunch of variables are created with new and are never released! Doesn't this constitute a leakage? Example:

      class Ui_QtWidgetMinWindowClass
      {
      public:
          QAction *actionOpen;
          QAction *action_Exit;
          QWidget *centralWidget;
          QTableView *tableView;
          QCheckBox *checkbox;
          QTableWidget *mainTableWidget;
          QListWidget *listWidget;
          QGraphicsView *graphicsView;
          QtDesignerWidget1 *designerWidget1;
          QPushButton *pushButton;
          QLineEdit *lineEdit;
          QtCustomChart *customChart;
          QMenuBar *menuBar;
          QMenu *menuFile;
          QToolBar *mainToolBar;
          QStatusBar *statusBar;
      

      Why can't i delete these elements?

      M Offline
      M Offline
      mpergand
      wrote on last edited by
      #2

      @jdent said in Memory Leak in the variables in the UI section of a Qt Widget's application!:

      Doesn't this constitute a leakage?

      Read this to find out why not :
      https://doc.qt.io/qt-6/objecttrees.html

      1 Reply Last reply
      2
      • J jdent has marked this topic as solved on

      • Login

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