Results 1 to 5 of 5

Thread: QWidget as widget and as dialog

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QWidget as widget and as dialog

    Hello guys,

    I have a
    Qt Code:
    1. class MyWidget : public QWidget
    2. {
    3. Q_OBJECT;
    4. [...]
    5. };
    To copy to clipboard, switch view to plain text mode 

    and I want to use this widget modal in one dialog and embedded in another bigger widget in the same time.
    When I add this widget in another dialog everything is fine and looks great, but to display it as a popup in an single dialog I do:

    Qt Code:
    1. MyWidget *myWidgetDlg = new MyWidget ();
    2. addCompanyDlg->setWindowModality (Qt::WindowModal);
    3.  
    4. QDialog mainDialog;
    5. mainDialog.setLayoutDirection (Qt::LayoutDirection::LeftToRight);
    6.  
    7. QBoxLayout mainDialogLayout(QBoxLayout::LeftToRight);
    8. mainDialogLayout.addWidget(myWidgetDlg );
    9. mainDialogLayout.setMargin (0);
    10.  
    11. mainDialog.setLayout(&mainDialogLayout);
    12.  
    13. mainDialog.setWindowState(mainDialog.windowState() | Qt::WindowMaximized);
    14. mainDialog.setWindowFlags (Qt::Dialog);
    15. mainDialog.exec();
    To copy to clipboard, switch view to plain text mode 

    This works on my computer on Linux (Ubuntu 12.4 x64), but on Windows (x64) and on my tester computer (Ubuntu 12.4 x86), the dialog is shown without borders and title bar is like an splash screen, not minimize and maximize buttons.

    What is wrong in my dynamical QDialog creation?

    Thanks in advance.
    Last edited by high_flyer; 29th August 2012 at 10:53. Reason: code tags

Similar Threads

  1. Widget over modal dialog
    By mpi in forum Qt Programming
    Replies: 3
    Last Post: 16th May 2012, 14:10
  2. Transparent dialog widget
    By girishgowda in forum Qt Programming
    Replies: 3
    Last Post: 2nd July 2010, 09:11
  3. Widget-Dialog communication
    By hgedek in forum Qt Programming
    Replies: 9
    Last Post: 5th July 2008, 17:44
  4. Use QWidget derived class in Dialog
    By qtneuling in forum Qt Tools
    Replies: 2
    Last Post: 17th May 2008, 23:29
  5. Replies: 2
    Last Post: 23rd April 2008, 14:13

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.