ui: project wizzard design
* switched to QGridLayout for wizzard content layouting * distinguish scrollable windows based on content * content can define window size * removed QtApplicationSettingsScreen, now done via QtProjectWizzardWindow and QtProjectWizzardContentPreferences * added new project icon
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardWindow.h"
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QFrame>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent)
|
||||
: QtSettingsWindow(parent)
|
||||
, m_content(nullptr)
|
||||
, m_previousButton(nullptr)
|
||||
, m_showAsPopup(false)
|
||||
, m_scrollAble(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,11 +26,47 @@ QtProjectWizzardContent* QtProjectWizzardWindow::content() const
|
||||
void QtProjectWizzardWindow::setContent(QtProjectWizzardContent* content)
|
||||
{
|
||||
m_content = content;
|
||||
m_scrollAble = content->isScrollAble();
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::setup()
|
||||
{
|
||||
setupForm();
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath() + "project_wizzard/window.css").c_str());
|
||||
QVBoxLayout* windowLayout = new QVBoxLayout();
|
||||
windowLayout->setContentsMargins(25, 30, 25, 20);
|
||||
|
||||
m_title = new QLabel();
|
||||
m_title->setObjectName("title");
|
||||
windowLayout->addWidget(m_title);
|
||||
windowLayout->addSpacing(10);
|
||||
|
||||
QWidget* contentWidget = new QWidget();
|
||||
contentWidget->setObjectName("form");
|
||||
|
||||
populateWindow(contentWidget);
|
||||
|
||||
if (m_scrollAble)
|
||||
{
|
||||
QScrollArea* scrollArea = new QScrollArea();
|
||||
scrollArea->setObjectName("formArea");
|
||||
scrollArea->setFrameShadow(QFrame::Plain);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
|
||||
scrollArea->setWidget(contentWidget);
|
||||
windowLayout->addWidget(scrollArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowLayout->addWidget(contentWidget);
|
||||
windowLayout->setStretchFactor(contentWidget, 1);
|
||||
}
|
||||
|
||||
showButtons(windowLayout);
|
||||
|
||||
m_window->setLayout(windowLayout);
|
||||
|
||||
resize(content()->preferredWindowSize());
|
||||
|
||||
|
||||
updateTitle("NEW PROJECT");
|
||||
updateDoneButton("Next");
|
||||
@@ -41,9 +83,6 @@ void QtProjectWizzardWindow::setup()
|
||||
updateDoneButton("Ok");
|
||||
hideCancelButton(true);
|
||||
hidePrevious();
|
||||
m_title->hide();
|
||||
|
||||
setMaximumSize(QSize(500, 500));
|
||||
}
|
||||
|
||||
m_content->windowReady();
|
||||
@@ -51,7 +90,31 @@ void QtProjectWizzardWindow::setup()
|
||||
|
||||
void QtProjectWizzardWindow::populateWindow(QWidget* widget)
|
||||
{
|
||||
m_content->populateWindow(widget);
|
||||
QGridLayout* layout = new QGridLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
m_content->populateWindow(layout);
|
||||
|
||||
if (layout->columnCount() < 2)
|
||||
{
|
||||
m_content->populateWindow(widget);
|
||||
}
|
||||
else
|
||||
{
|
||||
QFrame* separator = new QFrame();
|
||||
separator->setFrameShape(QFrame::VLine);
|
||||
|
||||
QPalette palette = separator->palette();
|
||||
palette.setColor(QPalette::WindowText, Qt::lightGray);
|
||||
separator->setPalette(palette);
|
||||
|
||||
layout->addWidget(separator, 0, LINE_COL, -1, 1);
|
||||
|
||||
layout->setColumnStretch(HELP_COL, 0);
|
||||
layout->setColumnStretch(LINE_COL, 0);
|
||||
|
||||
widget->setLayout(layout);
|
||||
}
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::enableNext()
|
||||
@@ -94,16 +157,16 @@ void QtProjectWizzardWindow::hidePrevious()
|
||||
}
|
||||
}
|
||||
|
||||
bool QtProjectWizzardWindow::getShowAsPopup() const
|
||||
{
|
||||
return m_showAsPopup;
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::setShowAsPopup(bool showAsPopup)
|
||||
{
|
||||
m_showAsPopup = showAsPopup;
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::setScrollAble(bool scrollAble)
|
||||
{
|
||||
m_scrollAble = scrollAble;
|
||||
}
|
||||
|
||||
void QtProjectWizzardWindow::handleCancelButtonPress()
|
||||
{
|
||||
emit canceled();
|
||||
|
||||
Reference in New Issue
Block a user