Results 1 to 6 of 6

Thread: Display own widget in new window

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2016
    Location
    Poland
    Posts
    18
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Display own widget in new window

    Quote Originally Posted by d_stranz View Post
    No. If you don't want a memory leak, then create the QChartView with the MainWindow as a parent. The chart view will then be deleted when the main window is deleted, whether the chart view is visible or not.
    Oh, ok. Can I ask you for simple example how to do that? How to create QChartView as a parent of MainWindow?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,233
    Thanks
    303
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Display own widget in new window

    How to create QChartView as a parent of MainWindow?
    No, no. Your QChartView should be a child of MainWindow. See that there are two QChartView constructors; in Line 21 of your code above use the one that takes a QWidget * parent argument and use "this" (your MainWindow instance) as the value for "parent".
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 1
    Last Post: 5th April 2013, 03:22
  2. Replies: 6
    Last Post: 9th November 2011, 04:31
  3. Replies: 2
    Last Post: 2nd November 2010, 15:52
  4. QMainWindow to display X Window
    By augusbas in forum Qt Programming
    Replies: 5
    Last Post: 21st July 2010, 14:00
  5. Move QT Window to different x display
    By jbpvr in forum Qt Programming
    Replies: 1
    Last Post: 5th September 2007, 20:28

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.