Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search Box in QToolbar

Does anybody knows how to make a good search box in Qt (actualy PyQt). It should sit in the toolbar (QToolbar) and look a little different than your normal QLineEdit (rounded corners and an icon as prefix). It should be aligned right with a blank space between the rest of the controls. All tips welcome!

like image 549
Wim Verhavert Avatar asked Nov 01 '25 01:11

Wim Verhavert


1 Answers

To style a QLineEdit, see the official Qt Documentation. Look for "Qt Style Sheets Examples" and then "Customizing QLineEdit". For Qt 6.5, it's here: https://doc.qt.io/qt-6/stylesheet-examples.html

For the spacing, you can try adding a separator (see QToolBar docs) or add a left margin in the style sheet.

like image 194
Aaron Digulla Avatar answered Nov 03 '25 00:11

Aaron Digulla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!