?? 8_2.cpp
字號(hào):
#include <qapplication.h>#include <qwidget.h>#include <qlistview.h>class MyMainWindow:public QWidget{ public: MyMainWindow(); private: QListView *listview; QListViewItem *topic1; QListViewItem *topic2; QListViewItem *topic3; QListViewItem *item;};MyMainWindow::MyMainWindow(){ setGeometry(100,100,300,300); listview = new QListView(this); listview->setGeometry(0,0,400,400); listview->setRootIsDecorated(true); listview->addColumn("Book"); listview->addColumn("Solid Copies"); listview->addColumn("Price"); topic1 = new QListViewItem(listview,"Topic 1"); topic2 = new QListViewItem(listview,"Topic 2"); topic3 = new QListViewItem(listview,"Topic 3"); item = new QListViewItem(topic1,"Book 1","21,000","$29.99"); item = new QListViewItem(topic2,"Book 2","19,000","$24.99"); item = new QListViewItem(topic3,"Book 3","14,000","$99.99"); item = new QListViewItem(topic3,"Book 1","3800,000","$29.99"); item = new QListViewItem(topic3,"Book 2","16,000","$24.99"); item = new QListViewItem(topic3,"Book 3","9,000","$99.99"); item = new QListViewItem(topic3,"Book 1","3800,000","$29.99"); item = new QListViewItem(topic3,"Book 2","16,000","$24.99"); item = new QListViewItem(topic3,"Book 3","9,000","$99.99");}main(int argc,char **argv){ QApplication a(argc,argv); MyMainWindow w; a.setMainWidget(&w); w.show(); a.exec();}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -