[calamares] Allow get/set of panel-sides

- Add access to the panel-sides membe of the view manager, and
  calculate which sides are populated by panels (if any).
- Pass the calculated panel-sides to the view manager before it
  starts adding viewpages, so they get consistent margins.
main
Adriaan de Groot 5 years ago
parent 68aecf6a26
commit 8ced67680d

@ -237,11 +237,13 @@ CalamaresWindow::getQmlNavigation( QWidget* parent )
}
#else
// Bogus to keep the linker happy
QWidget * CalamaresWindow::getQmlSidebar(QWidget* , int )
QWidget*
CalamaresWindow::getQmlSidebar( QWidget*, int )
{
return nullptr;
}
QWidget * CalamaresWindow::getQmlNavigation(QWidget* )
QWidget*
CalamaresWindow::getQmlNavigation( QWidget* )
{
return nullptr;
}
@ -401,6 +403,14 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
insertIf( mainLayout, PanelSide::Right, navigation, branding->navigationSide() );
insertIf( mainLayout, PanelSide::Right, sideBox, branding->sidebarSide() );
// layout->count() returns number of things in it; above we have put
// at **least** the central widget, which comes from the view manager,
// both vertically and horizontally -- so if there's a panel along
// either axis, the count in that axis will be > 1.
m_viewManager->setPanelSides(
( contentsLayout->count() > 1 ? Qt::Orientations( Qt::Horizontal ) : Qt::Orientations() )
| ( mainLayout->count() > 1 ? Qt::Orientations( Qt::Vertical ) : Qt::Orientations() ) );
CalamaresUtils::unmarginLayout( mainLayout );
CalamaresUtils::unmarginLayout( contentsLayout );
baseWidget->setLayout( mainLayout );

@ -55,7 +55,7 @@ class UIDLLEXPORT ViewManager : public QAbstractListModel
Q_PROPERTY( bool quitVisible READ quitVisible NOTIFY quitVisibleChanged FINAL )
///@brief Sides on which the ViewManager has side-panels
Q_PROPERTY( Qt::Orientations panelSides MEMBER m_panelSides )
Q_PROPERTY( Qt::Orientations panelSides READ panelSides WRITE setPanelSides MEMBER m_panelSides )
public:
/**
@ -111,6 +111,9 @@ public:
*/
bool confirmCancelInstallation();
Qt::Orientations panelSides() const { return m_panelSides; }
void setPanelSides( Qt::Orientations panelSides ) { m_panelSides = panelSides; }
public Q_SLOTS:
/**
* @brief next moves forward to the next page of the current ViewStep (if any),

Loading…
Cancel
Save