comparison ui/administratorwindow.cpp @ 398:9e6a2c2033ed

Enable sorting in certifacte table view.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 16 Apr 2014 10:00:17 +0200
parents 26651cc0cc47
children d481b1d0956f
comparison
equal deleted inserted replaced
397:8752aae8aad8 398:9e6a2c2033ed
13 #include <QImage> 13 #include <QImage>
14 #include <QCheckBox> 14 #include <QCheckBox>
15 #include <QHeaderView> 15 #include <QHeaderView>
16 #include <QFileDialog> 16 #include <QFileDialog>
17 #include <QStandardPaths> 17 #include <QStandardPaths>
18 #include <QSortFilterProxyModel>
18 19
19 #include "certificatetabledelegate.h" 20 #include "certificatetabledelegate.h"
20 #include "createinstallerdialog.h" 21 #include "createinstallerdialog.h"
21 #include "createcertlistdialog.h" 22 #include "createcertlistdialog.h"
22 23
69 70
70 // The certificate list 71 // The certificate list
71 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates")); 72 QGroupBox *certBox = new QGroupBox(tr("Managed Certificates"));
72 certificateView = new QTableView; 73 certificateView = new QTableView;
73 certificateModel = new CertificateTabelModel(); 74 certificateModel = new CertificateTabelModel();
75 QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(this);
76 filterModel->setSourceModel(certificateModel);
74 CertificateTableDelegate *delegate = new CertificateTableDelegate(certificateView); 77 CertificateTableDelegate *delegate = new CertificateTableDelegate(certificateView);
75 certificateView->setModel(certificateModel); 78 certificateView->setModel(filterModel);
76 certificateView->setItemDelegate(delegate); 79 certificateView->setItemDelegate(delegate);
77 certificateView->resizeColumnsToContents(); 80 certificateView->resizeColumnsToContents();
78 certificateView->setColumnWidth(0, 60); 81 certificateView->setColumnWidth(0, 60);
79 certificateView->setSelectionBehavior(QAbstractItemView::SelectRows); 82 certificateView->setSelectionBehavior(QAbstractItemView::SelectRows);
80 connect(certificateView, SIGNAL(clicked(const QModelIndex&)), this, 83 connect(certificateView, SIGNAL(clicked(const QModelIndex&)), this,
81 SLOT(clickedCertificate(const QModelIndex&))); 84 SLOT(clickedCertificate(const QModelIndex&)));
82 certificateView->verticalHeader()->setVisible(false); 85 certificateView->verticalHeader()->setVisible(false);
86 certificateView->setSortingEnabled(true);
83 certLayout->addWidget(certificateView); 87 certLayout->addWidget(certificateView);
84 certBox->setLayout(certLayout); 88 certBox->setLayout(certLayout);
85 89
86 // The header (icon, about text) 90 // The header (icon, about text)
87 QImage *logoImage = new QImage(":/img/logo.png"); 91 QImage *logoImage = new QImage(":/img/logo.png");

http://wald.intevation.org/projects/trustbridge/