simple MainWindow class implementation with frameless window and custom dark style. It adds also support for titlebar and buttons (minimize, maximize, close)
1.14k
stars
272
forks
source link
Frameless child-widgets only drawn inside parent/main widget #34
I want to be able to have a parent for my child-widget as the default (qt)-behavior.
It works as expected if I don't use the frameless widget but when I use the FramelessWindow, the child-window is only visible in front of the parent.
Here'a an example of what I mean:
// Undefine this to switch to windows frame mode
#define FRAMELESS_CHILD
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// style our application with custom dark style
a.setStyle(new DarkStyle);
// create frameless window (and set windowState or title)
FramelessWindow framelessWindow;
framelessWindow.setWindowTitle("Main Window");
framelessWindow.setWindowIcon(a.style()->standardIcon(QStyle::SP_DesktopIcon));
// create our mainwindow instance
MainWindow *mainWindow = new MainWindow;
// add the mainwindow to our custom frameless window
framelessWindow.setContent(mainWindow);
framelessWindow.show();
#ifdef FRAMELESS_CHILD
FramelessWindow childFramelessWindow(&framelessWindow); // Small difference if mainWindow or framelessWindow is parent.
childFramelessWindow.setWindowTitle("Child Window");
framelessWindow.setContent(new QDialog);
childFramelessWindow.show();
#else
// Works as expected but with windows/OS frame
QDialog* child = new QDialog(&framelessWindow);
child->resize(200, 200);
child->show();
#endif // FRAMELESS
return a.exec();
}
I want to be able to have a parent for my child-widget as the default (qt)-behavior. It works as expected if I don't use the frameless widget but when I use the FramelessWindow, the child-window is only visible in front of the parent.
Here'a an example of what I mean: