1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

improving consistency of subview layouts

This commit is contained in:
Marc Zinnschlag 2015-07-14 11:49:41 +02:00
parent 2202973c24
commit 0860c27b03
4 changed files with 9 additions and 18 deletions

View File

@ -16,7 +16,7 @@ void CSVTools::SearchSubView::replace (bool selection)
{ {
if (mLocked) if (mLocked)
return; return;
std::vector<int> indices = mTable->getReplaceIndices (selection); std::vector<int> indices = mTable->getReplaceIndices (selection);
std::string replace = mSearchBox.getReplaceText(); std::string replace = mSearchBox.getReplaceText();
@ -29,7 +29,7 @@ void CSVTools::SearchSubView::replace (bool selection)
CSMTools::Search search (mSearch); CSMTools::Search search (mSearch);
CSMWorld::IdTableBase *currentTable = 0; CSMWorld::IdTableBase *currentTable = 0;
// We are running through the indices in reverse order to avoid messing up multiple results // We are running through the indices in reverse order to avoid messing up multiple results
// in a single string. // in a single string.
for (std::vector<int>::const_reverse_iterator iter (indices.rbegin()); iter!=indices.rend(); ++iter) for (std::vector<int>::const_reverse_iterator iter (indices.rbegin()); iter!=indices.rend(); ++iter)
@ -46,7 +46,7 @@ void CSVTools::SearchSubView::replace (bool selection)
search.configure (table); search.configure (table);
currentTable = table; currentTable = table;
} }
std::string hint = model.getHint (*iter); std::string hint = model.getHint (*iter);
if (search.verify (mDocument, table, id, hint)) if (search.verify (mDocument, table, id, hint))
@ -63,7 +63,7 @@ void CSVTools::SearchSubView::replace (bool selection)
void CSVTools::SearchSubView::showEvent (QShowEvent *event) void CSVTools::SearchSubView::showEvent (QShowEvent *event)
{ {
CSVDoc::SubView::showEvent (event); CSVDoc::SubView::showEvent (event);
mSearchBox.focus(); mSearchBox.focus();
} }
CSVTools::SearchSubView::SearchSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) CSVTools::SearchSubView::SearchSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
@ -71,25 +71,23 @@ CSVTools::SearchSubView::SearchSubView (const CSMWorld::UniversalId& id, CSMDoc:
{ {
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins (QMargins (0, 0, 0, 0));
layout->addWidget (&mSearchBox); layout->addWidget (&mSearchBox);
layout->addWidget (mTable = new ReportTable (document, id, true), 2); layout->addWidget (mTable = new ReportTable (document, id, true), 2);
QWidget *widget = new QWidget; QWidget *widget = new QWidget;
widget->setLayout (layout); widget->setLayout (layout);
setWidget (widget); setWidget (widget);
stateChanged (document.getState(), &document); stateChanged (document.getState(), &document);
connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)), connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)),
SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&))); SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&)));
connect (mTable, SIGNAL (replaceRequest()), this, SLOT (replaceRequest())); connect (mTable, SIGNAL (replaceRequest()), this, SLOT (replaceRequest()));
connect (&document, SIGNAL (stateChanged (int, CSMDoc::Document *)), connect (&document, SIGNAL (stateChanged (int, CSMDoc::Document *)),
this, SLOT (stateChanged (int, CSMDoc::Document *))); this, SLOT (stateChanged (int, CSMDoc::Document *)));
@ -124,7 +122,7 @@ void CSVTools::SearchSubView::startSearch (const CSMTools::Search& search)
mSearch = search; mSearch = search;
mSearch.setPadding (paddingBefore, paddingAfter); mSearch.setPadding (paddingBefore, paddingAfter);
mTable->clear(); mTable->clear();
mDocument.runSearch (getUniversalId(), mSearch); mDocument.runSearch (getUniversalId(), mSearch);
} }

View File

@ -13,8 +13,6 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo
{ {
QHBoxLayout *layout = new QHBoxLayout; QHBoxLayout *layout = new QHBoxLayout;
layout->setContentsMargins (QMargins (0, 0, 0, 0));
if (document.getData().getReferenceables().searchId (id.getId())==-1) if (document.getData().getReferenceables().searchId (id.getId())==-1)
{ {
std::string referenceableId = std::string referenceableId =

View File

@ -31,8 +31,6 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
{ {
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins (QMargins (0, 0, 0, 0));
layout->addWidget (mBottom = new TableBottomBox (NullCreatorFactory(), document, id, this), 0); layout->addWidget (mBottom = new TableBottomBox (NullCreatorFactory(), document, id, this), 0);
mLayout->setContentsMargins (QMargins (0, 0, 0, 0)); mLayout->setContentsMargins (QMargins (0, 0, 0, 0));

View File

@ -23,8 +23,6 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
{ {
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins (QMargins (0, 0, 0, 0));
layout->addWidget (mBottom = layout->addWidget (mBottom =
new TableBottomBox (creatorFactory, document, id, this), 0); new TableBottomBox (creatorFactory, document, id, this), 0);
@ -166,4 +164,3 @@ bool CSVWorld::TableSubView::eventFilter (QObject* object, QEvent* event)
} }
return false; return false;
} }