Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F5157934
registrykeytable.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Size
1 KB
Referenced Files
None
Subscribers
None
registrykeytable.cpp
View Options
#include "registrykeytable.h"
#include <QHeaderView>
RegistryKeyTable::RegistryKeyTable(QWidget *p_parent) : QTableView(p_parent) {
// Configure widget
this->setSelectionMode(QAbstractItemView::SingleSelection);
this->setSelectionBehavior(QAbstractItemView::SelectRows);
this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
}
void RegistryKeyTable::setModel(QAbstractItemModel *p_model) {
QTableView::setModel(p_model);
// Resize table rows / columns to fit data
this->resizeColumnsToContents();
this->horizontalHeader()->stretchLastSection();
}
int RegistryKeyTable::sizeHintForColumn(int column) const {
int size_hint=-1;
int i=0;
int item_width=0;
QFontMetrics fm(this->fontMetrics());
QModelIndex idx;
if(this->model()==NULL) return -1;
// Find string that needs the most amount of space
idx=this->model()->index(i,column);
while(idx.isValid()) {
item_width=fm.width(this->model()->data(idx).toString())+10;
if(item_width>size_hint) size_hint=item_width;
idx=this->model()->index(++i,column);
}
return size_hint;
}
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Thu, Jun 26, 4:59 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1271503
Default Alt Text
registrykeytable.cpp (1 KB)
Attached To
Mode
rFRED fred
Attached
Detach File
Event Timeline
Log In to Comment