1

In the picture below, the red rectangle is the menu bar. I want to create close button where the green rectangle is, but I don't know how can I do that. Any suggestions? I'd like to make the UI look like Adobe Photoshop CS6?

screenshot

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313
delio
  • 91
  • 1
  • 2
  • 9

2 Answers2

3

The QMenuBar widget has a method "setCornerWidget", You can do what you want like this:

    // 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);
LIANG LIU
  • 81
  • 4
-1
#closeButton {
position: absolute;
height:20px;
width:100px;
background:red;
float:right;
position:absolute;
right:0px;
top:0px;
}

http://jsfiddle.net/6U5p8/

douwe12345
  • 65
  • 1
  • 1
  • 7