Results 1 to 3 of 3

Thread: Search box?

  1. #1
    Join Date
    Feb 2007
    Posts
    27
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Search box?

    Mac OS X has a "search field" control. Is there a way to do something like this in Qt, both on Mac OS X and Windows? (I don't care about a pixel-by-pixel match, but the icon inside the edit looks great.)

    Apple's description of this search field is here.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Search box?

    Yes, it's possible. Use a QLineEdit and a stylesheet that changes the padding and sets a background image to the padded rectangle. Alternatively place QToolButtons (or QLabel if you don't want the icons clickable) and a QLineEdit in a horizontal layout with 0 spacing.

    A crude example attached. Obtained with the following stylesheet:
    css Code:
    1. padding-right: 20px;
    2. padding-left: 5px;
    3. background: url(/usr/share/icons/crystalsvg/16x16/actions/exit.png);
    4. background-position: right;
    5. background-repeat: no-repeat;
    6.  
    7. border: 1px solid black;
    8. border-radius: 10px;
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Last edited by wysota; 19th March 2007 at 00:26.

  3. The following user says thank you to wysota for this useful post:

    sdfisher (19th March 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    27
    Thanks
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Search box?

    Awesome. The one thing I needed to change was to put the whole style sheet in a QLineEdit{ } element. Otherwise, the right click menu showed the icon on each menu item.

Similar Threads

  1. How to search a string in xml file with Qt Dom classes
    By doganay44 in forum Qt Programming
    Replies: 2
    Last Post: 5th October 2006, 20:16
  2. Text search utility
    By NewGuy in forum Newbie
    Replies: 7
    Last Post: 23rd July 2006, 11:59
  3. Replies: 1
    Last Post: 18th July 2006, 10:53
  4. The Methods of quick search...
    By Xagen in forum General Discussion
    Replies: 1
    Last Post: 27th February 2006, 19:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.