本文整理汇总了C++中QListWidget::setFont方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidget::setFont方法的具体用法?C++ QListWidget::setFont怎么用?C++ QListWidget::setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidget
的用法示例。
在下文中一共展示了QListWidget::setFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setStyle("cleanlooks");
#if 0
if (!QSystemTrayIcon::isSystemTrayAvailable())
{
QMessageBox::critical
(
0,
QObject::tr("Systray"),
QObject::tr("There is no system tray on this system.")
);
return 1;
}
QApplication::setQuitOnLastWindowClosed(false);
#endif
#if 0
Allegrex::create_instructions_directory();
Allegrex::create_interpreter_directory();
Allegrex::create_disassembler_directory();
QPspe4all w;
w.show();
#else
if (true/*emulator.check_integrity()*/)
{
QPspe4all w;
w.show();
psp::memw(0x00010000) = 0xDEADBEEF;
psp::memw(0x04000000) = 0xDEADC0DE;
psp::memw(0x08000000) = 0xE117C0DE;
QStringList list;
#define IDEF(n, m, s, x) list.append(QString("%1/%2 : %3").arg(uint(s), 8, 16, QChar('0')).arg(uint(m), 8, 16, QChar('0')).arg(Allegrex::decode_instruction(s)->opcode_name()));
#include "emulator/allegrex/allegrex.def"
#undef IDEF
QListWidget l;
l.setFont(QFont("Terminal"));
l.insertItems(0, list);
l.show();
return a.exec();
}
#endif
return a.exec();
return 1;
}
示例2: createView
void CMainWnd::createView(XMLConfig *pXMLConfig, const DOMNode *pNode) {
QWidget *pTab; QListWidget *pListWidget = 0;
pTab = new QWidget(m_pTabContainer);
pListWidget = new QListWidget(pTab);
pListWidget->setGeometry(QRect(5, 5, pXMLConfig->gattr("view:width").toUInt() - 32, pXMLConfig->gattr("view:height").toUInt() - 56));
pListWidget->setSelectionMode(QAbstractItemView::NoSelection);
pListWidget->setFont(QFont("courier new", 9));
m_pTabContainer->insertTab(0, pTab, pXMLConfig->attr(pNode, "caption"));
QString sTmp = pXMLConfig->attr(pNode, "id");
m_mViews[sTmp.right(sTmp.length() - 1).toUShort()] = pListWidget;
}
示例3: KDialog
static mpdm_t kde4_drv_form(mpdm_t a, mpdm_t ctxt)
{
int n;
mpdm_t widget_list;
QWidget *qlist[100];
mpdm_t r;
KDialog *dialog = new KDialog(window);
dialog->setModal(true);
dialog->setButtons(KDialog::Ok | KDialog::Cancel);
widget_list = mpdm_aget(a, 0);
KVBox *vb = new KVBox(dialog);
dialog->setMainWidget(vb);
for (n = 0; n < mpdm_size(widget_list); n++) {
mpdm_t w = mpdm_aget(widget_list, n);
wchar_t *type;
mpdm_t t;
KHBox *hb = new KHBox(vb);
type = mpdm_string(mpdm_hget_s(w, L"type"));
if ((t = mpdm_hget_s(w, L"label")) != NULL) {
QLabel *ql = new QLabel(hb);
ql->setText(str_to_qstring(mpdm_gettext(t)));
}
t = mpdm_hget_s(w, L"value");
if (wcscmp(type, L"text") == 0) {
mpdm_t h;
QComboBox *ql = new QComboBox(hb);
ql->setEditable(true);
ql->setMinimumContentsLength(30);
ql->setMaxVisibleItems(8);
if (t != NULL)
ql->setEditText(str_to_qstring(t));
qlist[n] = ql;
if ((h = mpdm_hget_s(w, L"history")) != NULL) {
int i;
/* has history; fill it */
h = mp_get_history(h);
for (i = mpdm_size(h) - 1; i >= 0; i--)
ql->addItem(str_to_qstring(mpdm_aget(h, i)));
}
}
else
if (wcscmp(type, L"password") == 0) {
QLineEdit *ql = new QLineEdit(hb);
ql->setEchoMode(QLineEdit::Password);
qlist[n] = ql;
}
else
if (wcscmp(type, L"checkbox") == 0) {
QCheckBox *qc = new QCheckBox(hb);
if (mpdm_ival(t))
qc->setCheckState(Qt::Checked);
qlist[n] = qc;
}
else
if (wcscmp(type, L"list") == 0) {
int i;
QListWidget *ql = new QListWidget(hb);
ql->setMinimumWidth(480);
/* use a monospaced font */
ql->setFont(QFont(QString("Mono")));
mpdm_t l = mpdm_hget_s(w, L"list");
for (i = 0; i < mpdm_size(l); i++)
ql->addItem(str_to_qstring(mpdm_aget(l, i)));
ql->setCurrentRow(mpdm_ival(t));
qlist[n] = ql;
}
if (n == 0)
qlist[n]->setFocus(Qt::OtherFocusReason);
}
n = dialog->exec();
if (!n)
return NULL;
//.........这里部分代码省略.........