Merge pull request #986 from Lectem/better_widgets
citra-qt: Improve pica command list widget.
This commit is contained in:
commit
7a132e2a77
1 changed files with 22 additions and 12 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
#include <QHeaderView>
|
||||||
#include <QSpinBox>
|
#include <QSpinBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
|
@ -174,7 +175,7 @@ int GPUCommandListModel::rowCount(const QModelIndex& parent) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int GPUCommandListModel::columnCount(const QModelIndex& parent) const {
|
int GPUCommandListModel::columnCount(const QModelIndex& parent) const {
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
|
QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
|
||||||
|
@ -187,14 +188,13 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
|
||||||
|
|
||||||
if (role == Qt::DisplayRole) {
|
if (role == Qt::DisplayRole) {
|
||||||
QString content;
|
QString content;
|
||||||
if (index.column() == 0) {
|
switch ( index.column() ) {
|
||||||
QString content = QString::fromLatin1(Pica::Regs::GetCommandName(cmd.cmd_id).c_str());
|
case 0:
|
||||||
content.append(" ");
|
return QString::fromLatin1(Pica::Regs::GetCommandName(cmd.cmd_id).c_str());
|
||||||
return content;
|
case 1:
|
||||||
} else if (index.column() == 1) {
|
return QString("%1").arg(cmd.cmd_id, 3, 16, QLatin1Char('0'));
|
||||||
QString content = QString("%1 ").arg(cmd.hex, 8, 16, QLatin1Char('0'));
|
case 2:
|
||||||
content.append(QString("%1 ").arg(val, 8, 16, QLatin1Char('0')));
|
return QString("%1").arg(val, 8, 16, QLatin1Char('0'));
|
||||||
return content;
|
|
||||||
}
|
}
|
||||||
} else if (role == CommandIdRole) {
|
} else if (role == CommandIdRole) {
|
||||||
return QVariant::fromValue<int>(cmd.cmd_id.Value());
|
return QVariant::fromValue<int>(cmd.cmd_id.Value());
|
||||||
|
@ -207,10 +207,13 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio
|
||||||
switch(role) {
|
switch(role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
{
|
{
|
||||||
if (section == 0) {
|
switch (section) {
|
||||||
|
case 0:
|
||||||
return tr("Command Name");
|
return tr("Command Name");
|
||||||
} else if (section == 1) {
|
case 1:
|
||||||
return tr("Data");
|
return tr("Register");
|
||||||
|
case 2:
|
||||||
|
return tr("New Value");
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -299,6 +302,13 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
|
||||||
list_widget->setModel(model);
|
list_widget->setModel(model);
|
||||||
list_widget->setFont(QFont("monospace"));
|
list_widget->setFont(QFont("monospace"));
|
||||||
list_widget->setRootIsDecorated(false);
|
list_widget->setRootIsDecorated(false);
|
||||||
|
list_widget->setUniformRowHeights(true);
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
||||||
|
list_widget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#else
|
||||||
|
list_widget->header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(list_widget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)),
|
connect(list_widget->selectionModel(), SIGNAL(currentChanged(const QModelIndex&,const QModelIndex&)),
|
||||||
this, SLOT(SetCommandInfo(const QModelIndex&)));
|
this, SLOT(SetCommandInfo(const QModelIndex&)));
|
||||||
|
|
Loading…
Reference in a new issue