Adjust titlebar

pull/10/head
reionwong 3 years ago
parent 552126fb6c
commit fab98980ef

@ -74,15 +74,15 @@ void Button::paint(QPainter *painter, const QRect &repaintRegion)
painter->setRenderHint(QPainter::SmoothPixmapTransform, false);
painter->setRenderHints(QPainter::Antialiasing, true);
QRect btnRect(0, 0, 29 * decoration->devicePixelRatio(),
29 * decoration->devicePixelRatio());
QRect btnRect(0, 0, 28 * decoration->devicePixelRatio(),
28 * decoration->devicePixelRatio());
btnRect.moveCenter(rect.center());
if (isHovered() || isPressed()) {
painter->setPen(Qt::NoPen);
painter->setBrush(isDarkMode ? isPressed() ? QColor(255, 255, 255, 255 * 0.1) : QColor(255, 255, 255, 255 * 0.15)
: isPressed() ? QColor(0, 0, 0, 255 * 0.15) : QColor(0, 0, 0, 255 * 0.1));
painter->drawRoundedRect(btnRect, btnRect.height() / 2, btnRect.height() / 2);
painter->drawRoundedRect(btnRect.adjusted(2, 2, -2, -2), btnRect.height() / 2, btnRect.height() / 2);
}
switch (type()) {

@ -229,8 +229,8 @@ void Decoration::updateButtonsGeometryDelayed()
void Decoration::updateButtonsGeometry()
{
auto s = settings();
auto c = client().toStrongRef().data();
int rightMargin = 4;
// auto c = client().toStrongRef().data();
int rightMargin = 2;
int btnSpacing = 8;
foreach (const QPointer<KDecoration2::DecorationButton> &button, m_leftButtons->buttons() + m_rightButtons->buttons()) {
@ -329,7 +329,7 @@ void Decoration::updateShadow()
void Decoration::updateBtnPixmap()
{
int size = 30;
int size = 28;
QString dirName = darkMode() ? "dark" : "light";
m_closeBtnPixmap = fromSvgToPixmap(QString(":/images/%1/close_normal.svg").arg(dirName), QSize(size, size));

@ -16,6 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// KDecoration
@ -91,7 +92,7 @@ private:
friend class MinimizeButton;
private:
int m_titleBarHeight = 33;
int m_titleBarHeight = 30;
int m_frameRadius = 11;
qreal m_devicePixelRatio = 1.0;
QColor m_titleBarBgColor = QColor(255, 255, 255, 255);

Loading…
Cancel
Save