开发者

Qt: How to determine location / alignment of task bar

开发者 https://www.devze.com 2023-03-11 02:01 出处:网络
what is the best way to determine location of task bar using Qt ? What I need is the alignment (left,right,top,bottm) and bounderies (left,right,width,height)

what is the best way to determine location of task bar using Qt ?

What I need is the alignment (left,right,top,bottm) and bounderies (left,right,width,height)

Thanks 开发者_如何学Gofor help in advance :-)


You can infer the orientation of the task bar by comparing the dimensions of the screen against the dimensions of the desktop

def get_task_bar_position(self):
    desktop = QtWidgets.QDesktopWidget()
    displayRect = desktop.screenGeometry()
    desktopRect = desktop.availableGeometry()
    if desktopRect.height() < displayRect.height():
        if desktopRect.y() > displayRect.y():
            return 'TOP'
        else:
            return 'BOTTOM'
    else:
        if desktopRect.x() > displayRect.x():
            return 'LEFT'
        else:
            return 'RIGHT'


I think Qt does not provide this facility. You will probably have to resort to the WinAPI to get this information.

See: http://msdn.microsoft.com/en-us/library/bb762108%28v=vs.85%29.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消