Files
qelectrotech-source-mirror/sources/PropertiesEditor/propertieseditordockwidget.h
T
Jeff Patterson bf940a7205 Keep a tabbed Selection properties panel from locking its tab stack
Since #1572 the empty Selection properties panel shrinks to its title bar.
When it shares a tab stack with another panel, such as Collections, Qt
gives the whole stack the smallest maximum height of its tabs, so the
stack could not be resized while nothing was selected and snapped back
small on every deselect.

The panel now shrinks only when it is not tabbed. While tabbed it keeps the
normal size limits and skips remembering and restoring the area heights,
which would otherwise bring back heights from before it was tabbed.

tst_selectionpanelheight gets a tabbed case: the stack can be made taller
with nothing selected, keeps its height through a select and deselect, and
the panel shrinks again once untabbed.
2026-10-23 05:35:41 -05:00

61 lines
1.7 KiB
C++

/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech 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.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SELECTIONPROPERTIESDOCKWIDGET_H
#define SELECTIONPROPERTIESDOCKWIDGET_H
#include <QDockWidget>
#include <QPointer>
class PropertiesEditorWidget;
namespace Ui {
class PropertiesEditorDockWidget;
}
class PropertiesEditorDockWidget : public QDockWidget
{
Q_OBJECT
public:
explicit PropertiesEditorDockWidget(QWidget *parent = nullptr);
~PropertiesEditorDockWidget() override;
virtual void clear();
virtual void apply();
virtual void reset();
bool addEditor (PropertiesEditorWidget *editor, int index = 0);
QList<PropertiesEditorWidget *> editors() const;
bool removeEditor (PropertiesEditorWidget *editor);
protected:
QList <PropertiesEditorWidget *> m_editor_list;
private:
void rememberHeight();
void restoreHeight();
void updateSizeConstraint();
bool isTabbed() const;
Ui::PropertiesEditorDockWidget *ui;
QList<QPointer<QDockWidget>> m_area_docks;
QList<int> m_area_heights;
bool m_restore_pending = false;
};
#endif // SELECTIONPROPERTIESDOCKWIDGET_H