forked from teamnwah/openmw-tes3coop
Add a more elegant way of showing the context menu
This commit is contained in:
parent
bd9f657603
commit
646ff72cdc
1 changed files with 8 additions and 10 deletions
|
@ -10,22 +10,20 @@
|
||||||
CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent)
|
CSVPrefs::Page::Page (CSMPrefs::Category& category, QWidget *parent)
|
||||||
: PageBase (category, parent)
|
: PageBase (category, parent)
|
||||||
{
|
{
|
||||||
CSVPrefs::ContextMenuWidget *widget = new CSVPrefs::ContextMenuWidget (category.getKey(), parent);
|
// topWidget can expand while widget stays the same size
|
||||||
|
// This is so the context menu triggers over the entire page
|
||||||
|
// but the user interface looks the same
|
||||||
|
CSVPrefs::ContextMenuWidget *topWidget = new CSVPrefs::ContextMenuWidget (category.getKey(), parent);
|
||||||
|
topWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
QWidget* widget = new QWidget(topWidget);
|
||||||
mGrid = new QGridLayout (widget);
|
mGrid = new QGridLayout (widget);
|
||||||
|
|
||||||
for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter)
|
for (CSMPrefs::Category::Iterator iter = category.begin(); iter!=category.end(); ++iter)
|
||||||
addSetting (*iter);
|
addSetting (*iter);
|
||||||
|
|
||||||
// HACK to get widget to consume all available page space so context menu clicks
|
|
||||||
// will trigger, but so that setting widgets still only take up the left hand side
|
|
||||||
QWidget* emptyColumn = new QWidget();
|
|
||||||
mGrid->addWidget(emptyColumn, 0, 2, -1, 1);
|
|
||||||
QWidget* emptyRow = new QWidget();
|
|
||||||
emptyRow->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);
|
|
||||||
mGrid->addWidget(emptyRow, mGrid->rowCount(), 0, 1, -1);
|
|
||||||
|
|
||||||
setWidgetResizable(true);
|
setWidgetResizable(true);
|
||||||
setWidget (widget);
|
setWidget (topWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting)
|
void CSVPrefs::Page::addSetting (CSMPrefs::Setting *setting)
|
||||||
|
|
Loading…
Reference in a new issue