-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix pointcloud properties dialog minimum size #55976
Changes from 2 commits
556a119
913b821
f6e704f
9015c7f
6d56b11
6218dda
b060659
0b6ca1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/*************************************************************************** | ||
qgsstackedwidget.cpp | ||
-------------------- | ||
begin : January 2024 | ||
copyright : (C) 2024 by Stefanos Natsis | ||
email : uclaros at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsstackedwidget.h" | ||
|
||
#include <QStackedWidget> | ||
#include <QSize> | ||
|
||
|
||
QgsStackedWidget::QgsStackedWidget( QWidget *parent ) | ||
: QStackedWidget( parent ) | ||
{ | ||
} | ||
|
||
QSize QgsStackedWidget::sizeHint() const | ||
{ | ||
return currentWidget() ? currentWidget()->sizeHint() : QSize(); | ||
} | ||
|
||
QSize QgsStackedWidget::minimumSizeHint() const | ||
{ | ||
return currentWidget() ? currentWidget()->minimumSizeHint() : QSize(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*************************************************************************** | ||
qgsstackedwidget.h | ||
------------------ | ||
begin : January 2024 | ||
copyright : (C) 2024 by Stefanos Natsis | ||
email : uclaros at gmail dot com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSSTACKEDWIDGET_H | ||
#define QGSSTACKEDWIDGET_H | ||
|
||
#define SIP_NO_FILE | ||
|
||
#include <QStackedWidget> | ||
#include "qgis_gui.h" | ||
|
||
class QSize; | ||
|
||
/** | ||
* \class QgsStackedWidget | ||
* \ingroup gui | ||
* \brief A QStackedWidget that can be shrunk to its current widget's size. | ||
* | ||
* A regular QStackedWidget can be shrunk down the size of its | ||
* largest page widget. A QgsStackedWidget only takes the current | ||
* page widget into account when resizing. | ||
* | ||
* \since QGIS 3.36 | ||
*/ | ||
class GUI_EXPORT QgsStackedWidget : public QStackedWidget | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice approach! Can I suggest for future proofness that we:
This way we could start moving everything over from QStackedWidget to QgsStackedWidget, and we'd have a natural place to add other tweaks and improvements in future. Much like what we do for QgsScrollArea. (There's also a test to force use of QgsScrollArea over QScrollArea, we could potentially add the same for QgsStackedWidget later) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I guess we could, I'm not sure about the potential gain (other than homogeneity). In most places we use a stacked widget it either holds similar widgets or it is used as a temporary container and the inactive page gets deleted. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's definitely value in this minimal height stacked widget elsewhere. There's lots of places where we have ugly empty space in dialogs because a stacked widget has forced a too large minimum height for the current page, and all the widgets under that get pushed down for no visible reason. I'd still push for the enum setting added, because this is kind of our one change to do that and have the default behavior match QStackedWidget. If we need to add other tweaks to QgsStackedWidget in future then things get a bit messier as we'd need to avoid breaking the initial default behaviour. |
||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** | ||
* Constructor for QgsStackedWidget. | ||
*/ | ||
explicit QgsStackedWidget( QWidget *parent = nullptr ); | ||
|
||
QSize sizeHint() const override; | ||
QSize minimumSizeHint() const override; | ||
|
||
}; | ||
|
||
#endif // QGSSTACKEDWIDGET_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's expose, there's potential value here for plugins
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we maybe backport this as is and then expose and expand on a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with that