Reputation: 91
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?
Upvotes: 1
Views: 2205
Reputation: 91
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);
Upvotes: 3
Reputation: 65
#closeButton {
position: absolute;
height:20px;
width:100px;
background:red;
float:right;
position:absolute;
right:0px;
top:0px;
}
Upvotes: -1