mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-19 15:41:32 +00:00
Modified row height of the plugins table to use the height of checkbox instead of dynamic resizing
This commit is contained in:
parent
d7a3b84b3d
commit
8c04d00a50
2 changed files with 6 additions and 13 deletions
|
@ -57,6 +57,12 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
||||||
mPluginsTable->horizontalHeader()->setStretchLastSection(true);
|
mPluginsTable->horizontalHeader()->setStretchLastSection(true);
|
||||||
mPluginsTable->horizontalHeader()->hide();
|
mPluginsTable->horizontalHeader()->hide();
|
||||||
|
|
||||||
|
// Set the row height to the size of the checkboxes
|
||||||
|
QCheckBox checkBox;
|
||||||
|
unsigned int height = checkBox.sizeHint().height() + 2;
|
||||||
|
|
||||||
|
mPluginsTable->verticalHeader()->setDefaultSectionSize(height);
|
||||||
|
|
||||||
mPluginsTable->setDragEnabled(true);
|
mPluginsTable->setDragEnabled(true);
|
||||||
mPluginsTable->setDragDropMode(QAbstractItemView::InternalMove);
|
mPluginsTable->setDragDropMode(QAbstractItemView::InternalMove);
|
||||||
mPluginsTable->setDropIndicatorShown(true);
|
mPluginsTable->setDropIndicatorShown(true);
|
||||||
|
@ -124,7 +130,6 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
||||||
connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(const QString)));
|
connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(const QString)));
|
||||||
|
|
||||||
connect(mPluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckstate(QModelIndex)));
|
connect(mPluginsTable, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(setCheckstate(QModelIndex)));
|
||||||
connect(mPluginsModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), this, SLOT(resizeRows()));
|
|
||||||
|
|
||||||
connect(mNewProfileButton, SIGNAL(pressed()), this, SLOT(newProfile()));
|
connect(mNewProfileButton, SIGNAL(pressed()), this, SLOT(newProfile()));
|
||||||
connect(mCopyProfileButton, SIGNAL(pressed()), this, SLOT(copyProfile()));
|
connect(mCopyProfileButton, SIGNAL(pressed()), this, SLOT(copyProfile()));
|
||||||
|
@ -216,8 +221,6 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Better dynamic resizing of rows
|
|
||||||
resizeRows();
|
|
||||||
readConfig();
|
readConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +402,6 @@ void DataFilesPage::masterSelectionChanged(const QItemSelection &selected, const
|
||||||
{
|
{
|
||||||
// Append the plugins from the current master to pluginsmodel
|
// Append the plugins from the current master to pluginsmodel
|
||||||
addPlugins(currentIndex);
|
addPlugins(currentIndex);
|
||||||
mPluginsTable->resizeRowsToContents();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -535,24 +537,16 @@ void DataFilesPage::uncheckPlugins()
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
// See if the current item is checked
|
// See if the current item is checked
|
||||||
if (mPluginsModel->data(index, Qt::CheckStateRole) == Qt::Checked) {
|
if (mPluginsModel->data(index, Qt::CheckStateRole) == Qt::Checked) {
|
||||||
qDebug() << "Uncheck!";
|
|
||||||
mPluginsModel->setData(index, Qt::Unchecked, Qt::CheckStateRole);
|
mPluginsModel->setData(index, Qt::Unchecked, Qt::CheckStateRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::resizeRows()
|
|
||||||
{
|
|
||||||
// Contents changed
|
|
||||||
mPluginsTable->resizeRowsToContents();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataFilesPage::filterChanged(const QString filter)
|
void DataFilesPage::filterChanged(const QString filter)
|
||||||
{
|
{
|
||||||
QRegExp regExp(filter, Qt::CaseInsensitive, QRegExp::FixedString);
|
QRegExp regExp(filter, Qt::CaseInsensitive, QRegExp::FixedString);
|
||||||
mPluginsProxyModel->setFilterRegExp(regExp);
|
mPluginsProxyModel->setFilterRegExp(regExp);
|
||||||
resizeRows();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataFilesPage::profileChanged(const QString &previous, const QString ¤t)
|
void DataFilesPage::profileChanged(const QString &previous, const QString ¤t)
|
||||||
|
|
|
@ -37,7 +37,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
void masterSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||||
void setCheckstate(QModelIndex index);
|
void setCheckstate(QModelIndex index);
|
||||||
void resizeRows();
|
|
||||||
void filterChanged(const QString filter);
|
void filterChanged(const QString filter);
|
||||||
void profileChanged(const QString &previous, const QString ¤t);
|
void profileChanged(const QString &previous, const QString ¤t);
|
||||||
void newProfile();
|
void newProfile();
|
||||||
|
|
Loading…
Reference in a new issue