ui: Use window decorations on dialog windows (issue #376)
* added SubWindow flag to QtWindow to either use window decorations or show window within main window * fixes black borders in some Linux window managers bug id = 376 fortune cookie message = Your skill will accomplish what the force of many others cannot.
This commit is contained in:
@@ -4,16 +4,6 @@
|
||||
font-weight: 100;
|
||||
}
|
||||
|
||||
#closeButton {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
#closeButton:hover {
|
||||
border: 2px solid white;
|
||||
border-radius: 12px;
|
||||
#window {
|
||||
background: qlineargradient( x1:0 y1:0.4, x2:0 y2:1, stop:0 #2F3F86, stop:1 #1C7BBC );
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 517 B |
@@ -2,8 +2,6 @@
|
||||
|
||||
#header_background {
|
||||
background-color: #2E3C86;
|
||||
border-top-left-radius: 15px;
|
||||
border-bottom-left-radius: 15px;
|
||||
}
|
||||
|
||||
#title {
|
||||
@@ -142,8 +140,6 @@
|
||||
|
||||
#creator_header_background {
|
||||
background-color: #2E3C86;
|
||||
border-top-left-radius: 15px;
|
||||
border-top-right-radius: 15px;
|
||||
}
|
||||
|
||||
#creator_title_label {
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
QLabel {
|
||||
font-size: 12px;
|
||||
color: black;
|
||||
}
|
||||
|
||||
#licenseField {
|
||||
font-family: "<setting:font_name>";
|
||||
font-size: 11px;
|
||||
|
||||
@@ -14,6 +14,10 @@ QCheckBox:disabled {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
#window {
|
||||
background: white;
|
||||
}
|
||||
|
||||
#title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ cd $MY_PATH/..
|
||||
|
||||
# run target
|
||||
|
||||
if [ "$1" = "release" ] || [ "$1" = "r" ]
|
||||
if [ "$1" = "release" ] || [ "$1" = "r" ] || [ "$1" = "" ]
|
||||
then
|
||||
if [ "$2" = "test" ]
|
||||
then
|
||||
|
||||
@@ -34,14 +34,12 @@ public:
|
||||
void setComponent(Component* component);
|
||||
|
||||
ViewWidgetWrapper* getWidgetWrapper() const;
|
||||
|
||||
ViewLayout* getViewLayout() const;
|
||||
|
||||
protected:
|
||||
template <typename ControllerType>
|
||||
ControllerType* getController();
|
||||
|
||||
ViewLayout* getViewLayout() const;
|
||||
|
||||
void setWidgetWrapper(std::shared_ptr<ViewWidgetWrapper> widgetWrapper);
|
||||
|
||||
private:
|
||||
|
||||
@@ -26,7 +26,6 @@ QtLocationPicker::QtLocationPicker(QWidget *parent)
|
||||
m_data->setAttribute(Qt::WA_MacShowFocusRect, 0);
|
||||
m_data->setObjectName("locationField");
|
||||
layout->addWidget(m_data);
|
||||
connect(m_data, SIGNAL(focus()), this, SLOT(handleFocus()));
|
||||
|
||||
m_button = new QtIconButton(
|
||||
(ResourcePaths::getGuiPath().str() + "window/dots.png").c_str(),
|
||||
@@ -125,11 +124,3 @@ void QtLocationPicker::handleButtonPress()
|
||||
emit locationPicked();
|
||||
}
|
||||
}
|
||||
|
||||
void QtLocationPicker::handleFocus()
|
||||
{
|
||||
if (!m_data->text().size())
|
||||
{
|
||||
handleButtonPress();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ protected:
|
||||
|
||||
private slots:
|
||||
void handleButtonPress();
|
||||
void handleFocus();
|
||||
|
||||
private:
|
||||
QPushButton* m_button;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
#include "qt/view/QtViewWidgetWrapper.h"
|
||||
#include "qt/window/QtBookmarkCreator.h"
|
||||
#include "qt/window/QtBookmarkBrowser.h"
|
||||
#include "qt/view/QtMainView.h"
|
||||
#include "qt/window/QtMainWindow.h"
|
||||
|
||||
#include "utility/messaging/type/MessageDeleteBookmarkForActiveTokens.h"
|
||||
#include "utility/messaging/type/MessageDisplayBookmarks.h"
|
||||
@@ -176,10 +178,10 @@ void QtBookmarkView::displayBookmarks(const std::vector<std::shared_ptr<Bookmark
|
||||
[=]()
|
||||
{
|
||||
if (m_bookmarkBrowser == nullptr)
|
||||
{
|
||||
m_bookmarkBrowser = new QtBookmarkBrowser();
|
||||
m_bookmarkBrowser->setupBookmarkBrowser();
|
||||
}
|
||||
{
|
||||
m_bookmarkBrowser = new QtBookmarkBrowser(dynamic_cast<QtMainView*>(dynamic_cast<View*>(getViewLayout())->getViewLayout())->getMainWindow());
|
||||
m_bookmarkBrowser->setupBookmarkBrowser();
|
||||
}
|
||||
|
||||
m_bookmarkBrowser->setBookmarks(bookmarks);
|
||||
m_bookmarkBrowser->show();
|
||||
@@ -193,7 +195,7 @@ void QtBookmarkView::displayBookmarkCreator(const std::vector<std::string>& name
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator();
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(dynamic_cast<QtMainView*>(dynamic_cast<View*>(getViewLayout())->getViewLayout())->getMainWindow());
|
||||
bookmarkCreator->setupBookmarkCreator();
|
||||
|
||||
std::string displayName = "";
|
||||
@@ -223,7 +225,7 @@ void QtBookmarkView::displayBookmarkEditor(std::shared_ptr<Bookmark> bookmark, c
|
||||
m_onQtThread(
|
||||
[=]()
|
||||
{
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(nullptr, true, bookmark->getId());
|
||||
QtBookmarkCreator* bookmarkCreator = new QtBookmarkCreator(dynamic_cast<QtMainView*>(dynamic_cast<View*>(getViewLayout())->getViewLayout())->getMainWindow(), true, bookmark->getId());
|
||||
bookmarkCreator->setupBookmarkCreator();
|
||||
bookmarkCreator->setDisplayName(bookmark->getName());
|
||||
bookmarkCreator->setComment(bookmark->getComment());
|
||||
|
||||
@@ -330,7 +330,7 @@ template<typename T>
|
||||
|
||||
void QtDialogView::setUIBlocked(bool blocked)
|
||||
{
|
||||
m_mainWindow->setEnabled(!blocked);
|
||||
m_mainWindow->setContentEnabled(!blocked);
|
||||
|
||||
if (blocked)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtAbout::QtAbout(QWidget *parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
setSizeGripStyle(false);
|
||||
}
|
||||
|
||||
QSize QtAbout::sizeHint() const
|
||||
@@ -23,14 +22,6 @@ QSize QtAbout::sizeHint() const
|
||||
|
||||
void QtAbout::setupAbout()
|
||||
{
|
||||
m_window->setStyleSheet(
|
||||
m_window->styleSheet() +
|
||||
"#window { "
|
||||
"background: qlineargradient( x1:0 y1:0.4, x2:0 y2:1, stop:0 #2F3F86, stop:1 #1C7BBC );"
|
||||
"border: none;"
|
||||
"}"
|
||||
);
|
||||
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("about/about.css"))).c_str());
|
||||
|
||||
QVBoxLayout* windowLayout = new QVBoxLayout();
|
||||
@@ -42,33 +33,21 @@ void QtAbout::setupAbout()
|
||||
QHBoxLayout* row = new QHBoxLayout();
|
||||
windowLayout->addLayout(row);
|
||||
{
|
||||
QVBoxLayout* column = new QVBoxLayout();
|
||||
row->addLayout(column);
|
||||
|
||||
QtDeviceScaledPixmap sourcetrailLogo((ResourcePaths::getGuiPath().str() + "about/logo_sourcetrail.png").c_str());
|
||||
sourcetrailLogo.scaleToHeight(150);
|
||||
|
||||
QLabel* sourcetrailLogoLabel = new QLabel(this);
|
||||
sourcetrailLogoLabel->setPixmap(sourcetrailLogo.pixmap());
|
||||
sourcetrailLogoLabel->resize(sourcetrailLogo.width(), sourcetrailLogo.height());
|
||||
column->addWidget(sourcetrailLogoLabel);
|
||||
row->addWidget(sourcetrailLogoLabel);
|
||||
}
|
||||
|
||||
row->addSpacing(20);
|
||||
row->addSpacing(50);
|
||||
|
||||
{
|
||||
QVBoxLayout* column = new QVBoxLayout();
|
||||
row->addLayout(column);
|
||||
|
||||
QtDeviceScaledPixmap closePixmap((ResourcePaths::getGuiPath().str() + "about/icon_close.png").c_str());
|
||||
closePixmap.scaleToHeight(20);
|
||||
QPushButton* closeButton = new QPushButton(this);
|
||||
closeButton->setIcon(QIcon(closePixmap.pixmap()));
|
||||
closeButton->setObjectName("closeButton");
|
||||
closeButton->show();
|
||||
connect(closeButton, SIGNAL(clicked()), this, SLOT(handleCloseButtonPress()));
|
||||
|
||||
column->addWidget(closeButton, 0, Qt::AlignTop | Qt::AlignRight);
|
||||
|
||||
column->addStretch();
|
||||
|
||||
QLabel* developerTitle = new QLabel("<b>Developed by:</b>", this);
|
||||
@@ -103,12 +82,13 @@ void QtAbout::setupAbout()
|
||||
windowLayout->addWidget(acknowledgementsTitle);
|
||||
|
||||
QLabel* acknowledgementsLabel = new QLabel(
|
||||
"Sourcetrail (aka Coati) 0.1 was created in the context of education at<br />"
|
||||
"<a href=\"http://www.fh-salzburg.ac.at/en/\" style=\"color: white;\">Salzburg University of Applied Sciences</a>.<br />"
|
||||
"Coati Software OG takes part in the <a href=\"http://www.startup-salzburg.at/\" style=\"color: white;\">Startup Salzburg</a> initiative.<br />"
|
||||
"Sourcetrail (aka Coati) 0.1 was created in the context of education at "
|
||||
"<a href=\"http://www.fh-salzburg.ac.at/en/\" style=\"color: white;\">Salzburg University of Applied Sciences</a>. "
|
||||
"Coati Software OG takes part in the <a href=\"http://www.startup-salzburg.at/\" style=\"color: white;\">Startup Salzburg</a> initiative. "
|
||||
"The development of Sourcetrail was funded by <a href=\"http://awsg.at\" style=\"color: white;\">aws</a>.",
|
||||
this
|
||||
);
|
||||
acknowledgementsLabel->setWordWrap(true);
|
||||
acknowledgementsLabel->setOpenExternalLinks(true);
|
||||
windowLayout->addWidget(acknowledgementsLabel);
|
||||
|
||||
@@ -155,9 +135,6 @@ void QtAbout::setupAbout()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtAbout::handleCloseButtonPress()
|
||||
{
|
||||
emit canceled();
|
||||
windowLayout->addSpacing(10);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ public:
|
||||
QSize sizeHint() const override;
|
||||
|
||||
void setupAbout();
|
||||
|
||||
private slots:
|
||||
void handleCloseButtonPress();
|
||||
};
|
||||
|
||||
#endif // QT_ABOUT_H
|
||||
|
||||
@@ -6,11 +6,9 @@
|
||||
#include "licenses.h"
|
||||
|
||||
QtAboutLicense::QtAboutLicense(QWidget *parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
setScrollAble(true);
|
||||
|
||||
raise();
|
||||
}
|
||||
|
||||
QSize QtAboutLicense::sizeHint() const
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtBookmarkBrowser::QtBookmarkBrowser(QWidget* parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
{
|
||||
QVBoxLayout* headerLayout = new QVBoxLayout();
|
||||
headerLayout->setSpacing(0);
|
||||
headerLayout->setContentsMargins(30, 35, 25, 35);
|
||||
headerLayout->setContentsMargins(25, 35, 25, 35);
|
||||
headerLayout->setAlignment(Qt::AlignTop);
|
||||
layout->addLayout(headerLayout);
|
||||
|
||||
@@ -93,7 +93,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
{
|
||||
QVBoxLayout* bodyLayout = new QVBoxLayout();
|
||||
bodyLayout->setSpacing(0);
|
||||
bodyLayout->setContentsMargins(0, 30, 6, 35);
|
||||
bodyLayout->setContentsMargins(0, 10, 0, 10);
|
||||
bodyLayout->setAlignment(Qt::AlignLeft);
|
||||
layout->addLayout(bodyLayout);
|
||||
|
||||
@@ -112,7 +112,7 @@ void QtBookmarkBrowser::setupBookmarkBrowser()
|
||||
bodyLayout->addSpacing(15);
|
||||
|
||||
QHBoxLayout* buttonLayout = createButtons();
|
||||
buttonLayout->setContentsMargins(0, 0, 35, 0);
|
||||
buttonLayout->setContentsMargins(0, 0, 23, 13);
|
||||
bodyLayout->addLayout(buttonLayout);
|
||||
setPreviousVisible(false);
|
||||
setCloseVisible(false);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "qt/utility/utilityQt.h"
|
||||
|
||||
QtBookmarkCreator::QtBookmarkCreator(QWidget* parent, bool edit, Id id)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
, m_edit(edit)
|
||||
, m_bookmarkId(id)
|
||||
, m_categoryCount(0)
|
||||
@@ -30,7 +30,7 @@ QtBookmarkCreator::~QtBookmarkCreator()
|
||||
void QtBookmarkCreator::setupBookmarkCreator()
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(30, 33, 30, 40);
|
||||
layout->setContentsMargins(20, 23, 20, 20);
|
||||
|
||||
{
|
||||
// title
|
||||
|
||||
@@ -8,10 +8,9 @@
|
||||
#include "utility/text/TextAccess.h"
|
||||
|
||||
QtEulaWindow::QtEulaWindow(QWidget *parent, bool forceAccept)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
, m_forceAccept(forceAccept)
|
||||
{
|
||||
raise();
|
||||
}
|
||||
|
||||
QSize QtEulaWindow::sizeHint() const
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "utility/utility.h"
|
||||
|
||||
QtIndexingDialog::QtIndexingDialog(QWidget* parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(true, parent)
|
||||
, m_type(DIALOG_MESSAGE)
|
||||
, m_top(nullptr)
|
||||
, m_topRatio(0)
|
||||
|
||||
@@ -25,11 +25,9 @@ void QtShortcutTable::wheelEvent(QWheelEvent *event)
|
||||
|
||||
|
||||
QtKeyboardShortcuts::QtKeyboardShortcuts(QWidget* parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
setScrollAble(true);
|
||||
|
||||
raise();
|
||||
}
|
||||
|
||||
QtKeyboardShortcuts::~QtKeyboardShortcuts()
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtLicense::QtLicense(QWidget *parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
{
|
||||
raise();
|
||||
}
|
||||
|
||||
QSize QtLicense::sizeHint() const
|
||||
{
|
||||
return QSize(780, 590);
|
||||
return QSize(780, 480);
|
||||
}
|
||||
|
||||
void QtLicense::clear()
|
||||
|
||||
@@ -262,6 +262,19 @@ void QtMainWindow::updateHistoryMenu(const std::vector<SearchMatch>& history)
|
||||
setupHistoryMenu();
|
||||
}
|
||||
|
||||
void QtMainWindow::setContentEnabled(bool enabled)
|
||||
{
|
||||
foreach (QAction *action, menuBar()->actions())
|
||||
{
|
||||
action->setEnabled(enabled);
|
||||
}
|
||||
|
||||
for (DockWidget& dock : m_dockWidgets)
|
||||
{
|
||||
dock.widget->setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
bool QtMainWindow::event(QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::WindowActivate)
|
||||
|
||||
@@ -71,6 +71,8 @@ public:
|
||||
|
||||
void updateHistoryMenu(const std::vector<SearchMatch>& history);
|
||||
|
||||
void setContentEnabled(bool enabled);
|
||||
|
||||
protected:
|
||||
bool event(QEvent* event);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
@@ -81,9 +81,8 @@ void QtRecentProjectButton::handleButtonClick()
|
||||
|
||||
|
||||
QtStartScreen::QtStartScreen(QWidget *parent)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(true, parent)
|
||||
{
|
||||
this->raise();
|
||||
}
|
||||
|
||||
QSize QtStartScreen::sizeHint() const
|
||||
@@ -286,8 +285,8 @@ void QtStartScreen::setupStartScreen(bool unlocked)
|
||||
|
||||
QSize size = sizeHint();
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSysInfo>
|
||||
|
||||
#include "qt/utility/QtDeviceScaledPixmap.h"
|
||||
#include "qt/utility/utilityQt.h"
|
||||
#include "settings/ApplicationSettings.h"
|
||||
#include "utility/ResourcePaths.h"
|
||||
|
||||
QtWindow::QtWindow(QWidget* parent)
|
||||
QtWindow::QtWindow(bool isSubWindow, QWidget* parent)
|
||||
: QtWindowStackElement(parent)
|
||||
, m_isSubWindow(isSubWindow)
|
||||
, m_window(nullptr)
|
||||
, m_title(nullptr)
|
||||
, m_subTitle(nullptr)
|
||||
@@ -23,47 +23,75 @@ QtWindow::QtWindow(QWidget* parent)
|
||||
, m_scrollAble(false)
|
||||
, m_hasLogo(false)
|
||||
, m_mousePressedInWindow(false)
|
||||
, m_sizeGrip(nullptr)
|
||||
{
|
||||
setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
|
||||
m_window = new QWidget(this);
|
||||
|
||||
std::string frameStyle =
|
||||
"#window {"
|
||||
" border: 1px solid lightgray;"
|
||||
" border-radius: 15px;"
|
||||
" background: white;"
|
||||
"}";
|
||||
m_window->setStyleSheet(frameStyle.c_str());
|
||||
m_window->setObjectName("window");
|
||||
|
||||
// window shadow
|
||||
if (QSysInfo::macVersion() == QSysInfo::MV_None)
|
||||
if (isSubWindow)
|
||||
{
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||
effect->setBlurRadius(5);
|
||||
effect->setXOffset(2);
|
||||
effect->setYOffset(2);
|
||||
effect->setColor(Qt::darkGray);
|
||||
m_window->setGraphicsEffect(effect);
|
||||
setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint);
|
||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setFocus();
|
||||
}
|
||||
else
|
||||
{
|
||||
setWindowFlags(Qt::Window);
|
||||
}
|
||||
|
||||
m_window = new QWidget(this);
|
||||
m_window->setObjectName("window");
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(m_window);
|
||||
layout->setSpacing(1);
|
||||
layout->setSpacing(0);
|
||||
|
||||
m_content = new QWidget();
|
||||
layout->addWidget(m_content);
|
||||
|
||||
QHBoxLayout* gripLayout = new QHBoxLayout();
|
||||
m_sizeGrip = new QSizeGrip(m_window);
|
||||
setSizeGripStyle(true);
|
||||
gripLayout->addWidget(new QWidget());
|
||||
gripLayout->addWidget(m_sizeGrip);
|
||||
layout->addLayout(gripLayout);
|
||||
if (isSubWindow)
|
||||
{
|
||||
std::string frameStyle =
|
||||
"#window {"
|
||||
" border: 1px solid lightgray;"
|
||||
" border-radius: 15px;"
|
||||
" background: white;"
|
||||
"}";
|
||||
m_window->setStyleSheet(frameStyle.c_str());
|
||||
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||
effect->setBlurRadius(15);
|
||||
effect->setXOffset(0);
|
||||
effect->setYOffset(5);
|
||||
effect->setColor(Qt::darkGray);
|
||||
m_window->setGraphicsEffect(effect);
|
||||
|
||||
QHBoxLayout* gripLayout = new QHBoxLayout();
|
||||
m_sizeGrip = new QSizeGrip(m_window);
|
||||
setSizeGripStyle(true);
|
||||
gripLayout->addWidget(new QWidget());
|
||||
gripLayout->addWidget(m_sizeGrip);
|
||||
layout->addLayout(gripLayout);
|
||||
}
|
||||
|
||||
resize(sizeHint());
|
||||
|
||||
if (parentWidget())
|
||||
{
|
||||
if (m_isSubWindow)
|
||||
{
|
||||
move(
|
||||
parentWidget()->width() / 2 - sizeHint().width() / 2,
|
||||
parentWidget()->height() / 2 - sizeHint().height() / 2
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
move(
|
||||
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - sizeHint().width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - sizeHint().height() / 2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this->raise();
|
||||
}
|
||||
|
||||
@@ -77,10 +105,10 @@ QSize QtWindow::sizeHint() const
|
||||
|
||||
void QtWindow::setup()
|
||||
{
|
||||
m_content->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))).c_str());
|
||||
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))).c_str());
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(25, 30, 25, 0);
|
||||
layout->setContentsMargins(10, 10, 10, 10);
|
||||
|
||||
{
|
||||
QHBoxLayout* hlayout = new QHBoxLayout();
|
||||
@@ -134,6 +162,11 @@ void QtWindow::setup()
|
||||
|
||||
void QtWindow::setSizeGripStyle(bool isBlack)
|
||||
{
|
||||
if (!m_sizeGrip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string path = isBlack ? "size_grip_black.png" : "size_grip_white.png";
|
||||
|
||||
m_sizeGrip->setStyleSheet(QString::fromStdString(
|
||||
@@ -284,7 +317,12 @@ void QtWindow::hideWindow()
|
||||
hide();
|
||||
}
|
||||
|
||||
void QtWindow::resizeEvent(QResizeEvent *event)
|
||||
void QtWindow::closeEvent(QCloseEvent* event)
|
||||
{
|
||||
handleClose();
|
||||
}
|
||||
|
||||
void QtWindow::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QSize size = event->size();
|
||||
|
||||
@@ -302,16 +340,22 @@ void QtWindow::resizeEvent(QResizeEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_isSubWindow)
|
||||
{
|
||||
m_window->resize(size);
|
||||
return;
|
||||
}
|
||||
|
||||
int displacement = 0;
|
||||
if (m_hasLogo)
|
||||
{
|
||||
displacement = 58;
|
||||
}
|
||||
|
||||
QSize windowSize = size - QSize(10, 20 + displacement);
|
||||
QSize windowSize = size - QSize(30, 30 + displacement);
|
||||
|
||||
m_window->resize(windowSize);
|
||||
m_window->move(5, displacement + 10);
|
||||
m_window->move(15, displacement + 15);
|
||||
}
|
||||
|
||||
void QtWindow::keyPressEvent(QKeyEvent* event)
|
||||
@@ -361,7 +405,7 @@ void QtWindow::keyPressEvent(QKeyEvent* event)
|
||||
QWidget::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void QtWindow::mouseMoveEvent(QMouseEvent *event)
|
||||
void QtWindow::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton && m_mousePressedInWindow)
|
||||
{
|
||||
@@ -370,7 +414,7 @@ void QtWindow::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtWindow::mousePressEvent(QMouseEvent *event)
|
||||
void QtWindow::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
@@ -380,7 +424,7 @@ void QtWindow::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void QtWindow::mouseReleaseEvent(QMouseEvent *event)
|
||||
void QtWindow::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
@@ -425,11 +469,22 @@ void QtWindow::setupDone()
|
||||
|
||||
if (parentWidget())
|
||||
{
|
||||
move(
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
if (m_isSubWindow)
|
||||
{
|
||||
move(
|
||||
parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
move(
|
||||
|
||||
parentWidget()->pos().x() + parentWidget()->width() / 2 - size.width() / 2,
|
||||
parentWidget()->pos().y() + parentWidget()->height() / 2 - size.height() / 2
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QtWindow::addLogo()
|
||||
@@ -437,11 +492,10 @@ void QtWindow::addLogo()
|
||||
QtDeviceScaledPixmap sourcetrailLogo((ResourcePaths::getGuiPath().str() + "window/logo.png").c_str());
|
||||
sourcetrailLogo.scaleToWidth(240);
|
||||
|
||||
|
||||
QLabel* sourcetrailLogoLabel = new QLabel(this);
|
||||
sourcetrailLogoLabel->setPixmap(sourcetrailLogo.pixmap());
|
||||
sourcetrailLogoLabel->resize(sourcetrailLogo.width(), sourcetrailLogo.height());
|
||||
sourcetrailLogoLabel->move(30, 25);
|
||||
sourcetrailLogoLabel->move(m_isSubWindow ? 40 : 23, 25);
|
||||
sourcetrailLogoLabel->show();
|
||||
|
||||
m_hasLogo = true;
|
||||
|
||||
@@ -18,7 +18,7 @@ class QtWindow
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QtWindow(QWidget* parent = nullptr);
|
||||
QtWindow(bool isSubWindow, QWidget* parent = nullptr);
|
||||
|
||||
QSize sizeHint() const override;
|
||||
|
||||
@@ -63,11 +63,12 @@ signals:
|
||||
void previous();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event) Q_DECL_OVERRIDE;
|
||||
void resizeEvent(QResizeEvent* event) Q_DECL_OVERRIDE;
|
||||
void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
|
||||
void mouseMoveEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
void mousePressEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
void mouseReleaseEvent(QMouseEvent* event) Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void populateWindow(QWidget* widget);
|
||||
virtual void windowReady();
|
||||
@@ -80,6 +81,8 @@ protected:
|
||||
void addLogo();
|
||||
QHBoxLayout* createButtons();
|
||||
|
||||
bool m_isSubWindow;
|
||||
|
||||
QWidget* m_window;
|
||||
QWidget* m_content;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ QtProjectWizzard::QtProjectWizzard(QWidget* parent)
|
||||
|
||||
QSize QtProjectWizzard::sizeHint() const
|
||||
{
|
||||
return QSize(1000, 700);
|
||||
return QSize(900, 600);
|
||||
}
|
||||
|
||||
void QtProjectWizzard::newProject()
|
||||
@@ -590,7 +590,7 @@ void QtProjectWizzard::newSourceGroup()
|
||||
QtProjectWizzardWindow* window = createWindowWithContent(
|
||||
[this](QtProjectWizzardWindow* window)
|
||||
{
|
||||
window->setPreferredSize(QSize(570, 420));
|
||||
window->setPreferredSize(QSize(570, 380));
|
||||
return new QtProjectWizzardContentSelect(window);
|
||||
}
|
||||
);
|
||||
@@ -651,6 +651,7 @@ void QtProjectWizzard::emptySourceGroup()
|
||||
QtProjectWizzardWindow* window = createWindowWithContent(
|
||||
[this](QtProjectWizzardWindow* window)
|
||||
{
|
||||
window->setPreferredSize(QSize(470, 230));
|
||||
return new QtProjectWizzardContentLanguageAndStandard(m_newSourceGroupSettings, window);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
|
||||
|
||||
QtProjectWizzardWindow::QtProjectWizzardWindow(QWidget *parent, bool showSeparator)
|
||||
: QtWindow(parent)
|
||||
: QtWindow(false, parent)
|
||||
, m_content(nullptr)
|
||||
, m_showSeparator(showSeparator)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user