Results 1 to 6 of 6

Thread: Customizable widget over main window.

  1. #1
    Join Date
    Nov 2011
    Location
    Poland
    Posts
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Customizable widget over main window.

    I would like to obtain something (dialog or widget) over main window.
    Let's say QWhatsThis is on a half of a way.
    I would like to control a time of displaing and also its shape and transparency.

    Any hints?

  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: Customizable widget over main window.

    And what problems are you having?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Nov 2011
    Location
    Poland
    Posts
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Customizable widget over main window.

    QWhatsThis depends on an user action - it hides after mouse or key press and it is sqare shaped....

    Is some way to subclass something ( Qwidget or Qdialog), put some flags to have control on its transparency, paint something with Qpainter or QgraphicsScene to get something like "comics dialog".
    I now only how to remove window decoration from Qdialog but I´m not sure is it good direction to play with some setAttribute() flags.

  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: Customizable widget over main window.

    You don't need any magic here. You can remove decoration by setting the Qt::FramelessWindowHint hint, you can change the shape of a widget with QWidget::setMask() and you can control the widget's opacity with QWidget::setWindowOpacity() on platforms that support it. You can also use Qt::WA_TranslucentBackground attribute to make a widget semi-transparent.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Nov 2011
    Location
    Poland
    Posts
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Customizable widget over main window.

    That was what I need.

    Thanks a lot !!!!

  6. #6
    Join Date
    Nov 2011
    Location
    Poland
    Posts
    17
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Customizable widget over main window.

    I implemented this by subclassing QDialog.
    I added:
    Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool | Qt::X11BypassWindowManagerHint

    when QDialog constructor is called
    and also:
    setAttribute(Qt::WA_TranslucentBackground, true);

    But how to stick this "extra window" to main window of a application.
    My way is to reimpement moveEvent() in main window to send signal with moved coefficients,
    but still I have to take care of minimizeing of main window - this extra dialog remains over because of Qt::WindowStaysOnTopHint. Yes, I can reimplement some other events from main window

    but maybe there is some more smart way

Similar Threads

  1. Replies: 3
    Last Post: 30th December 2010, 15:34
  2. Add a Frame Widget to the main window
    By kamlmish in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2010, 08:51
  3. Replies: 0
    Last Post: 14th November 2010, 19:38
  4. accessing my main application window widget
    By jayw710 in forum Newbie
    Replies: 8
    Last Post: 15th November 2007, 19:33
  5. Background image for main window widget using css.
    By Enygma in forum Qt Programming
    Replies: 8
    Last Post: 23rd August 2007, 15:40

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.