Results 1 to 2 of 2

Thread: Make widgets float inside of qapplication main window

  1. #1
    Join Date
    Jul 2012
    Posts
    10
    Thanks
    5
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Make widgets float inside of qapplication main window

    Hi -

    I am upgrading our qt-based application to qt4 from qt3. The application has a main window and then dynamically loadable modules (as widgets).

    I want the module windows to be floating windows inside of the main application window, however I can't seem to get this to work that way.

    I can only get them either take up the entire main window space (as shown in shot1.png) or be floating, individual windows that are separate from the main window (they can be dragged outside the main application window and don't get closed when then main window closes).

    For both cases (shot1.png and shot2.png), my widget constructor has the following:

    Qt Code:
    1. DataRecorder::Panel::Panel(QWidget *parent, size_t buffersize) :
    2. QWidget(parent), RT::Thread(RT::Thread::MinimumPriority), fifo(buffersize), recording(false) {
    3.  
    4. setAttribute(Qt::WA_DeleteOnClose);
    To copy to clipboard, switch view to plain text mode 

    In shot1.png, I have the following in my main_window.cpp file:

    Qt Code:
    1. MainWindow::MainWindow (void) : QMainWindow(NULL, Qt::Window) {
    2.  
    3. QWidget *centralWidget = new QWidget(this);
    4. setCentralWidget(centralWidget);
    5.  
    6. setCentralWidget(new QWorkspace(this));
    7. ((QWorkspace *)centralWidget)->setScrollBarsEnabled(true);
    To copy to clipboard, switch view to plain text mode 

    and in shot2.png I have that commented out.

    Any help is appreciated

    shot1.jpgshot2.jpg

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Make widgets float inside of qapplication main window

    Not sure it you want QMdiArea or QDockWidgets

  3. The following user says thank you to ChrisW67 for this useful post:

    yapatel (25th March 2014)

Similar Threads

  1. Replies: 1
    Last Post: 5th September 2013, 16:33
  2. Replies: 1
    Last Post: 14th July 2012, 08:59
  3. Make Dock Widgets overlap main view
    By genjix in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2010, 14:16
  4. get main window to float in front of children (Windows 7)
    By mortoray in forum Qt Programming
    Replies: 0
    Last Post: 13th October 2010, 21:04
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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
  •  
Qt is a trademark of The Qt Company.