Updates to optional horizontal scrollbar.

- move SizeHintWidget out to separate files
- remove redundant logic in view.cpp
- remove sizehint from dialogue subview
- add tooltip hints in user preferences
c++11
cc9cii 10 years ago
parent e9ca022162
commit cfcfb17320

@ -46,7 +46,7 @@ opencs_units_noqt (model/tools
opencs_units (view/doc opencs_units (view/doc
viewmanager view operations operation subview startup filedialog newgame viewmanager view operations operation subview startup filedialog newgame
filewidget adjusterwidget loader globaldebugprofilemenu runlogsubview filewidget adjusterwidget loader globaldebugprofilemenu runlogsubview sizehint
) )

@ -151,6 +151,10 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
"Add a horizontal scrollbar to the main view window."); "Add a horizontal scrollbar to the main view window.");
mainwinScroll->setDefaultValue (defaultScroll); mainwinScroll->setDefaultValue (defaultScroll);
mainwinScroll->setDeclaredValues (scrollValues); mainwinScroll->setDeclaredValues (scrollValues);
mainwinScroll->setToolTip ("Scrollbar Only: Simple addition of scrollbars, the view window does not grow"
" automatically.\n"
"Grow Only: Original Editor behaviour. The view window grows as subviews are added. No scrollbars.\n"
"Grow then Scroll: The view window grows. The scrollbar appears once it cannot grow any further.");
Setting *grow = createSetting (Type_CheckBox, "grow-limit", "Grow Limit Screen"); Setting *grow = createSetting (Type_CheckBox, "grow-limit", "Grow Limit Screen");
grow->setDefaultValue ("false"); grow->setDefaultValue ("false");

@ -0,0 +1,17 @@
#include "sizehint.hpp"
CSVDoc::SizeHintWidget::SizeHintWidget(QWidget *parent) : QWidget(parent)
{}
CSVDoc::SizeHintWidget::~SizeHintWidget()
{}
QSize CSVDoc::SizeHintWidget::sizeHint() const
{
return mSize;
}
void CSVDoc::SizeHintWidget::setSizeHint(const QSize &size)
{
mSize = size;
}

@ -0,0 +1,22 @@
#ifndef CSV_DOC_SIZEHINT_H
#define CSV_DOC_SIZEHINT_H
#include <QWidget>
#include <QSize>
namespace CSVDoc
{
class SizeHintWidget : public QWidget
{
QSize mSize;
public:
SizeHintWidget(QWidget *parent = 0);
~SizeHintWidget();
virtual QSize sizeHint() const;
void setSizeHint(const QSize &size);
};
}
#endif // CSV_DOC_SIZEHINT_H

@ -43,19 +43,3 @@ void CSVDoc::SubView::closeRequest()
{ {
emit closeRequest (this); emit closeRequest (this);
} }
CSVDoc::SizeHintWidget::SizeHintWidget(QWidget *parent) : QWidget(parent)
{}
CSVDoc::SizeHintWidget::~SizeHintWidget()
{}
QSize CSVDoc::SizeHintWidget::sizeHint() const
{
return mSize;
}
void CSVDoc::SizeHintWidget::setSizeHint(const QSize &size)
{
mSize = size;
}

@ -8,7 +8,6 @@
#include "subviewfactory.hpp" #include "subviewfactory.hpp"
#include <QDockWidget> #include <QDockWidget>
#include <QSize>
class QUndoStack; class QUndoStack;
@ -71,18 +70,6 @@ namespace CSVDoc
void closeRequest(); void closeRequest();
}; };
class SizeHintWidget : public QWidget
{
QSize mSize;
public:
SizeHintWidget(QWidget *parent = 0);
~SizeHintWidget();
virtual QSize sizeHint() const;
void setSizeHint(const QSize &size);
};
} }
#endif #endif

@ -563,12 +563,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
// //
CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance(); CSMSettings::UserSettings &settings = CSMSettings::UserSettings::instance();
QString mainwinScroll = settings.settingValue ("window/mainwindow-scrollbar"); QString mainwinScroll = settings.settingValue ("window/mainwindow-scrollbar");
if (mainwinScroll.isEmpty() || mainwinScroll == "Scrollbar Only") mScrollbarOnly = mainwinScroll.isEmpty() || mainwinScroll == "Scrollbar Only";
mScrollbarOnly = true;
else if(mainwinScroll == "Grow Only")
mScrollbarOnly = false;
else
mScrollbarOnly = false;
QDesktopWidget *dw = QApplication::desktop(); QDesktopWidget *dw = QApplication::desktop();
QRect rect; QRect rect;

@ -20,8 +20,6 @@
#include <QPushButton> #include <QPushButton>
#include <QToolButton> #include <QToolButton>
#include <QHeaderView> #include <QHeaderView>
#include <QApplication>
#include <QDesktopWidget>
#include "../../model/world/nestedtableproxymodel.hpp" #include "../../model/world/nestedtableproxymodel.hpp"
#include "../../model/world/columnbase.hpp" #include "../../model/world/columnbase.hpp"
@ -583,15 +581,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
changeCurrentId(id.getId()); changeCurrentId(id.getId());
//QWidget *mainWidget = new QWidget(this); QWidget *mainWidget = new QWidget(this);
CSVDoc::SizeHintWidget *mainWidget = new CSVDoc::SizeHintWidget;
const QRect rect = QApplication::desktop()->screenGeometry(this);
int frameHeight = 40; // set a reasonable default
QWidget *topLevel = QApplication::topLevelAt(pos());
if (topLevel)
frameHeight = topLevel->frameGeometry().height() - topLevel->height();
mainWidget->setSizeHint(QSize(400, rect.height()-frameHeight)); // FIXME: 400
QHBoxLayout *buttonsLayout = new QHBoxLayout; QHBoxLayout *buttonsLayout = new QHBoxLayout;
QToolButton* prevButton = new QToolButton(mainWidget); QToolButton* prevButton = new QToolButton(mainWidget);

@ -10,6 +10,7 @@
#include "../../model/doc/document.hpp" #include "../../model/doc/document.hpp"
#include "../../model/world/tablemimedata.hpp" #include "../../model/world/tablemimedata.hpp"
#include "../doc/sizehint.hpp"
#include "../filter/filterbox.hpp" #include "../filter/filterbox.hpp"
#include "table.hpp" #include "table.hpp"
#include "tablebottombox.hpp" #include "tablebottombox.hpp"

Loading…
Cancel
Save