Results 1 to 2 of 2

Thread: Confused QWidget and QDialog behavior

  1. #1
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Confused QWidget and QDialog behavior

    Hi,

    I'll try my best to explain things in details

    Here is the code I tried

    Qt Code:
    1. EvlDialog::EvlDialog(QWidget *parent) : QDialog(parent)
    2. {
    3. setModal(true);
    4. setAttribute(Qt::WA_DeleteOnClose);
    5.  
    6. setFixedSize(400,120);
    7. setAutoFillBackground(true);
    8.  
    9. //Let us make the edges curved
    10. QRegion maskRegion(10,10,380,100);
    11. maskRegion = maskRegion.unite(QRegion(0,10,10,100));//Left
    12. maskRegion = maskRegion.unite(QRegion(390,10,10,100));//Right
    13. maskRegion = maskRegion.unite(QRegion(10,0,380,10));//Top
    14. maskRegion = maskRegion.unite(QRegion(10,110,380,10));//Bottom
    15.  
    16. maskRegion = maskRegion.unite(QRegion(0,0,20,20,QRegion::Ellipse));//Top-Left
    17. maskRegion = maskRegion.unite(QRegion(380,0,20,20,QRegion::Ellipse));//Top-Right
    18. maskRegion = maskRegion.unite(QRegion(0,100,20,20,QRegion::Ellipse));//Bottom-Left
    19. maskRegion = maskRegion.unite(QRegion(380,100,20,20,QRegion::Ellipse));//Bottom-Right
    20. setMask(maskRegion);
    21.  
    22. registerButton = new QPushButton(tr("Enter registraion key"),this);
    23. }
    To copy to clipboard, switch view to plain text mode 

    Result
    1. No Title Bar (Widget is Frameless)
    2. registerButton is clickable.

    Qt Code:
    1. EvlDialog::EvlDialog(QWidget *parent) : QWidget(parent)
    2. {
    3. setWindowModality(Qt::WindowModal);
    4. setAttribute(Qt::WA_DeleteOnClose);
    5.  
    6. setFixedSize(400,120);
    7. setAutoFillBackground(true);
    8.  
    9. //Let us make the edges curved
    10. QRegion maskRegion(10,10,380,100);
    11. maskRegion = maskRegion.unite(QRegion(0,10,10,100));//Left
    12. maskRegion = maskRegion.unite(QRegion(390,10,10,100));//Right
    13. maskRegion = maskRegion.unite(QRegion(10,0,380,10));//Top
    14. maskRegion = maskRegion.unite(QRegion(10,110,380,10));//Bottom
    15.  
    16. maskRegion = maskRegion.unite(QRegion(0,0,20,20,QRegion::Ellipse));//Top-Left
    17. maskRegion = maskRegion.unite(QRegion(380,0,20,20,QRegion::Ellipse));//Top-Right
    18. maskRegion = maskRegion.unite(QRegion(0,100,20,20,QRegion::Ellipse));//Bottom-Left
    19. maskRegion = maskRegion.unite(QRegion(380,100,20,20,QRegion::Ellipse));//Bottom-Right
    20. setMask(maskRegion);
    21.  
    22. registerButton = new QPushButton(tr("Enter registraion key"),this);
    23. }
    To copy to clipboard, switch view to plain text mode 

    Result

    1. Widget is frameless
    2. Button is not clickable. EvlDialog is behaving as if there is another widget on top which is modal.


    Can someone please explain the reason for this kind of behavior.
    Thanks a lot.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Confused QWidget and QDialog behavior

    Did you try asking the Trolls about it? Or looking in the task-tracker? Maybe it is a bug?

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.