def __init__(self, parent=None): ''' Constructor ''' super(MultipleCppEditor, self).__init__(parent) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.DefaultKeywords = getLibraryKeywords() self.findDlg = FindDialog(self) self.setAcceptDrops(True) #self.setTabShape(QtGui.QTabWidget.Triangular) self.setMovable(True) self.setTabsClosable(True) self.sampleProjects = [] try: for group in getExampleProjects(scanFirmwareLibs()): for fname in group[1]: self.sampleProjects.append(fname) # print self.sampleProjects except: pass self.Outline = OutLineView(self) self.connect(self, QtCore.SIGNAL('tabCloseRequested(int)'), self.closeFile) self.connect(self, QtCore.SIGNAL('currentChanged(int)'), self.Outline.update) if self.count() == 0: self.newFile()
def find(self): if (self.findDialog == None): self.findDialog = FindDialog(self) # connect(findDialog, SIGNAL(findNext(const QString &, # Qt.CaseSensitivity)), # spreadsheet, SLOT(findNext(const QString &, # Qt.CaseSensitivity))) # connect(findDialog, SIGNAL(findPrevious(const QString &, # Qt.CaseSensitivity)), # spreadsheet, SLOT(findPrevious(const QString &, # Qt.CaseSensitivity))) # # self.findDialog.show() # self.findDialog.raise() # self.findDialog.activateWindow() pass
bool MainWindow::saveAs() { QString fileName = QFileDialog::getSaveFileName(this, tr("Save Spreadsheet"), ".", tr("Spreadsheet files (*.sp)")); if (fileName.isEmpty()) return false; return saveFile(fileName); } void MainWindow::find() { if (!findDialog) { findDialog = new FindDialog(this); connect(findDialog, SIGNAL(findNext(const QString &, Qt::CaseSensitivity)), spreadsheet, SLOT(findNext(const QString &, Qt::CaseSensitivity))); connect(findDialog, SIGNAL(findPrevious(const QString &, Qt::CaseSensitivity)), spreadsheet, SLOT(findPrevious(const QString &, Qt::CaseSensitivity))); } findDialog->show(); findDialog->raise(); findDialog->activateWindow(); }
from PyQt4.QtGui import QApplication from finddialog import FindDialog import sys if __name__ == "__main__": app = QApplication(sys.argv) dialog = FindDialog() dialog.show() app.exec_()