Qt-Frameless-Window-DarkStyle icon indicating copy to clipboard operation
Qt-Frameless-Window-DarkStyle copied to clipboard

Frameless child-widgets only drawn inside parent/main widget

Open ChrillesNet opened this issue 5 years ago • 0 comments

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();
}

ChrillesNet avatar Jun 18 '19 09:06 ChrillesNet