Skip to content

Instantly share code, notes, and snippets.

@coldnew
Last active January 5, 2016 10:09
Show Gist options
  • Select an option

  • Save coldnew/47ca9a14eb24df14950b to your computer and use it in GitHub Desktop.

Select an option

Save coldnew/47ca9a14eb24df14950b to your computer and use it in GitHub Desktop.
Qt example for tarentella
#include <QApplication>
#include <QStringList>
#include <QListWidget>
#include <QRadioButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QListWidget *listWidget = new QListWidget();
listWidget->addItem("A");
listWidget->addItem("B");
QListWidgetItem *it;
it = new QListWidgetItem(listWidget);
listWidget->setItemWidget(it, new QRadioButton("Item 1"));
it = new QListWidgetItem(listWidget);
listWidget->setItemWidget(it, new QRadioButton("Item 2"));
listWidget->show();
return app.exec();
}
#!/usr/bin/env python
from PyQt5.QtWidgets import *
class UI(QListWidget):
def __init__(self, parent=None):
super(UI, self).__init__(parent)
self.addItem("A")
self.addItem("B")
it = QListWidgetItem(self);
self.setItemWidget(it, QRadioButton("Item 1"))
it = QListWidgetItem(self);
self.setItemWidget(it, QRadioButton("Item 2"))
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
screen = UI()
screen.show()
sys.exit(app.exec_())
@coldnew
Copy link
Author

coldnew commented Jan 4, 2016

screen shot 2016-01-04 at 1 01 52 pm

@coldnew
Copy link
Author

coldnew commented Jan 5, 2016

screen shot 2016-01-05 at 6 01 46 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment