fix: use theme colors for button icons#949
Conversation
|
CodeAnt AI is reviewing your PR. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThree QPushButton-derived classes now set their foreground role to QPalette::ButtonText after initializing their icons. The show-password button also swaps icon theme keys to "visibility" / "visibility-off". MainWindow::addToGridLayout updates button stylesheets to include Changes
Sequence Diagram(s)(omitted) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
CodeAnt AI finished reviewing your PR. |
|
It's still black . . |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #949 +/- ##
==========================================
+ Coverage 27.13% 27.20% +0.06%
==========================================
Files 39 39
Lines 3258 3261 +3
==========================================
+ Hits 884 887 +3
Misses 2374 2374
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a991624 to
7463833
Compare
|
CodeAnt AI is running Incremental review |
|
CodeAnt AI Incremental review completed. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/mainwindow.cpp`:
- Around line 1275-1276: The QR and copy button style strings are missing
"color: inherit" which makes them stay black in dark mode; update the style
declarations for the QR button and the copy button to include "color: inherit"
(matching the show-password button's style string "border-style: none;
background: transparent; padding: 0; margin: 0; icon-size: 16px; color:
inherit;") so all three buttons inherit text color for dark-mode support.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 406e2b29-125e-4816-a8c5-36d89d440922
📒 Files selected for processing (4)
src/mainwindow.cppsrc/qpushbuttonasqrcode.cppsrc/qpushbuttonshowpassword.cppsrc/qpushbuttonwithclipboard.cpp
7463833 to
e37011b
Compare
There was a problem hiding this comment.
♻️ Duplicate comments (1)
src/mainwindow.cpp (1)
1275-1276:⚠️ Potential issue | 🟠 MajorApply the same inherited color styling to copy/QR buttons too.
At Line 1275 only the show-password button gets
color: inherit; the copy button (Line 1245) and QR button (Line 1254) still use the old style string, which explains the “still black” behavior in dark themes.Proposed fix
- fieldLabel->setStyleSheet( - "border-style: none ; background: transparent; padding: 0; margin: 0;"); + fieldLabel->setStyleSheet( + "border-style: none; background: transparent; padding: 0; margin: 0; " + "icon-size: 16px; color: inherit;"); @@ - qrbutton->setStyleSheet( - "border-style: none ; background: transparent; padding: 0; margin: 0;"); + qrbutton->setStyleSheet( + "border-style: none; background: transparent; padding: 0; margin: 0; " + "icon-size: 16px; color: inherit;");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/mainwindow.cpp` around lines 1275 - 1276, The copy and QR button style strings need to match the show-password button so they inherit theme colors; update the style assignment used for the copy button and the QR button to include "color: inherit" (and keep the existing "border-style: none; background: transparent; padding: 0; margin: 0; icon-size: 16px;") so their style strings mirror the show-password button's style and stop rendering black in dark themes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@src/mainwindow.cpp`:
- Around line 1275-1276: The copy and QR button style strings need to match the
show-password button so they inherit theme colors; update the style assignment
used for the copy button and the QR button to include "color: inherit" (and keep
the existing "border-style: none; background: transparent; padding: 0; margin:
0; icon-size: 16px;") so their style strings mirror the show-password button's
style and stop rendering black in dark themes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: c6b1a73f-de31-41bc-9108-82cd5e45e70f
📒 Files selected for processing (4)
src/mainwindow.cppsrc/qpushbuttonasqrcode.cppsrc/qpushbuttonshowpassword.cppsrc/qpushbuttonwithclipboard.cpp
e37011b to
733c7d2
Compare
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/qpushbuttonshowpassword.cpp (1)
17-23:⚠️ Potential issue | 🟠 MajorShow-password button is missing explicit
ButtonTextforeground role.The constructor in
src/qpushbuttonshowpassword.cppnever callssetForegroundRole(QPalette::ButtonText), while both peer button constructors (QPushButtonAsQRCodeandQPushButtonWithClipboard) include this call. This inconsistency can leave the icon rendering with incorrect colors in dark themes, defeating the PR's theme-aware icon intent.Proposed fix
QIcon::fromTheme("visibility-off", QIcon(":/icons/hide.svg"))) { setIcon(iconEdit); + setForegroundRole(QPalette::ButtonText); connect(this, &QPushButton::clicked, this, &QPushButtonShowPassword::buttonClicked); this->line = line; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/qpushbuttonshowpassword.cpp` around lines 17 - 23, The QPushButtonShowPassword constructor is missing a call to set the palette role for icon coloring: add a call to setForegroundRole(QPalette::ButtonText) inside the QPushButtonShowPassword constructor (the same place where iconEdit and iconEditPushed are set and connect is called) so the button's icon uses the ButtonText role in dark themes (consistent with QPushButtonAsQRCode and QPushButtonWithClipboard).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@src/qpushbuttonshowpassword.cpp`:
- Around line 17-23: The QPushButtonShowPassword constructor is missing a call
to set the palette role for icon coloring: add a call to
setForegroundRole(QPalette::ButtonText) inside the QPushButtonShowPassword
constructor (the same place where iconEdit and iconEditPushed are set and
connect is called) so the button's icon uses the ButtonText role in dark themes
(consistent with QPushButtonAsQRCode and QPushButtonWithClipboard).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: b96009f5-3e8f-4f81-b9ee-11ec81dd1553
📒 Files selected for processing (4)
src/mainwindow.cppsrc/qpushbuttonasqrcode.cppsrc/qpushbuttonshowpassword.cppsrc/qpushbuttonwithclipboard.cpp
733c7d2 to
5912503
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/mainwindow.cpp`:
- Around line 1245-1246: Extract the duplicated inline stylesheet string into a
single constant (e.g., kButtonStyle or BUTTON_STYLESHEET) and replace the three
identical literal occurrences with that constant; update the usages where the
string is passed to the button setup (the places around the existing inline
strings and the other occurrences noted at the same pattern at lines referenced
in the review) so all buttons use the single constant to avoid drift between
"border-style: none; background: transparent; padding: 0; margin: 0; icon-size:
16px; color: inherit;". Ensure the constant is defined in the same translation
unit/scope that covers the callers so no public API changes are required.
In `@src/qpushbuttonshowpassword.cpp`:
- Around line 17-19: Replace the non-standard icon names used when constructing
iconEdit and iconEditPushed so themes can provide proper icons: change
QIcon::fromTheme("visibility", ...) to use a verified name such as
"password-show-on" with a fallback like "view-reveal-symbolic", and change
QIcon::fromTheme("visibility-off", ...) to "password-show-off" with a fallback
like "view-conceal-symbolic"; update the iconEdit and iconEditPushed
initializers to call QIcon::fromTheme with the chosen verified name and keep the
existing embedded SVG fallback unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0a35cc33-833d-466b-83f7-11e86d175091
📒 Files selected for processing (4)
src/mainwindow.cppsrc/qpushbuttonasqrcode.cppsrc/qpushbuttonshowpassword.cppsrc/qpushbuttonwithclipboard.cpp
5912503 to
10fde45
Compare
Use a single buttonStyle constant instead of duplicated inline strings.
10fde45 to
e928465
Compare
User description
Summary
Add setForegroundRole(QPalette::ButtonText) to make eye, QR code, and clipboard icons theme-aware instead of hardcoded black in dark mode.
Fixes icons appearing black in dark mode for:
Summary by CodeRabbit
Bug Fixes
Style
CodeAnt-AI Description
Use theme colors for action icons in dark mode
What Changed
Impact
✅ Clearer dark mode icons✅ Fewer unreadable action buttons✅ More consistent theme appearance💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.