Skip to content

Commit

Permalink
correcting borders for segmented button item
Browse files Browse the repository at this point in the history
Signed-off-by: KhalilSelyan <[email protected]>
  • Loading branch information
KhalilSelyan committed May 19, 2024
1 parent ef4fa1f commit 18087b7
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "include/custom_segmented_button_item.hpp"

#include <qnamespace.h>

CustomSegmentedButtonItem::CustomSegmentedButtonItem(const QString & text, QWidget * parent)
: QPushButton(text, parent),
bgColor("#0F1417"),
Expand Down Expand Up @@ -106,7 +104,7 @@ void CustomSegmentedButtonItem::paintEvent(QPaintEvent *)

// Draw button background

QRect buttonRect = rect();
QRect buttonRect = rect().adjusted(0, 1, 0, -1);

if (isFirstButton) {
buttonRect.setLeft(buttonRect.left() + 1);
Expand Down Expand Up @@ -141,7 +139,10 @@ void CustomSegmentedButtonItem::paintEvent(QPaintEvent *)
painter.fillPath(path, buttonColor);

// Draw button border
painter.setPen(QPen(QColor("#8a9297"), 2)); // Color for the borders
QPen pen(QColor("#8a9297"), 1);
pen.setJoinStyle(Qt::RoundJoin);
pen.setCapStyle(Qt::RoundCap);
painter.setPen(pen);
painter.drawPath(path.simplified());

// Draw button text
Expand Down

0 comments on commit 18087b7

Please sign in to comment.