1

在下图中,红色矩形是菜单栏。我想在绿色矩形所在的位置创建关闭按钮,但我不知道该怎么做。有什么建议么?我想让 UI 看起来像 Adob​​e Photoshop CS6?

截屏

4

2 回答 2

3

QMenuBar 小部件有一个方法“setCornerWidget”,你可以像这样做你想做的事:

    // Hiden Window Title
    setWindowFlags(Qt::FramelessWindowHint);

    // Set widget on the top left corner
    QPushButton* menuTopRightButton = new QPushButton("TL", m_menubar);
    m_menubar->setCornerWidget(menuTopRightButton, Qt::TopLeftCorner);

    // Set widget on the top right corner
    QPushButton* menuTopLeftButton = new QPushButton("TR", m_menubar);
    m_menubar->setCornerWidget(menuTopRightButton, Qt::TopRightCorner);
于 2017-06-15T12:50:38.613 回答
-1
#closeButton {
position: absolute;
height:20px;
width:100px;
background:red;
float:right;
position:absolute;
right:0px;
top:0px;
}

http://jsfiddle.net/6U5p8/

于 2014-03-03T12:49:14.403 回答