Skip to content

Commit 2fb2238

Browse files
committed
fix: use style file
1 parent 5da50a4 commit 2fb2238

File tree

4 files changed

+88
-35
lines changed

4 files changed

+88
-35
lines changed

files/appdata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package appdata
22

3-
var Version = "v0.2" // Version of the program
3+
var Version = "v0.3" // Version of the program

files/style.go

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package appdata
2+
3+
import "github.com/therecipe/qt/widgets"
4+
5+
func Theme(app *widgets.QApplication) {
6+
app.SetStyleSheet(`
7+
QLabel#titleLabel {
8+
font-size: 24px;
9+
color: black;
10+
padding: 10px;
11+
text-align: center;
12+
}
13+
QPushButton#connecttodbButton {
14+
font-family: "Open Sans", sans-serif;
15+
font-size: 16px;
16+
text-decoration: none;
17+
text-transform: uppercase;
18+
color: #000;
19+
border: 3px solid;
20+
padding: 0.25em 0.5em;
21+
position: relative;
22+
}
23+
24+
QPushButton#connecttodbButton:hover {
25+
background-color: #4CAF50;
26+
color: #fff;
27+
}
28+
QPushButton#connecttodbButton:active{
29+
top: 5px;
30+
left: 5px;
31+
}
32+
33+
.button-64 {
34+
align-items: center;
35+
background-image: linear-gradient(144deg,#AF40FF, #5B42F3 50%,#00DDEB);
36+
border: 0;
37+
border-radius: 8px;
38+
color: #FFFFFF;
39+
display: flex;
40+
font-family: Phantomsans, sans-serif;
41+
font-size: 20px;
42+
justify-content: center;
43+
line-height: 1em;
44+
max-width: 100%;
45+
min-width: 140px;
46+
padding: 3px;
47+
text-decoration: none;
48+
}
49+
50+
.button-64:active,
51+
.button-64:hover {
52+
outline: 0;
53+
}
54+
55+
.button-64 span {
56+
background-color: rgb(5, 6, 45);
57+
padding: 16px 24px;
58+
border-radius: 6px;
59+
width: 100%;
60+
height: 100%;
61+
}
62+
63+
.button-64:hover span {
64+
background: none;
65+
}
66+
67+
@media (min-width: 768px) {
68+
.button-54 {
69+
padding: 0.25em 0.75em;
70+
}
71+
QPushButton#connectButton {
72+
background-color: #3a86ff;
73+
color: white;
74+
font-size: 36px;
75+
}
76+
QPushButton#executeButton {
77+
background-color: #3a86ff;
78+
color: white;
79+
font-size: 14px;
80+
}
81+
}
82+
`)
83+
}

files/theme.go

Lines changed: 0 additions & 30 deletions
This file was deleted.

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ func (w *MainWindow) initUI() {
8585

8686
w.titleLabel.SetObjectName("titleLabel")
8787

88-
w.connecttodbButton.SetObjectName("connecttodbButton")
89-
w.connecttodbButton = widgets.NewQPushButton2("Connect to DB", nil)
88+
w.connecttodbButton = widgets.NewQPushButton2("Connect to database", nil)
9089
w.connecttodbButton.ConnectClicked(w.buttonClicked2)
90+
w.connecttodbButton.SetObjectName("connecttodbButton")
9191

9292
w.hostLabel = widgets.NewQLabel2("Host:", nil, 0)
9393
w.hostLabel.SetAlignment(core.Qt__AlignCenter)
@@ -127,12 +127,12 @@ func (w *MainWindow) initUI() {
127127
w.sqlEntry = widgets.NewQTextEdit(nil)
128128
w.sqlEntry.SetFont(gui.NewQFont2("Arial", 18, 1, false))
129129

130-
w.exitButton = widgets.NewQPushButton2("Exit", nil)
130+
w.exitButton = widgets.NewQPushButton2("Back", nil)
131131
w.exitButton.ConnectClicked(w.exitDatabase)
132132

133133
w.executeButton = widgets.NewQPushButton2("Execute SQL", nil)
134134
w.executeButton.ConnectClicked(w.executeSQL)
135-
w.executeButton.SetStyleSheet("background-color: #3a86ff; color: white; font-size: 14px;")
135+
w.executeButton.SetObjectName("executeButton")
136136

137137
w.statusLabel = widgets.NewQLabel(nil, 0)
138138
w.statusLabel.SetAlignment(core.Qt__AlignCenter)

0 commit comments

Comments
 (0)