×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    29

    Question Non rectangular QDialog?

    Hi,

    I want to achieve something similar to:



    I want to display a QDialog on top of my QMainWindow that has some transparency. Problem is that I cannot get the QDialog to appear transparent at the edges. I tried setting a QRegion as mask which does not work.

    Setting the mask is not working for me on Symbian (same code works fine on Windows). For testing I set a small region as the mask for the QDialog:
    Code:
    // inside my class' constructor extending from QDialog
    QRegion r(QRect(0,0,50,50), QRegion::Rectangle);
    this->setMask(r);
    I first tried to set the background transparent with a transparent background color:
    Code:
    this->setAttribute(Qt::WA_TranslucentBackground, true);
    But that shows some artifacts of the previously visible S60 UI. The QMainWindow behind the dialog is displayed correctly outside of the dialogs region.

    Any help to achieve a neat looking dialog is greatly appreciated.

    Thanks,
    Wolfgang

  2. #2
    Regular Contributor
    Join Date
    Mar 2009
    Posts
    430

    Re: Non rectangular QDialog?

    If it works on windows, it should work on symbian too given the write once compile everywhere promise. I can imagine that no one has tried so far because non rectangular windows are quite uncommon on symbian. Search the Qt-bugtracker whether this has already be reported and if not, open a new bug. Also make a photo of the mentioned graphics artifacts.

  3. #3
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: Non rectangular QDialog?

    Quote Originally Posted by axeljaeger View Post
    If it works on windows, it should work on symbian too given the write once compile everywhere promise. I can imagine that no one has tried so far because non rectangular windows are quite uncommon on symbian. Search the Qt-bugtracker whether this has already be reported and if not, open a new bug. Also make a photo of the mentioned graphics artifacts.
    Transparency support is up to Window Manager, most of WM supports transparent windows, but there are few which do not. However, artifacts are probably an indication of a bug.

  4. #4
    Nokia Developer Expert
    Join Date
    Feb 2008
    Posts
    183

    Re: Non rectangular QDialog?

    This was recently fixed to the Qt for Symbian, so the fix should be in the Qt 4.6.2

  5. #5
    Registered User
    Join Date
    Jan 2008
    Posts
    29

    Arrow Re: Non rectangular QDialog?

    Thanks for the replies. I guess I'll have to wait to 4.6.2. I'm still wondering why it seems to be impossible. The screenshot is from a blog post about an actual app built with qt.

    Somethings I want to share and found out during my testing:

    QWidget is sufficient for the effect I want to achieve. And by setting following options this works great on Windows, mostly on 5th Edition phones and not so great on 3rd Edition phones.

    Code:
    // inside the constructor of a class extended from QWidget 
    this->setWindowFlags(Qt::FramelessWindowHint); // needed for Windows
    this->setAttribute(Qt::WA_TranslucentBackground, true);
    ui->frame->setBackgroundRole(QPalette::Window);  // otherwise the frame would be transparent as well
    And the style sheet for the frame:

    Code:
    #frame { border: 2px solid gray;
    border-radius: 10px;
    background-color: palette(window);
    }
    Problems persisting:
    1. On 5th Edition Phones: Background of frame is black. Therefore it does not fit to the current s60 theme.
    2. On 3rd Edition Phones: same as 1. + transparent pixels do not show the QMainWindow below, but the last thing Symbian had drawn there (e.g. AppTRK output).

    I run out of ideas. If someone knows how to fix some or all of the problems, your help is highly appreciated.

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    1

    Re: Non rectangular QDialog?

    Thank You So Much......................
    Last edited by pavanbarot; 2010-10-11 at 16:04. Reason: sorry no need

Similar Threads

  1. Replies: 1
    Last Post: 2010-01-05, 21:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×