Results 1 to 6 of 6

Thread: How to make Search Dialog as it is used by MAC O.S

  1. #1
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to make Search Dialog as it is used by MAC O.S

    Hi all

    Working on MAC OS using Qt4.2 , I want to make a Search Dialog using Qt as it is used by the MAC O.S.

    I dont have any idea from where should I start.

    If anybody is having any idea abt dis then pls provide me some hints.
    Always Believe in Urself
    Merry

  2. #2
    Join Date
    Jun 2008
    Location
    Saint-Petersburg
    Posts
    50
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to make Search Dialog as it is used by MAC O.S

    Quote Originally Posted by merry View Post
    Working on MAC OS using Qt4.2 , I want to make a Search Dialog using Qt as it is used by the MAC O.S.
    I dont have any idea from where should I start.
    Hi. What is problems?
    Qt Code:
    1. #ifndef FINDDIALOG_H_055
    2. #define FINDDIALOG_H_055
    3.  
    4. #include <QDialog>
    5.  
    6. class QCheckBox;
    7. class QLabel;
    8. class QLineEdit;
    9.  
    10. class FindDialog: public QDialog
    11. {
    12. Q_OBJECT;
    13.  
    14. public:
    15. FindDialog(QWidget* parent=0);
    16.  
    17. signals:
    18. void findNext(const QString& str, Qt::CaseSensitivity cs);
    19. void findPrev(const QString& str, Qt::CaseSensitivity cs);
    20.  
    21. private slots:
    22. void findClicked();
    23. void enableFindButton(const QString& text);
    24.  
    25. private:
    26. QLabel* label;
    27. QLineEdit* lineEdit;
    28. QCheckBox* caseCheckBox;
    29. QCheckBox* backwardCheckBox;
    30. QPushButton* findButton;
    31. QPushButton* closeButton;
    32. };
    33.  
    34. #endif // FINDDIALOG_H_055
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #include <QtGui>
    2.  
    3. #include "Finddialog.h"
    4.  
    5. FindDialog::FindDialog(QWidget* parent)
    6. : QDialog(parent)
    7. {
    8. label = new QLabel(tr("Find &what:"));
    9. lineEdit = new QLineEdit;
    10. label -> setBuddy(lineEdit);
    11.  
    12. caseCheckBox = new QCheckBox(tr("Match &case"));
    13. backwardCheckBox = new QCheckBox(tr("Search bacward"));
    14.  
    15. findButton = new QPushButton(tr("&Find"));
    16. findButton -> setDefault(true);
    17. findButton -> setEnabled(false);
    18.  
    19. closeButton = new QPushButton(tr("Close"));
    20.  
    21. connect(lineEdit, SIGNAL(textChanged(const QString&)),
    22. this, SLOT(enableFindButton(const QString&)));
    23. connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
    24. connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
    25.  
    26. QHBoxLayout *topLeftLayout = new QHBoxLayout;
    27. topLeftLayout -> addWidget(label);
    28. topLeftLayout -> addWidget(lineEdit);
    29.  
    30. QVBoxLayout *leftLayout = new QVBoxLayout;
    31. leftLayout -> addLayout(topLeftLayout);
    32. leftLayout -> addWidget(caseCheckBox);
    33. leftLayout -> addWidget(backwardCheckBox);
    34.  
    35. QVBoxLayout *rightLayout = new QVBoxLayout;
    36. rightLayout -> addWidget(findButton);
    37. rightLayout -> addWidget(closeButton);
    38. rightLayout -> addStretch();
    39.  
    40. QHBoxLayout *mainLayout = new QHBoxLayout;
    41. mainLayout -> addLayout(leftLayout);
    42. mainLayout -> addLayout(rightLayout);
    43. setLayout(mainLayout);
    44.  
    45. setWindowTitle(tr("Find"));
    46. setFixedHeight(sizeHint().height());
    47. }
    48.  
    49. void FindDialog::findClicked()
    50. {
    51. QString text = lineEdit -> text();
    52. Qt::CaseSensitivity cs = caseCheckBox -> isChecked() ? Qt::CaseSensitive
    53. : Qt::CaseInsensitive;
    54. if(backwardCheckBox -> isChecked())
    55. emit findPrev(text, cs);
    56. else
    57. emit findNext(text, cs);
    58. }
    59.  
    60. void FindDialog::enableFindButton(const QString& text)
    61. {
    62. findButton -> setEnabled(!text.isEmpty());
    63. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. #include <QApplication>
    2.  
    3. #include "Finddialog.h"
    4.  
    5. int main(int argc, char* argv[])
    6. {
    7. QApplication app(argc, argv);
    8. FindDialog* dialog = new FindDialog;
    9. dialog -> show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    Compile by MinGW!

  3. #3
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to make Search Dialog as it is used by MAC O.S

    Thanx 4 replying, But I dont want to make it as a separate application, I want to make as it is used by the MAC , that is search used in macintosh style.
    Always Believe in Urself
    Merry

  4. #4
    Join Date
    Jun 2008
    Location
    Saint-Petersburg
    Posts
    50
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to make Search Dialog as it is used by MAC O.S

    Quote Originally Posted by merry View Post
    Thanx 4 replying, But I dont want to make it as a separate application, I want to make as it is used by the MAC , that is search used in macintosh style.
    class FindDialog is used for your aim! You may this class in your aplications! I don't understand you! Why this class isn't use in your application?

  5. #5
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to make Search Dialog as it is used by MAC O.S

    Actually i dont want to use it as a separate dialog in my application, I just want that when I enter text in the text box and presse enter key,then It displays all the result related to the text in the tree widget.

    Pls preview the attachment, I want same for my application, like same box in which text to be find is written with same icon on the left and same close button on the right of the box in which text to be find is written.
    Attached Images Attached Images
    Always Believe in Urself
    Merry

  6. #6
    Join Date
    Jan 2007
    Posts
    326
    Thanks
    42
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to make Search Dialog as it is used by MAC O.S

    Can anybody know how to make NSSearchField using Qt4.3
    Always Believe in Urself
    Merry

Similar Threads

  1. Qt 4.4.0 Help Module : Search not working
    By Ankitha Varsha in forum Qt Programming
    Replies: 0
    Last Post: 22nd May 2008, 08:45
  2. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  3. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57
  4. Replies: 1
    Last Post: 18th July 2006, 10:53
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.