Important: Please read the Qt Code of Conduct -

[Solved]My dialog inside of my mainwindow is not working

  • Hey , yesterday I opened a post:

    and the guy said that I should try creating a transparent window , and I did it , I included the project " the transparent window " to my current project which has the problem that I opened a post for.. anyways my other dialogs are working when I use show and other methods , but when I used this:

    FrameLess=new FramelessWindow(this);
    FrameLess->exec(); // show() is not working

    it works , only problem is it hides my mainwindow and it doesn't really show the background transparent window

    here's the code for the frameless window:




    I only want it to show when I click any button " shows as a full screen transparent window that I can click anywhere in it without effecting the programs behind the window , I want it like a transparent wall :D

  • Well , I think I got it only problem as I said it doesn't show...

    I added mouse events where when I press the left mouse button I can select anywhere in the widget, the only problem which is annoying is:


    this is the function that lets the widget be transparent , but when I use it the widget shows in the bar below " where all programs that are open are there " but i can select anything in the screen , which means it's not showing on the screen ?

  • I've tried everything :( , is there another method to do this ?

    I saw this but still no one have a solution:

  • Here is how I created a transparent window that fly on top of all windows and allows me to grab an area of a desktop. The key is a Qt::ToolTip.
    I have found this idea somewhere but I don't have a link.
    It works for me on Linux, have not tried it on Windows or MacOSX.

    SelectImage::SelectImage(QWidget parent)
    : QWidget(parent)
    , m_rubberBand(nullptr)
    setAttribute(Qt::WA_TranslucentBackground, true);
    setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint);
    desktop = QApplication::desktop();

    Then I used the events from QRubberBand example and here is my mouseReleaseEvent
    void SelectImage::mouseReleaseEvent(QMouseEvent *event)
    m_close = event->pos();
    QRect grabRect = QRect(m_open, m_close).normalized();
    m_pixmap = QPixmap::grabWindow(QApplication::desktop()->winId())

  • Still didn't work :(

    not sure if it needs to be a child of another widget ? but I think it won't work since I've tried yesterday " not your method , but the one that I've posted " but still didn't work.

    the window doesn't show/display , it's like there's nothing , I can't use my events at all! but when I delete


    it works fine except it's not transparent.

  • Do you use style-sheets ? I think if you apply style-sheets then widgets behavior is different.
    If you building screen snapshot tool then there is another idea.

    • On start create a QPixmap from desktop
    • Create your "transparent" widget
    • Set background of the widget from the QPixmap.
    • Show new widget
    • Use QRubberBand to select area.
    • On mouseRelease close the widget.

  • [quote author="Project try" date="1399810333"]not sure if it needs to be a child of another widget ?[/quote]
    Yes transparent window is another QWidget that is shown on demand.
    I've used QWidget as parent class not QDialog.

  • Thanks , I actually thought of this yesterday , but never thought it would work , it actually worked doing what you've said , thanks so much ^^

    but there's a little problem I think I'll make a new post about it since it's not related to this problem.

Log in to reply