TAILIEUCHUNG - The book of qt 4 the art of building qt applications - phần 6

Qt ở đây phân biệt giữa các giá trị số nguyên và dấu chấm động giá trị, nó cung cấp độ chính xác kép. Chấp nhận đầu vào Integer giá trị Ví dụ sau đây (Hình 6,13) cho thấy làm thế nào getInteger () phương pháp QInputDialog được sử dụng | 8 Displaying Data Using Interview Q_UNUSED parent return - 2 To determine the number of columns we look at the dataset from the first line of the CSV file. The QStringList count method is used to determine the number of strings in the string list that contains the dataset corresponding to the first line of the file obtained from addressBook by invoking at 0 addressbook continued int AddressbookModel columnCount const QModellndex parent const Q_UNUSED parent return 0 .count Views that use our address book model can discover the labeling of the rows and columns via the headerData method. To do so they must specify the numeric position of the section of data for which the heading is desired where a section is either a row or a column-whether the desired heading is a row heading or a column heading is decided by the value given for the orientation. This is of the enumeration type Qt Orientation and has the possible values Qt Vertical or Qt Horizontal. When it comes to roles in this example we are interested only in supporting the Display Role which is used when the view needs the text to be displayed. Everything else we pass on to the implementation of the overclass. QAbstractTableModel does more thanjust return empty QVariants If we had not reimplemented headerData it would number all the rows and columns. In order to ensure that we can use the model later with a QTableView that also queries row descriptions we call the headerData function of the overclass particularly in case the orientation is not horizontal. This means that by default a label to the left of the datasets will denote the dataset number. For horizontal orientation we use the entries from the first dataset in the list which as we know contains the column names addressbook continued QVariant AddressbookModel headerData int section Qt Orientation orientation int role const if orientation Qt Horizontal if role Qt DisplayRole return

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.