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.
Printable View
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.
Hi. What is problems? :)
Code:
#ifndef FINDDIALOG_H_055 #define FINDDIALOG_H_055 #include <QDialog> class QCheckBox; class QLabel; class QLineEdit; class QPushButton; { Q_OBJECT; public: signals: void findNext(const QString& str, Qt::CaseSensitivity cs); void findPrev(const QString& str, Qt::CaseSensitivity cs); private slots: void findClicked(); void enableFindButton(const QString& text); private: QLabel* label; QLineEdit* lineEdit; QCheckBox* caseCheckBox; QCheckBox* backwardCheckBox; QPushButton* findButton; QPushButton* closeButton; }; #endif // FINDDIALOG_H_055
Code:
#include <QtGui> #include "Finddialog.h" { label -> setBuddy(lineEdit); findButton -> setDefault(true); findButton -> setEnabled(false); connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(enableFindButton(const QString&))); connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked())); connect(closeButton, SIGNAL(clicked()), this, SLOT(close())); topLeftLayout -> addWidget(label); topLeftLayout -> addWidget(lineEdit); leftLayout -> addLayout(topLeftLayout); leftLayout -> addWidget(caseCheckBox); leftLayout -> addWidget(backwardCheckBox); rightLayout -> addWidget(findButton); rightLayout -> addWidget(closeButton); rightLayout -> addStretch(); mainLayout -> addLayout(leftLayout); mainLayout -> addLayout(rightLayout); setLayout(mainLayout); setWindowTitle(tr("Find")); setFixedHeight(sizeHint().height()); } void FindDialog::findClicked() { Qt::CaseSensitivity cs = caseCheckBox -> isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive; if(backwardCheckBox -> isChecked()) emit findPrev(text, cs); else emit findNext(text, cs); } void FindDialog::enableFindButton(const QString& text) { findButton -> setEnabled(!text.isEmpty()); }
Compile by MinGW!Code:
#include <QApplication> #include "Finddialog.h" int main(int argc, char* argv[]) { FindDialog* dialog = new FindDialog; dialog -> show(); return app.exec(); }
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.
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.
Can anybody know how to make NSSearchField using Qt4.3