Results 1 to 5 of 5

Thread: How to show a frameless dialog - DOESN'T WORK

  1. #1
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to show a frameless dialog - DOESN'T WORK

    Hi to all,
    I would show a frameless dialog from my gui but I can't.
    This is my code:
    Qt Code:
    1. #ifndef __INFODLG_H__
    2. #define __INFODLG_H__
    3.  
    4. #include "GeneratedFiles/ui_infoDlg.h"
    5. #include <QDialog>
    6.  
    7. class MainWindow;
    8.  
    9. class InfoDlg : public QDialog
    10. {
    11.  
    12. public:
    13. InfoDlg( QWidget *parent );
    14. virtual ~InfoDlg();
    15.  
    16. private slots:
    17.  
    18. protected:
    19.  
    20. private:
    21. Ui::infoDlg ui;
    22. MainWindow* win;
    23. };
    24.  
    25. #endif __INFODLG_H__
    To copy to clipboard, switch view to plain text mode 

    and the *.cpp
    Qt Code:
    1. #include "InfoDlg.h"
    2.  
    3. InfoDlg::InfoDlg( QWidget *parent )
    4. : QDialog(parent)
    5. {
    6. ui.setupUi(this);
    7. setWindowFlags( Qt::FramelessWindowHint );
    8. win = (MainWindow*)parent;
    9. }
    10.  
    11. InfoDlg::~InfoDlg()
    12. {
    13. }
    To copy to clipboard, switch view to plain text mode 

    here I create the dialog


    Qt Code:
    1. void MainWindow::test()
    2. {
    3. InfoDlg dlg(this);
    4. dlg.exec();
    5. }
    To copy to clipboard, switch view to plain text mode 

    Unfortunately it doesn't work. I tried either with exec and show methods without success.

    Where is the problem?

    Regards
    Franco Amato

  2. #2
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to show a frameless dialog - DOESN'T WORK

    You've got an example of a frameless QDialog in Qt Demo. Have a look at widgets -> windows flags

  3. #3
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to show a frameless dialog - DOESN'T WORK

    Hi

    I use this code and all works fine.

    Qt Code:
    1. DlgAbout *d = new DlgAbout(0,0,"1.00.00"); // QDialog
    2. d->setWindowTitle(tr("About"));
    3. d->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
    4. d->show();
    To copy to clipboard, switch view to plain text mode 

    Note: DlgAbout is a gui create with Qt4 Designer

  4. #4
    Join Date
    Nov 2007
    Location
    Italy
    Posts
    691
    Thanks
    59
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to show a frameless dialog - DOESN'T WORK

    Quote Originally Posted by vcp View Post
    Hi

    I use this code and all works fine.

    Qt Code:
    1. DlgAbout *d = new DlgAbout(0,0,"1.00.00"); // QDialog
    2. d->setWindowTitle(tr("About"));
    3. d->setWindowFlags(Qt::FramelessWindowHint | Qt::Dialog);
    4. d->show();
    To copy to clipboard, switch view to plain text mode 

    Note: DlgAbout is a gui create with Qt4 Designer
    It works thank you very much.
    The problem was the Qt:ialog missed.

    Now I would do the dialog background transparent :-)
    Franco Amato

  5. #5
    Join Date
    Jun 2010
    Posts
    5
    Thanks
    1
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: How to show a frameless dialog - DOESN'T WORK

    Hi,

    I have a problem on SDK (OS:Windows Vista).
    I also use setWindowFlags((this->windowFlags()|Qt::FramelessWindowHint) ,but it still have gray line around window.
    Can somebody help ....?

    note: you can see the picture in attachment.

    linste0815
    Attached Images Attached Images

Similar Threads

  1. Application running but doesn't show up!!!
    By joandelason in forum Newbie
    Replies: 4
    Last Post: 21st March 2010, 09:37
  2. QListWidget doesn't show icons
    By franco.amato in forum Qt Programming
    Replies: 8
    Last Post: 16th March 2010, 14:15
  3. Custom Widget doesn t show.
    By Frej in forum Qt Tools
    Replies: 12
    Last Post: 11th March 2010, 10:48
  4. QStackedLayout doesn't show pages
    By C167 in forum Qt Programming
    Replies: 10
    Last Post: 25th January 2008, 13:34
  5. QSystemTrayIcon doesn't show icon ?
    By probine in forum Qt Programming
    Replies: 3
    Last Post: 25th January 2007, 19:17

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.