MCPcopy Create free account
hub / github.com/alpha-liu-01/SpeedyNote / applyStyle

Method applyStyle

source/text/MarkdownNoteEntry.cpp:154–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void MarkdownNoteEntry::applyStyle() {
155 // Styles are primarily loaded from parent sidebar QSS; only dynamic,
156 // per-state properties are set here. Unified gray palette:
157 // dark — base #2d2d2d, hover #3a3e42, frame #4d4d4d
158 // light — base #F5F5F5, hover #E8E8E8, frame #D0D0D0
159 QString bgColor = isDarkMode ? "#2d2d2d" : "#ffffff";
160 QString borderColor = isDarkMode ? "#4d4d4d" : "#D0D0D0";
161 QString textColor = isDarkMode ? "#e6e6e6" : "#1d2939";
162 QString deleteHoverBg = isDarkMode ? "#4d2828" : "#ffccc7";
163
164 // Card styling — square corners so the card flushes with the sharp
165 // #4d4d4d outer frame painted by the notes-tree delegate.
166 setStyleSheet(QString(R"(
167 MarkdownNoteEntry {
168 background-color: %1;
169 border: 1px solid %2;
170 border-radius: 0;
171 }
172 MarkdownNoteEntry:hover {
173 background-color: %3;
174 border-color: %4;
175 }
176 )").arg(bgColor, borderColor,
177 isDarkMode ? "#3a3e42" : "#F5F5F5",
178 isDarkMode ? "#4d4d4d" : "#D0D0D0"));
179
180 // Title edit
181 titleEdit->setStyleSheet(QString(R"(
182 QLineEdit {
183 background: transparent;
184 border: none;
185 font-weight: bold;
186 font-size: 14px;
187 color: %1;
188 padding: 2px 4px;
189 }
190 QLineEdit:focus {
191 background-color: %2;
192 border-radius: 4px;
193 }
194 )").arg(textColor, isDarkMode ? "#3a3e42" : "#F5F5F5"));
195
196 // Edit button
197 editButton->setStyleSheet(QString(R"(
198 QPushButton {
199 background-color: transparent;
200 border: none;
201 border-radius: 12px;
202 }
203 QPushButton:hover {
204 background-color: %1;
205 }
206 QPushButton:pressed {
207 background-color: %2;
208 }
209 )").arg(isDarkMode ? "rgba(255, 255, 255, 0.1)" : "rgba(0, 0, 0, 0.08)",
210 isDarkMode ? "rgba(255, 255, 255, 0.15)" : "rgba(0, 0, 0, 0.15)"));
211

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected