qt - Create custom shadow for frameless window in qml -


i know may possible duplicate of "shadow qml frameless windows".
create new title bar different max min , close button , drag , drop functionallity thing remains custom or shadow frameless window. i'm complete newbe in qt , qml.
thanks further help.

app custom titlebar

enter image description here



qml file

import qtquick 2.0 import qtquick.window 2.0 import qtquick.controls 1.4 import qtquick.controls.styles 1.4 //import qtqml 2.2 window { property int titlebar_wrapper_size:40 fontloader { id: segoe_light; source: "fonts/segoe_light" } id:registerwindow width:800 height:600 visible:true x:screen.width/2 - width/2 y:screen.height/2 - height/2 //x: screen.desktopavailablewidth/2 - width //y: screen.desktopavailableheight/2 - height  flags: qt.framelesswindowhint |        qt.windowminimizebuttonhint |        qt.window  mousearea {     id:dragparentwindow     width: parent.width     height: 57     property real lastmousex: 0     property real lastmousey: 0     onpressed: {         lastmousex = mousex         lastmousey = mousey     }     onmousexchanged: registerwindow.x += (mousex - lastmousex)     onmouseychanged: registerwindow.y += (mousey - lastmousey) } rectangle{     id:titlebar     width: parent.width     rectangle{         id:appclose         height: titlebar_wrapper_size         y:0         width: titlebar_wrapper_size         anchors.right: parent.right         text{             //text: awesome.loaded ? awesome.icons.fa_money : "x"             text: "×"             anchors.horizontalcenter: parent.horizontalcenter             font.pointsize: 20         }         mousearea{             width: parent.width             height: parent.height             hoverenabled: true             onentered: appclose.color="#ddd"             onexited: appclose.color="#fff"             onclicked: qt.quit()         }     }     rectangle{     id:appminimize     height: titlebar_wrapper_size     y:0     width: titlebar_wrapper_size     anchors.right: appclose.left     text{         text: '🗕'         font.family: segoe_light.name         anchors.horizontalcenter: parent.horizontalcenter         font.pointsize: 15     }     mousearea{         width: parent.width         height: parent.height         hoverenabled: true         onentered: appminimize.color="#ddd"         onexited: appminimize.color="#fff"         onclicked: registerwindow.visibility = window.minimized     } }  } text{     text:"xte"     font.family: segoe_light.name     font.pointsize: 85     anchors.horizontalcenter: parent.horizontalcenter     y:70 }  textfield{     id:registername     style : textfieldstyle {         background:rectangle{             border.color: "#ccc"             radius:17          }     }     width:400     height:50     y:420     font.pointsize: 17     font.family: segoe_light.name     textcolor:"#555"     placeholdertext: " enter nickname ..."     anchors.horizontalcenter: parent.horizontalcenter     //anchors.verticalcenter: parent.verticalcenter  }  text{     id:login     text:"login"     color: "#0084ff"     anchors.horizontalcenter: parent.horizontalcenter     anchors.top: registername.bottom     anchors.topmargin: 17     font.family: segoe_light.name     font.pointsize: 22 }  } 

you can making shadow part of application rather decoration os window manager:

import qtquick 2.4 import qtquick.window 2.2 import qtgraphicaleffects 1.0  window {     id: main     visible: true     width: 300     height: 200     color: "#00000000"     flags: qt.framelesswindowhint | qt.window      rectangle {       id: rect       width: 290       height: 190       x: 5       y: 5     }      dropshadow {       anchors.fill: rect       horizontaloffset: 2       verticaloffset: 2       radius: 5       samples: 5       source: rect       color: "black"     } } 

enter image description here


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -