Results 1 to 5 of 5

Thread: Qt 4 expanded mask

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Qt 4 expanded mask

    Hey there I'm using a "masked" widget as main window:

    Qt Code:
    1. /* virtual */ void ZeMessengerWindow::resizeEvent(QResizeEvent * event)
    2. {
    3. QRect maskRect(rect().x(), rect().y(),
    4. rect().width(), rect().height());
    5. setMask(QRegion(ZePainterController::get()->DrawUpRoundRect(maskRect).toFillPolygon().toPolygon()));
    6. }
    To copy to clipboard, switch view to plain text mode 

    Every resizeEvent, I set a mask.
    Problem is, when I
    - Expand it to occupy the full screen.
    - My widget behave as if it has the upper windows frame.
    - Thus, my widget isn't really occupying the full screen.

    Can I specify an expanded rectangle to my masked widget only ?

  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: Qt 4 expanded mask

    Quote Originally Posted by bunjee View Post
    - My widget behave as if it has the upper windows frame.
    Because it does. It's just transparent.

    Can I specify an expanded rectangle to my masked widget only ?
    Start by making your widget frameless by using appropriate window flags.

  3. #3
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt 4 expanded mask

    Qt Code:
    1. setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
    To copy to clipboard, switch view to plain text mode 

    Only problem is, I don't see my Taskbar anymore.

  4. #4
    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: Qt 4 expanded mask

    It's either one or the other... You can artificially move the widget up to skip the frame in the maximized mode, if you want. With fullscreen there is no frame at all, maybe that's your option (although there is no taskbar either).

  5. #5
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Re: Qt 4 expanded mask

    Here is an home made implementation for masked windows:

    Qt Code:
    1. void ZeMessengerWindow::ShowNormal()
    2. {
    3. if (isWindowMaximized() == true)
    4. {
    5. mWindowMaximized = false;
    6.  
    7. //showNormal();
    8. move(mOldGeometry.x(), mOldGeometry.y());
    9. resize(mOldGeometry.width(), mOldGeometry.height());
    10. mMaximizeButton->setText(tr("+"));
    11.  
    12. // Size grips
    13. mSizeGrip1->show();
    14. mSizeGrip2->show();
    15. mSizeGrip3->show();
    16. mSizeGrip4->show();
    17.  
    18. // Restoring old geometry
    19. mOldGeometry = QRect(-1, -1, -1, -1);
    20. }
    21. }
    22.  
    23. void ZeMessengerWindow::ShowMaximized()
    24. {
    25. if (isWindowMaximized() == false)
    26. {
    27. //showMaximized();
    28. mWindowMaximized = true;
    29. mOldGeometry = QRect(x(), y(), width(), height());
    30.  
    31. const QRect rect = QApplication::desktop()->availableGeometry();
    32. setGeometry(QRect(0, 0, rect.width(), rect.height()));
    33. mMaximizeButton->setText(tr("-"));
    34.  
    35. // Size grips
    36. mSizeGrip1->hide();
    37. mSizeGrip2->hide();
    38. mSizeGrip3->hide();
    39. mSizeGrip4->hide();
    40. }
    41. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. QLineEdit and input mask
    By tpf80 in forum Qt Programming
    Replies: 7
    Last Post: 9th May 2014, 19:47
  2. Replies: 1
    Last Post: 5th May 2008, 16:20
  3. help with.. numeric mask....
    By ocascante in forum Qt Tools
    Replies: 1
    Last Post: 12th July 2007, 09:53
  4. MainWindow mask
    By SirBabyface in forum Qt Programming
    Replies: 0
    Last Post: 11th July 2007, 15:12
  5. Problem with mask and validation
    By gunhelstr in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2006, 08:07

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.