开发者

Qt: How to determine location / alignment of task bar

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜