Beispiel #1
0
class SearchBox(QFrame):

    def __init__(self, parent = None):
    
        QFrame.__init__(self, parent)
        
        self.ui = Ui_searchForm()
        self.ui.setupUi(self)
        self.setFrameStyle(QFrame.StyledPanel + QFrame.Raised)
        
        self.completion = GSuggestCompletion(self.ui.searchEdit)
        
        self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.doSearch)
        self.connect(self.ui.searchButton, SIGNAL("clicked()"), self.doSearch)
        
        self.adjustSize()
        self.resize(400, self.height())
        self.ui.searchEdit.setFocus()
    
    def doSearch(self):
        self.completion.preventSuggest()
        str = self.ui.searchEdit.text()
        url = QString(GSEARCH_URL).arg(str)
        QDesktopServices.openUrl(QUrl(url))
    
    def keyPressEvent(self, event):
        if event.key() == Qt.Key_Escape:
            self.close()
Beispiel #2
0
 def __init__(self, parent = None):
 
     QFrame.__init__(self, parent)
     
     self.ui = Ui_searchForm()
     self.ui.setupUi(self)
     self.setFrameStyle(QFrame.StyledPanel + QFrame.Raised)
     
     self.completion = GSuggestCompletion(self.ui.searchEdit)
     
     self.connect(self.ui.searchEdit, SIGNAL("returnPressed()"), self.doSearch)
     self.connect(self.ui.searchButton, SIGNAL("clicked()"), self.doSearch)
     
     self.adjustSize()
     self.resize(400, self.height())
     self.ui.searchEdit.setFocus()