Skip to content

Commit 3708091

Browse files
committed
button padding fix
1 parent 0480026 commit 3708091

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

src/tools.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
#define BGDIR "/usr/share/pardus/pardus-pen/backgrounds"
1616
#endif
1717

18-
#define butsize 48*scale
1918
#define padding 8*scale
2019

20+
#define butsize (48*scale + padding)
21+
2122
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
2223
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
2324

src/tools/mainWindow.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ void setupTools(){
157157
tool->setAttribute(Qt::WA_NoSystemBackground, true);
158158
tool->setStyleSheet(
159159
"background: none;"
160-
"color: black;"
161-
"font-size: "+QString::number(18*scale)+"px;"
162160
);
163161

164162
// second toolbar
@@ -173,8 +171,6 @@ void setupTools(){
173171
tool2->setAttribute(Qt::WA_NoSystemBackground, true);
174172
tool2->setStyleSheet(
175173
"background: none;"
176-
"color: black;"
177-
"font-size: "+QString::number(18*scale)+"px;"
178174
);
179175
floatingSettings = new FloatingSettings(tool2);
180176
floatingWidget = new FloatingWidget(tool);

src/widgets/Button.cpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ QPushButton* create_button_text(const char* name, ButtonEvent event) {
2323
};
2424
QObject::connect(button, &QPushButton::clicked, events[button]);
2525
}
26-
QFont font = button->font();
27-
font.setPointSize(18*scale);
28-
button->setFont(font);
29-
button->setStyleSheet(QString("background-color: none;"));
26+
button->setStyleSheet(
27+
"background-color: none;"
28+
);
3029

3130
return button;
3231
}
@@ -40,10 +39,7 @@ QPushButton* create_button(int id, ButtonEvent event) {
4039
QObject::connect(button, &QPushButton::clicked, events[button]);
4140
}
4241
set_icon(get_icon_by_id(id), button);
43-
QFont font = button->font();
44-
font.setPointSize(18*scale);
4542
button->setFixedSize(butsize, butsize);
46-
button->setFont(font);
4743
button->setStyleSheet(QString("background-color: none;"));
4844
return button;
4945
}
@@ -113,15 +109,15 @@ void set_icon(const char* name, QPushButton * button) {
113109
QIcon icon = QIcon(name);
114110
QPixmap pixmap = icon.pixmap(QSize(butsize, butsize));
115111
button->setIcon(icon);
116-
button->setIconSize(QSize(butsize, butsize));
112+
button->setIconSize(QSize(butsize - padding, butsize - padding));
117113
button->setFlat(true);
118114
}
119115

120116
void set_icon_combined(const char* name, const char* subname, QPushButton * button){
121117
QIcon icon = combineIcons(QIcon(name), QIcon(subname));
122118
QPixmap pixmap = icon.pixmap(QSize(butsize, butsize));
123119
button->setIcon(icon);
124-
button->setIconSize(QSize(butsize, butsize));
120+
button->setIconSize(QSize(butsize - padding, butsize - padding));
125121
button->setFlat(true);
126122
}
127123

src/widgets/FloatingSettings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ FloatingSettings::FloatingSettings(QWidget *parent) : QWidget(parent) {
3535
"QWidget {"
3636
"border-radius: "+QString::number(13*scale)+"px;"
3737
"color: #000000;"
38-
"font: "+QString::number(18*scale)+"px;"
38+
"font-size: "+QString::number(22*scale)+"px;"
3939
// "background-color: #f3232323;"
4040
"background: none;"
4141
"}"

0 commit comments

Comments
 (0)