Exemplo n.º 1
0
            if index:
                tv.setCurrentIndex(index)
                return
        tv.clearSelection()

    app = QApplication([])

    model = treeModel()
    dialog = QDialog()

    dialog.setMinimumSize(300, 150)
    layout = QVBoxLayout(dialog)

    tv = QTreeView(dialog)
    tv.setModel(model)
    tv.setAlternatingRowColors(True)
    layout.addWidget(tv)

    label = QLabel("Search for the following person")
    layout.addWidget(label)

    buts = []
    frame = QFrame(dialog)
    layout2 = QHBoxLayout(frame)

    for person in model.people:
        but = QPushButton(person.fname, frame)
        buts.append(but)
        layout2.addWidget(but)
        QObject.connect(but, SIGNAL("clicked()"), but_clicked)
Exemplo n.º 2
0
            if index:
                tv.setCurrentIndex(index)
                return
        tv.clearSelection()

    app = QApplication([])

    model = treeModel()
    dialog = QDialog()

    dialog.setMinimumSize(300, 150)
    layout = QVBoxLayout(dialog)

    tv = QTreeView(dialog)
    tv.setModel(model)
    tv.setAlternatingRowColors(True)
    layout.addWidget(tv)

    label = QLabel("Search for the following person")
    layout.addWidget(label)

    buts = []
    frame = QFrame(dialog)
    layout2 = QHBoxLayout(frame)

    for person in model.people:
        but = QPushButton(person.fname, frame)
        buts.append(but)
        layout2.addWidget(but)
        QObject.connect(but, SIGNAL("clicked()"), but_clicked)