Wrong draw origin (qml)



  • I created a boarderless transparent window that works on almost systems but on some platforms with Windows 10 the drawing origin is not correct.
    The content loaded using a loader and after the content is loaded I set the position of root item to (0, 0) but no luck!
    The window buttons mouse area seems work well but the sensitive are of them are in the transparent area!
    Is this a bug in the scene graph? is there any workaround ?
    0_1506343773248_photo.png


  • Moderators

    @HojjatJafary
    show some code please.
    What is the type of your root item?
    What flags exactly do you set for the frameless border window hint?



  • Root item is Item with a loader that loads the content.

    Item
    {
    	id: root;
    	width: 430;
    	height: 485;
    
    	Loader
    	{
    		id: loader;
    		anchors.fill: parent;
    		source: "Window.qml";
    		asynchronous: true;
    		onLoaded:
                    {
    			loader.visible = true;    
    		}
    	}
    }
    

    The view is:

    QQuickView view;
    view.setResizeMode(QQuickView::SizeRootObjectToView);
    view.setFlags(Qt::Window | Qt::FramelessWindowHint);
    view.setColor("transparent");
    view.setSource(QUrl("RootWindow.qml"));
    QtWin::extendFrameIntoClientArea(view, 1, 1, 1, 1);
    view->show();
    
    

    I also install a native event filter to filter some of windows events to remove the border.


  • Moderators

    @HojjatJafary said in Wrong draw origin (qml):

    QtWin::extendFrameIntoClientArea(view, 1, 1, 1, 1);

    remove this line, it's not needed, since it actually does the exact opposite you want.

    Also try the following window flags:

    view.setFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::FramelessWindowHint);
    


  • If I remove that line the window will not have shadow!
    The strange part is that it works on almost PCs!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.